I’m working on an hvac integration. I’m usig core-2021.7.4 to test it on,
In my climate.py I coudn’t get the hvac modes i.e. heating/cooling/off updated via the hvac_mode property. I had to use a property called state and return the mode via that to make it work. Based on the development docs and other integrations the hvac_mode property should work. What am I missing?
This doesn’t work @property
def hvac_mode(self):
return self._hvac_mode
This works @property
def state(self):
return self._hvac_mode
I receive event notifications from the thermostat and call self.schedule_update_ha_state() whenever there’s a change
I don’t think you should be overriding the state property, that may be your issue. It is not listed here
I checked my integration that uses a similar technique and it works, but I have not refreshed my fork in a week or two. But I do not override the state property in my integration.
Thanks Pete. I only added the state property after not being able to get the hvac_mode property working. I found a forum post whith a link to changes in v0.96 and it says “The state of a climate entity is now always equal to the HVAC mode.” That’s what made me try the state property instead or the hvac_mode property and it worked.
Thanks for sharing your code, all other integrations I’ve checked use the hvac_mode property so there must be something wrong on my side. All other properties like target_temperature, hvac_action, current_temperature work fine. Any ideas what can stop the hvac_mode property from working? I don’t receive any error messages but all the mode icons stay greyed out. .
Never mind. Tried it again and it works today. Don’t ask me what the problem was. I haven’t changed anything, apart from commenting out the state property override. Yesterday was just one of those days when nothing works out…