gysmo38 / mitsubishi2MQTT

Mitsubishi to MQTT with ESP8266 module
GNU Lesser General Public License v2.1
371 stars 132 forks source link

Expose compressorFrequency to Home Assistant Attributes #243

Closed prashker closed 6 months ago

prashker commented 7 months ago

Home Assistant's HVAC MQTT implementation allows "additional attributes" by passing a json_attribute_topic.

State topic for mitsubishi2mqtt already includes compressorFrequency so we just extract it with a json_attribute_template (output is a JSON DICT)

This mechanism can probably be used to expose wideVane (since HASS only sees vane) but I have no clue what vane or wideVane is (my unit is whole home)

image

I implemented this so I could do "defrost" tracking in Home Assistant using the steps here: https://github.com/gysmo38/mitsubishi2MQTT/issues/157#issuecomment-986175308

According to some comments, some Mitsubishi Heat Pumps do not correctly report compressorFrequency...however that seems like an upstream issue with HeatPump library (or just not possible for that model???), rather than an issue that needs to be handled in mitsubishi2mqtt - for now, at least users can see it in HASS and act on it if it's useful, and ignore it if it's not.

prashker commented 7 months ago

@gysmo38 I have been running this locally for about a month and haven't noticed any issues.

mcouture87 commented 6 months ago

Not being a programmer, can someone show me/us how to implement json_attribute_template to track defrost cycles?

prashker commented 6 months ago

@mcouture87 Assuming you compiled this pull request (or this got merged in) - in my case I created a Binary Sensor in Home Assistant.

{{ state_attr('climate.hvac_mqtt', 'compressorFrequency') == 0 and state_attr('climate.hvac_mqtt', 'hvac_action') == 'heating' }}

I haven't consistently relied on this yet as it seems my HVAC has a "Heat Standby" and "Heat Defrost" and I am not sure how to identify between them.

mcouture87 commented 6 months ago

@prashker - Ah yes, now I understand a bit better. I have compiled this pull request and have it installed on my 3 mini-splits. I'll be playing around with Home Assistant. I basically want to have it report the amount of time in "defrost mode".

gysmo38 commented 6 months ago

Thank for the commit :)