Knowledge base / Home Assistant / Automations in Home Assistant: triggers, conditions and actions explained
Automations in Home Assistant: triggers, conditions and actions explained
Learn how Home Assistant automations work with plain examples: what starts them, what checks them and what they do. Includes blueprints, run modes and tips.

In short
- Every automation has a trigger (what starts it), optional conditions (checks) and actions (what it does).1
- You can build automations in a visual editor and switch to YAML text when you want.2
- Blueprints are ready-made automations from the community; you fill in a few fields.3
- Run modes decide what happens when an automation starts again while it is still running. The default is single.4
An automation is a rule that makes your home act on its own. Each rule has three parts: a trigger (what starts it), conditions (optional checks) and actions (what happens). Home Assistant lets you build rules by choosing from your own devices, with no code. 125
The three building blocks
Trigger. The event that starts the automation, such as sunset, a door opening or a button press. 1
Condition. A check of whether something is true at that moment, such as whether a door is closed. If a condition is not met, the actions after it do not run. 1 Conditions are optional.
Action. What Home Assistant does, such as turning on a light, sending a notification or activating a scene. 1
The project’s own example is a person arriving home after sunset and the living room lights switching on. Arriving home is the trigger, being after sunset is the condition, and turning on the lights is the action. 1 If the person arrives before sunset, the lights stay off. They will not turn on later at sunset, because the trigger already happened while the condition was false. 1
Remember this rule: an automation starts when something happens, not while something remains true. 5
Examples in plain words
These are ideas, not ready-made recipes. Your devices and names will differ.
Light in the hallway
- Trigger: the motion sensor in the hallway detects movement.
- Condition: it is dark outside, or the hallway light level is low.
- Action: turn on the hallway light. Turn it off again after five minutes without motion.
Goodnight
- Trigger: you press a “Goodnight” button, or the clock reaches 23:00.
- Condition: nobody is in the living room.
- Action: switch off all lights downstairs, lower the thermostat and send a notification if a window is still open.
Cheap electricity
- Trigger: the electricity price falls below a level you set. This needs a price sensor, for example from a Dutch dynamic price integration.
- Condition: the car is plugged in and the battery is not full.
- Action: start charging the car.
Washing machine ready
- Trigger: power use of the washing machine drops to nearly zero.
- Condition: somebody is at home.
- Action: send a notification to the phone, or have a speaker announce it.
Build your first automation
- Go to Settings, then Automations and scenes.
- Choose Create automation, then Create new automation. 2
- Pick a trigger, then optional conditions, then actions. The editor guides you. 2
- Give it a clear name and save. 2
- Test it by causing the trigger yourself.
If you prefer text, open the menu and choose Edit in YAML. You can switch back to the visual editor at any time, and you can even edit just one step in YAML. 2 You can also disable a whole automation, or one step, without deleting it. 2 That helps when you are testing.
Blueprints: ready-made automations
A blueprint is an automation template shared by the community. You import it once and then create automations from it by filling in a few fields. 3 You can reuse the same blueprint for different devices. 3
Home Assistant comes with a few blueprints, such as Motion-activated Light and Zone Notification. 3 With Motion-activated Light, you choose your motion sensor and your light, and the result is a light that turns on when motion is detected. 3 You find community blueprints in the Blueprints Exchange on the Home Assistant forum. 3
Only import blueprints from sources you trust. Home Assistant asks you to confirm when an address is not one of its known sources. 3
Run modes: what if it starts twice?
What should happen if the trigger fires again while the automation is still running? The run mode decides. 4
| Mode | What happens |
|---|---|
| Single (default) | The new start is ignored while a run is in progress, and a warning is logged. 4 |
| Restart | The current run stops and a new one begins. 4 |
| Queued | The new run waits until earlier runs have finished. 4 |
| Parallel | A new run starts at once, next to the current ones. 4 |
For queued and parallel, you can set a maximum number of runs; the default is 10. 4 Restart is useful for “turn off after five minutes without motion”: each new movement restarts the timer.
Tips for reliable automations
- Start simple. One trigger, one action. Add conditions when you see unwanted behaviour.
- Use areas and names. A trigger, condition or action can target a whole area, floor or label instead of a single device. 5
- Name every step. It makes errors easier to find in the trace. 2
- Avoid loops. An automation that switches a light that triggers the same automation can run forever. Use conditions to prevent this.
- Check the safety side. Do not automate anything that could be dangerous if it fails, such as heating elements or garage doors, without a safe fallback.
- Use backups. Back up before you make big changes.
What this means for your home
Start with two or three automations that save you real effort: lights that follow your movement, a goodnight routine and a notification when something needs attention. Add energy-related rules later, once you know your usage. See the energy dashboard guide for that. Use blueprints to save time, and read what a blueprint does before you import it.
Questions
What is the difference between a trigger and a condition?
A trigger is the moment that starts the automation, such as a door opening. A condition is a check at that moment, such as whether it is after sunset. If the condition is not true, the actions do not run.1
Do I need to write code?
No. The visual editor lets you choose triggers, conditions and actions from your own devices.25 You can switch to YAML for any automation, or just for one step.2
What is a blueprint?
A blueprint is a ready-made automation shared by the community. You import it once and then create automations from it by filling in a few fields.3
Sources
- Automation basics, Home Assistant. Accessed 30 November 2026.
- Automation editor, Home Assistant. Accessed 30 November 2026.
- Using automation blueprints, Home Assistant. Accessed 30 November 2026.
- Automation modes, Home Assistant. Accessed 30 November 2026.
- Automations, Home Assistant. Accessed 30 November 2026.
A hub in your own home ties all devices, brands and protocols into one system, with one app. Lights, heating, locks and energy then work together instead of in separate apps.See the solution


