dlarrick / hass-kumo

Home Assistant module interfacing with Mitsubishi mini-split units
MIT License
97 stars 21 forks source link

Expose sensor Entity for each Climate Object #38

Closed barndawgie closed 1 year ago

barndawgie commented 4 years ago

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.

jhuang0 commented 4 years ago

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}}"
barndawgie commented 4 years ago

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.

dlarrick commented 4 years ago

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.

barndawgie commented 4 years ago

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

barndawgie commented 4 years ago

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 commented 1 year ago

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

dlarrick commented 1 year ago

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