I think that is just the copy and paste devil that changed my code when posted here :-s. The code that I have in my automation.yaml is indented correctly. Still it doesn’t fire when the set point of the thermostat changes.
You’re right. I just tested it and the temperature has to fall below 0 first (to cause the template to evaluate to false) and only then will it will trigger on the next temperature above 0. I was hoping it didn’t work that way, but it does.
Basically, it works the same way as above and below in numeric_state trigger. In this example the temperature has to ‘cross the threshold’ in order cause a trigger. In other words, if the temperature is already above the threshold of zero, further changes above the threshold won’t cause triggering.
why would you say that?
I have this related automation, based on the state changes of all my energy sensors, and works just fine. I’ve disabled it because it senses the change on all of my sensors, and it gets triggered too often… My example below is using the platform: event, event_type: state_changed.
Using trigger: state should result in the same effect?
creating a trigger state for only one sensor should just work?
has the OP tried it?
only thing one could add is a condition for the state to change more than 1 degree, or half a degree, and not trigger on other attributes of the entity_id (trigger: state also triggers on attribute changes, so have to filter these out if not desired.)
Thanks, it works fine!
I wasn’t sure, because trigger is on the thermostat state which remains “heat” during a temperature setting change, so I would expect no trigger - but it works, indeed…
Could you explain why? State trigger platform perhaps includes all attributes also, not only the main state of an entity?
I believe that’s correct - ANY change of ANY attribute will trigger the state automation even if its state string remains the same. That’s why state objects have last_changed and last_updated attributes.