I am having a hard time understanding conditions and triggers. What I am trying to figure out is once a trigger is activated, will it continue to check the condition indefinitely until they are met or only for that instance. Here is an example that hopefully will help me understand. I use input booleans for presence detection and I want a light to go on if everyone is gone. The tricky part for me is I want it to go on if everyone is out of the house before sunset or the last person leaves after sunset. Will this require two automations, or am I missing something:
I could:
use the light as a trigger with sunset and the input booleans as conditions but if the light is off, and never goes to on…no trigger right? Or can I just put the state of the light as off as a trigger?
I could use the input boolean as a trigger, and the light off and after sunset as conditions but if everyone leaves before sunset will it trigger after sunset? Meaning, the trigger happens and keeps checking until all the conditions are met or if the trigger happens and the conditions aren’t met in that instance then it is done?
same scenario for using sunset as a trigger. If someone leaves after sunset, will the light turn on? meaning, one person is home after sunset but decides to leave at say 9 pm. Will them leaving (which is a condition) finally be met and the trigger will activate?
The condition will be tested once right after the automation is triggered.
Sometime the difference with trigger and condition can be summed like this
if you set Time as a trigger and sunset as the condition - HA will check every second if its sunset and then do its action, good for always available (like after reset) but process heavy
if you set Sunset as the trigger with no condition, it will trigger only when changing to sunset - process light but only will work at state changes
Hmm…As I worked it out in my head, I figured out I am going to need two automations:
The light is off, everyone is gone (before sunset) and the sun sets and
---------Sunset is the trigger
If it is after sunset, the light is off, and everyone leaves
---------Last person leaving is the trigger.
@RobDYI, I agree with your explanation except for when you use time as a trigger (your #1), it only gives you a slot to input one time meaning it will only trigger at that one instance. Using time as a condition allows you to define a range of before and after.