Hello
I need some help. How can I trigger an automation if the variable of a sensor changes. This means that every time the value of the sensor changes, it should trigger.
I assume by “variable” you mean “state”.
So to trigger on every state (or attribute) change use this in the trigger section:
trigger:
platform: state
entity_id: sensor.your_sensor
If you leave out the “to:” or “from:” it will trigger on every state change.
thanks, this works perfect.
If your sensor is numeric (like a thermometer for instance), you can also use
trigger:
platform: numeric_state
This would allow using below:
and/or above:
, in addition. As with platform: state
, if you leave these out, it will trigger on any state change.
Rather than change the title of your topic (to [solved] ), you should actually tick the solution box of the post that most helped you get what you needed (i.e. very rarely your own but maybe finity’s first reply)
This helps others searching the forum for a topic like yours with solutions
1 Like