Modes: what happens when the automation triggers again while it's running
| Mode | Behavior | Typical use |
|---|---|---|
single (default) |
new trigger is ignored, a warning is logged ("Already running") | most automations |
restart |
stop the current run, start over (only if conditions pass) | motion light: every new motion restarts the "off after 5 min" timer |
queued |
run after the previous runs finish, in order | notifications that must all go out |
parallel |
independent run next to the others | per-device actions triggered by many entities |
For queued and parallel, max limits concurrent/queued runs (default 10), and max_exceeded sets the log level when the limit is hit (default warning, or silent).
automation:
- id: hallway_motion_light
alias: Hallway light follows motion
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.hallway_motion
to: "on"
actions:
- action: light.turn_on
target: { entity_id: light.hallway }
- delay: "00:05:00"
- action: light.turn_off
target: { entity_id: light.hallway }
If your logs keep showing "Already running" warnings, the mode is probably wrong, not the trigger.
State trigger traps
for:doesn't survive a restart. The timer resets when Home Assistant restarts or automations reload. For long durations ("door open for 2 hours"), store a timestamp in a helper or use a timer helper instead.- Attribute changes. A state trigger without
from/tofires on attribute-only changes too (a media player's position, a sensor'slast_seen). Useto: nullto fire only on real state changes.
Debug with traces
- Open the automation → Traces (or the three-dot menu in the automation list).
- The trace shows a graph of the path taken, each step's result and the variables. Usually it answers "why didn't it fire the light" in seconds: a condition was false, or the trigger never matched.
- Only the last 5 runs are kept per automation by default. Raise it while debugging:
trace:
stored_traces: 20
- YAML automations need an
idor no traces are stored.