hass-kumo icon indicating copy to clipboard operation
hass-kumo copied to clipboard

Expose sensor Entity for each Climate Object

Open barndawgie opened this issue 4 years ago • 5 comments

It would be great if the hass-kumo integration could expose a sensor entity for each climate entity that it exposes - basically just a sensor that tracks the climate.*.current_temperature value.

barndawgie avatar Jul 08 '20 20:07 barndawgie

You can create a template sensor to accomplish what you're suggesting. Here's the code I use:

sensor:
  - platform: template
    sensors:
        temperature_family_room_template:
            friendly_name: "Family Room Temperature"
            value_template: "{{state_attr('climate.family_room','current_temperature')|float}}"

jhuang0 avatar Jul 08 '20 22:07 jhuang0

That's what I did. I just think it would be a nice thing to include "out of the box."

Definitely a "nice-to-have" feature request.

barndawgie avatar Jul 08 '20 22:07 barndawgie

Yeah, it's on the wishlist. I would accept a pull request but am unlikely to work on it myself.

You'll note the README actually calls out using template sensors for this purpose; indeed there are some attributes exposed on the Climate entity to be used like this.

dlarrick avatar Jul 08 '20 23:07 dlarrick

I'll see if I can put something together at some point...

barndawgie avatar Jul 08 '20 23:07 barndawgie

This is what I actually ended up with in my config; I needed to add the {%- if state_attr('climate.office', 'current_temperature') != None %} to correctly handle the current_temperature disappearing and the sensor going to 0 when issuing commands to the units:

master_bedroom_temperature:
  friendly_name: "Master Bedroom Temperature"
  value_template: >-
    {%- if state_attr('climate.master', 'current_temperature') != None %}
      {{state_attr('climate.master','current_temperature')|float}}
    {%- endif %}
  unit_of_measurement: '°F'
  availability_template: >-
    {%- if not is_state('climate.master', 'unavailable') %}
      true
    {%- endif %}

You also need to remove your double-quotes, @jhuang0, or you end up with "76.0" as a string instead of 76.0 the float.

With those two changes, my temperature history now appears to be working.

barndawgie avatar Jul 09 '20 19:07 barndawgie

I just submitted a PR for this: https://github.com/dlarrick/hass-kumo/pull/113

barndawgie avatar May 30 '23 22:05 barndawgie

This is merged, released in v0.3.7-beta. Assuming no issues I'll promote to stable in a week or so.

dlarrick avatar Aug 06 '23 16:08 dlarrick