I am trying to understand why an automation is not triggering. I looked up the forum but couldn’t find how to solve this issue.
I have a template trigger and several conditions.
When the template statement is evaluated as true and the condition is not met there is no trigger as expected.
But when the template statement is still evaluated as true and the condition becomes true, the automation is not triggering.(no entry in the automation history).
At the beginning I was using a numeric_state trigger but if the condition was not met when crossing the threshold then there will be further trigger (with my conditions). I changed it to a template trigger believing that will solve the issue. But it’s not.
The conditions are only evaluated when a trigger fires. If you want the conditions to be evaluated whenever they change then you need to put them as triggers also.
I’d like to understand the trigger template behavior.
If the template is true, then the conditions are verified and if the conditions are met then the trigger is set.
Now I am guessing that the template is continuously reevaluated when any entity is changed (sensor.rdc_ambiant_temperature in my case).
Therefore if the conditions become true and eventually sensor.rdc_ambiant_temperature changes (and the template is true), then the trigger should be set.
I am pretty sure that I have not seen a trigger in such a case hence my interrogation.
Check your logs for errors. You haven’t provided a default value for the floats, so if they fail to convert the sensor state (if, for example, you’ve mis-spelled “ambient” in the entity ID) it’ll throw an error in the logs.
Paste a screenshot of the history graph for both entities showing where you think the trigger should have fired but did not.
There is an entry in the automation log at 20:50:49, but nothing further. At 20:50:49 one of the conditions was not OK, which explains why there is no triggering.
At 22:08 the conditions were met, therefore it should have triggered at 22:23 when sensor.rdc_ambiant_temperature changed.
No. The template goes true at 20:50:49, and remains true for the rest of the time period, so no further triggers happen. HA is behaving as it should.
As per the first two responses, the conditions are only evaluated at the point of the initial trigger. If you want it to “continuously check” the conditions, you need to set them up as additional triggers. I’ve had a go below: this incorporates your pac_on_off into the triggers, but not the other zlink conditions — you can do that if it’s needed.
Note I’ve changed the original trigger from a template to a numeric_state trigger, and also added it to the conditions; and tidied up the and/or logic (and is default; or has a nice “shorthand” notation):
After several occurences of the defined triggers, I think I have the right definition for this automation.
Thanks Troon and Taras for your explanations.
I had to rewire a part of my brain to match home assistant logic