I see; so current_operation refers to the operating mode, not the operating state. In that case, like you said, my suggestion could produce an undesirable result. I certainly wouldn’t want to see idle reported as an operating mode!
def current_operation(self):
"""Return the current state of the thermostat."""
state = self._pdp.hvac_state
if state in (1, 2):
return STATE_IDLE
if state == 3:
return STATE_HEAT
if state == 6:
return STATE_COOL
Just out of curiosity, how does Simple Thermostat render your new MQTT HVAC platform?
I tried the 0.86.4 version of MQTT HVAC and, as expected, the operating state is equal to the operating mode. In this screenshot, State and Mode indicate Heat but, in reality, the furnace is not running (it’s idle).
Naturally, this completely screws up a History Statistics Sensor I have that reports total daily heating hours. Given that state=mode, it reports the furnace is heating all day long. Just one of a few reasons I haven’t upgraded from 0.80 yet!
You can use my old component or new until new PR is merged. Both works with 0.87.
This is Lovelace’s thermostat card with new PR:
Simple Thermostat should work same, i.e show ‘off’ or current operation mode.
Thank you. However, my custom MQTT HVAC continues to work well for 0.80. It incorporates some of your code in the PR that was cancelled (to manage operating state) plus three additional COMMAND templates:
CONF_MODE_COMMAND_TEMPLATE
CONF_FAN_MODE_COMMAND_TEMPLATE
CONF_HOLD_COMMAND_TEMPLATE
It produces this with Simple Thermostat (idle state):
I’ve revised my custom version of MQTT HVAC (for 0.86.4) and now have it reporting operating state independently of operating mode. The following image shows three versions of Lovelace thermostat card all showing the correct operating state (Idle, furnace is enabled but not actively heating).
As a result, the temperature history chart, and my history statistics sensor, now correctly report active heating hours.
To achieve this, I had to directly act on self._state and use the state() method. In other words, I did what Paulus advised against … so my modification would never survive a PR review.
So is this heating chart already fixed? I am asking because I see few incosistencies and am not sure is it in system not ready or there is something wrong with my settings.
I have a Template Sensor that displays the thermostat’s hvac_action attribute. Then there are two History Stats sensors, one for heating and the other for cooling, that report how long hvac_action was heating, or cooling.