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.