below is my automation for toggling an SPZB0001 zigbee thermostat depending on the window state (determined by a Xiaomi Aqara Door Sensor). Unfortunately, it does not work. I am not quote sure what I am doing wrong, so would somebody please guide me in the right direction?
I have read the docs, that why I don’t understand how this could be wrong… It should set the hvac_mode depending on the window state…?
Just for your information, the service_template is to determine the service that should be used like “switch.turn_on” or “switch.turn_off”. You need the data_template as in your second example.
Thank you! I have tried the code @tom_l pasted… when I opened the window, the radiator turned OFF (actually visible on the radiator as well as on the Home Assistant UI); however, when I shut the window (and when I opened it again), I only got
2019-11-22 15:21:34 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.heizung_az_aus. Invalid data for call_service at pos 1: value is not allowed for dictionary value @ data['hvac_mode']
At first I only read the first part about the states, so I changed “on” to “heat”; this already worked (as far as I can tell). Is there a benefit to using climate.turn_on and climate.turn_off instead of changing the hvac mode?
I really don’t know. I don’t use it. But from what I can gather hvac_mode is now just for changing the cooling or heating mode not switching on or off. The integration has had quite a few breaking changes recently to make it work better with voice assistants, worth a read: https://developers.home-assistant.io/blog/2019/07/03/climate-cleanup.html
I had huge issues with this so I changed my method and NEVER turn the heating off, just set it to some ridiculously low value. If it hits that, the heating should be on to stop the pipes freezing.
If I’ve lost the roof or something, I’m not beyond just turning the boiler off.