Start → When? → Do
“when” has the same issue as my original concern. a lot of novices will think “when” is the trigger.
while
Start → While → Do
when–>but only if–>do
Really there isn’t anything wrong or hard to understand about the explanation in the docs
When Paulus arrives home and it is after sunset: Turn the lights on in the living room.
We can break up this automation into the following three parts:
(trigger) When Paulus arrives home
(condition) and it is after sunset:
(action) Turn the lights on in the living room
Text
The first part is the trigger of the automation rule. Triggers describe events that should trigger the automation rule. In this case, it is a person arriving home, which can be observed in Home Assistant using devices/sensors by observing the state of Paulus changing from not_home to home.The second part is the condition. Conditions are optional tests that can limit an automation rule to only work in your specific use cases. A condition will test against the current state of the system. This includes the current time, devices, people and other things like the sun. In this case, we only want to act when the sun has set.
The third part is the action, which will be performed when a rule is triggered and all conditions are met. For example, it can turn a light on, set the temperature on your thermostat or activate a scene.
Note
The difference between a condition and a trigger can be confusing as they are very similar. Triggers look at the actions, while conditions look at the current state: turning a light on versus a light being on.