gysmo38 / mitsubishi2MQTT

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

MQTT "state" should be retained so it can be read by HA/etc. immediately #165

Closed melyux closed 1 year ago

melyux commented 2 years ago

Since the "availability" topic now shows whether the state is current or not, I think we can make the MQTT state showing the current temperature, operating state, etc. retained so that it can be retrieved and read immediately by Home Assistant or anything else that's parsing the HVAC data. Without this retain right now, for example, Home Assistant throws a bunch of errors on startup until the first recurring state topic is delivered by this program. If we retain, we can also remove the recurring MQTT state publishing and only publish on changes.

Any objections?

mamrai1 commented 2 years ago

Yes, that will also solve the problem with room temperature not sent in every message.. Not remote temp but the hvac's temp

JAAS76 commented 1 year ago

+1 for me please,

Not a fix and won't stop the errors messages in HA but will will stop the "26" error temp in HA.

Setup the HVAC in yaml:

current_temperature_template: >- {{ value_json.roomTemperature if (value_json is defined and value_json.roomTemperature is defined and value_json.roomTemperature|int > 1.00) else '26.00' }}

remove the "else '26.00' " from the code.

When I change the temp and the target and room over lap or a state is recieved without a roomTemp the current/room temp in HA is not flipped to 26 until the next mqtt state update.

gysmo38 commented 1 year ago

Please try last version. I change template for HA. It should fiw the 26 error. Not sure for the rest. Open new issue if there is still an issue.