Listen_state() is not triggered on climate entity change

Hi everyone,
recently I have moved from AppDaemon 3.x to 4.0.3 and experienced some problems with my automation environment. When I took a closer look I noticed that any change on climate entity (like temperature) does not trigger callback defined in listen_state().

To be exact automation scripts can change climate attributes (like changing temperatures) and this works just fine but anything else that should be triggered on climate entity change is ignored (like my sync process where in case of temp change on the main climate entity new temperature is set on 4 other thermostats)

This is something that does not make any sense and I have a filing Iā€™m missing something quite obvious.

Thanks in advance.

Can you please show the code of your app?

How is this sync process started? From AppDaemon as well?

Climate entity state only changes when the climate entity changes mode (ā€˜coolā€™, ā€˜heatā€™, ā€˜offā€™, etc).

Most likely, you need either attribute=ā€œallā€ or attribute=ā€œwhateverā€ for the specific attribute you would like to listen for a change in.

For instance:

self.listen_state(self.my_callback, climate.hvac, attribute="current_temperature")

Will call self.my_callback whenever the temperature sensor on the climate entity has a new value.

1 Like

Yes. this is in AppDaemon as well and itā€™s run in case temperature is changed on any of the thermostats in a zone.

You are correct. I missed that part. On AppDaemon3 trigger happend on any attribute change and I had ā€œheatā€ state to ā€œheatā€ state on temp change and now these triggers are non existing. ā€œattribute=allā€ helps but data structure is now completely different and Iā€™ll have to do separate handler to reformat it to correspond to old format.

Anyway, thanks a lot! This was driving me crazy for some time.

Format should be the same.

If attribute=ā€œstateā€, you get only the state.

If attribute=ā€œallā€, you get everything in a dict. The state is in the ā€œstateā€ key, and other attributes are in the ā€œattributesā€ key.

Yeah, thatā€™s it. Thatā€™s the difference.

Problem was that previously I did not have to use attribute=ā€˜allā€™ which meant that I did not have dict structure. I just pulled ā€˜stateā€™ out of dict and got it in the same format as before and now my code works again.
Thanks a lot!

May I ask what your app actually does? Does somehow sync two climate entities? am searching for a solutio to sync two climte entites because i have a beco wifi thermostat implemented via mqtt as a climate component.

Similar issue. Mine was incorrectly defined callback (without kwargs argument). Appdaemon silenty ignores callback. No error was shown.