Home Assistant Automations for Beginners: Triggers, Conditions, Actions and Scripts
Automations are where Home Assistant stops being a collection of smart gadgets and starts becoming a smart home. The terminology sounds worse than it is.
Automation or script?
An automation normally has a trigger, optional conditions and actions. A script is a reusable sequence of actions. Scripts are useful when several automations need to do the same job, such as sending a notification or flashing a light.
Triggers: what starts it?
A trigger is the event that starts an automation: a door opens, presence is detected, a time is reached or a value changes.
Conditions: should it continue?
Conditions stop an automation running when it should not. For example, a motion sensor can trigger an automation, but a light-level condition can prevent the lights switching on in daylight.
Actions: what should happen?
Actions are the useful part: switch something on, send a notification, wait, play audio, run a script or perform another Home Assistant action.
A simple example
Create an automation triggered when a door opens. Add an action to switch on a light. Add another trigger for the door closing and use trigger IDs with a Choose block so the same automation can switch the light off again.
Reuse repeated actions with scripts
If you find yourself building the same group of actions repeatedly, turn them into a script. In the video I create a simple light-flashing script and call it from an automation rather than duplicating all of the steps.
Purpose-specific triggers
Newer Home Assistant releases provide more human-friendly triggers such as door opened and door closed. Where available, these are much easier for beginners to understand than thinking about raw entity states.
Do I need YAML?
No. The visual automation editor handles a huge amount. YAML remains useful when you want to go deeper, but it should not be a toll gate you have to pass before making your first automation.
