15 Best Home Assistant Automations in 2026 (With YAML Examples)
The 15 most useful Home Assistant automations running in production right now. Complete YAML for each — from motion-activated night lights to intelligent alarm response. Copy, paste, customize.
15 Best Home Assistant Automations in 2026 (With YAML Examples)
Most "best automations" lists give you ten variations of "turn on a light when motion is detected." This is not that. These are the 15 automations that actually run every day on a production Home Assistant system with 54 wired zones, 71 lighting entities, 4 IP cameras, and distributed whole-house audio. Every automation here has been tested, debugged, and refined through actual daily use.
Each one includes the full YAML so you can drop it into your system and customize it.
1. Time-Based Motion Night Lights
The single most useful automation you can build. Motion sensor triggers a light at brightness levels that change throughout the night — dim at 2 AM, brighter at 6 AM. Nobody wants to get blinded walking to the bathroom.
automation:
trigger:
entity_id: binary_sensor.hallway_motion
to: "on"
condition:
after: sunset
after_offset: "-00:30:00"
action:
target:
entity_id: light.hallway
data:
brightness: >
{% set hour = now().hour %}
{% if hour >= 22 or hour < 1 %}77
{% elif hour >= 1 and hour < 5 %}25
{% elif hour >= 5 and hour < 7 %}51
{% else %}102{% endif %}
entity_id: binary_sensor.hallway_motion
to: "off"
for: "00:02:00"
target:
entity_id: light.hallway
The `wait_for_trigger` pattern is critical. It waits for motion to clear for 2 full minutes before turning off, so continuous movement keeps the light on.
2. Alarm-Triggered Full Response
When a real alarm triggers, you need more than a notification. This fires sirens, flashes every light in the house, sends camera snapshots, and announces through distributed speakers — all simultaneously.
automation:
trigger:
entity_id: alarm_control_panel.area_1
to: "triggered"
action:
target:
entity_id: siren.front_sirens
target:
entity_id: group.all_interior_lights
data:
brightness: 255
flash: long
data:
title: "ALARM TRIGGERED"
message: "{{ trigger.to_state.attributes.changed_by }}"
data:
push:
sound:
name: alarm.caf
critical: 1
volume: 1.0
target:
entity_id: tts.piper
data:
media_player_entity_id: media_player.whole_house
message: "Security alert. Alarm has been triggered. Authorities have been notified."
The `parallel` block is essential. You do not want these actions running sequentially — every second matters in an alarm response.
3. Garage Door Left Open Warning
Escalating notifications when a garage door is left open. First alert at 10 minutes, repeat every 15 minutes, and auto-close after 30 minutes if nobody responds.
automation:
trigger:
entity_id: cover.garage_bay_1
to: "open"
for: "00:10:00"
action:
while:
entity_id: cover.garage_bay_1
state: "open"
sequence:
data:
title: "Garage Door Open"
message: >
Bay 1 has been open for {{ relative_time(states.cover.garage_bay_1.last_changed) }}.
data:
actions:
title: "Close It"
entity_id: cover.garage_bay_1
state: "open"
for: "00:30:00"
target:
entity_id: cover.garage_bay_1
The actionable notification with the "Close It" button means you can fix it without opening the app.
4. Welcome Home Presence Detection
Detects when you arrive home and adjusts the house — unlocks the door, turns on path lighting, disarms the alarm, and announces your arrival.
automation:
trigger:
entity_id: person.your_name
to: "home"
condition:
entity_id: alarm_control_panel.area_1
state: "armed_away"
action:
target:
entity_id: alarm_control_panel.area_1
data:
code: !secret alarm_code
target:
entity_id:
data:
brightness: 200
target:
entity_id: tts.piper
data:
media_player_entity_id: media_player.entryway_speaker
message: "Welcome home."
5. Smart Bedtime Routine
One input boolean triggers a full bedtime sequence: dims lights progressively, locks doors, arms the alarm in night mode, sets thermostat, and turns off media.
automation:
trigger:
entity_id: input_boolean.bedtime
to: "on"
action:
target:
entity_id: group.common_area_lights
target:
entity_id: light.bedroom
data:
brightness: 40
target:
entity_id: media_player.living_room_tv
target:
entity_id: alarm_control_panel.area_1
data:
code: !secret alarm_code
target:
entity_id: climate.bedroom_thermostat
data:
temperature: 68
target:
entity_id: light.bedroom
target:
entity_id: input_boolean.bedtime
6. Camera Motion Snapshot Notifications
When a camera detects motion, grab a snapshot and send it as a rich notification with the image embedded. Includes debouncing so you do not get 50 notifications for one event.
automation:
trigger:
entity_id: binary_sensor.front_driveway_motion
to: "on"
condition:
entity_id: input_boolean.front_camera_cooldown
state: "off"
action:
target:
entity_id: input_boolean.front_camera_cooldown
target:
entity_id: camera.front_driveway
data:
filename: /config/www/snapshots/front_driveway_latest.jpg
data:
title: "Motion: Front Driveway"
message: "Movement detected at {{ now().strftime('%I:%M %p') }}"
data:
image: /local/snapshots/front_driveway_latest.jpg
target:
entity_id: input_boolean.front_camera_cooldown
The cooldown boolean prevents notification floods. One minute between alerts per camera.
7. Adaptive Lighting by Time of Day
Adjusts light color temperature throughout the day — cool white for focus during work hours, warm amber in the evening, dim warm at night.
automation:
trigger:
at:
action:
target:
entity_id: group.common_area_lights
data:
kelvin: >
{% set hour = now().hour %}
{% if hour >= 7 and hour < 17 %}4500
{% elif hour >= 17 and hour < 20 %}3200
{% elif hour >= 20 and hour < 22 %}2700
{% else %}2200{% endif %}
brightness: >
{% set hour = now().hour %}
{% if hour >= 7 and hour < 17 %}230
{% elif hour >= 17 and hour < 20 %}200
{% elif hour >= 20 and hour < 22 %}140
{% else %}60{% endif %}
8. Leaving Home Auto-Arm
When everyone leaves, lock up and arm. Includes a safety delay to cancel if you forgot something and come back immediately.
automation:
trigger:
entity_id: zone.home
to: "0"
for: "00:05:00"
action:
target:
entity_id:
target:
entity_id: all
target:
entity_id: alarm_control_panel.area_1
data:
code: !secret alarm_code
data:
title: "House Armed"
message: "Everyone left. System armed away, garage closed."
The 5-minute `for` delay prevents false triggers from GPS jitter or quick trips to the mailbox.
9. Package Delivery Detection
Camera plus notification when someone approaches the front door and the doorbell is not pressed. Catches package deliveries that do not ring the bell.
automation:
trigger:
entity_id: binary_sensor.front_door_motion
to: "on"
condition:
entity_id: person.your_name
state: "not_home"
entity_id: binary_sensor.front_doorbell
state: "off"
action:
target:
entity_id: camera.front_door
data:
filename: /config/www/snapshots/front_door_delivery.jpg
data:
title: "Possible Delivery"
message: "Someone at the front door (no doorbell pressed)"
data:
image: /local/snapshots/front_door_delivery.jpg
The 3-second delay before the snapshot means you catch the person still in frame, not the initial motion blur.
10. HVAC Zone Optimization
If a room is unoccupied for 30 minutes, raise the setpoint to save energy. When motion returns, restore the comfortable temperature.
automation:
trigger:
entity_id: binary_sensor.office_motion
to: "off"
for: "00:30:00"
action:
target:
entity_id: climate.office_thermostat
data:
temperature: >
{% if state_attr('climate.office_thermostat', 'hvac_action') == 'heating' %}
62
{% else %}
78
{% endif %}
trigger:
entity_id: binary_sensor.office_motion
to: "on"
action:
target:
entity_id: climate.office_thermostat
data:
temperature: >
{% if state_attr('climate.office_thermostat', 'hvac_action') == 'heating' %}
70
{% else %}
73
{% endif %}
11. Laundry Cycle Complete Notification
Uses a power monitoring plug to detect when the washer or dryer finishes. When power drops below threshold and stays low, the cycle is done.
automation:
trigger:
entity_id: sensor.washer_power
below: 5
for: "00:03:00"
condition:
entity_id: sensor.washer_power
above: 0.5
action:
data:
title: "Laundry Done"
message: "Washer cycle complete. Move clothes to dryer."
target:
entity_id: tts.piper
data:
media_player_entity_id: media_player.kitchen_speaker
message: "The washer has finished its cycle."
The `above: 0.5` condition prevents false triggers when the washer is fully off (drawing 0W). It only fires when power drops from active to idle.
12. Lighting Scene Controller
Physical button press cycles through predefined scenes. Single press for "normal," double press for "movie," long press for "off." Works with any Zigbee or Z-Wave button.
automation:
trigger:
event_type: zha_event
event_data:
device_id: "your_button_device_id"
action:
sequence:
target:
entity_id: scene.living_room_normal
sequence:
target:
entity_id: scene.living_room_movie
sequence:
target:
entity_id: group.living_room_lights
13. Water Leak Emergency Response
Water sensor triggers an emergency: shuts off the main water valve (if you have a smart valve), sends critical notifications, and flashes a specific light as a visual indicator.
automation:
trigger:
entity_id:
to: "on"
action:
target:
entity_id: switch.main_water_valve
data:
title: "WATER LEAK DETECTED"
message: "{{ trigger.to_state.name }} at {{ now().strftime('%I:%M %p') }}. Water valve shut off."
data:
push:
sound:
name: alarm.caf
critical: 1
volume: 1.0
target:
entity_id: light.kitchen
data:
color_name: blue
flash: long
14. Sunrise Gradual Wake-Up
Mimics sunrise in the bedroom starting 30 minutes before your alarm. Lights gradually brighten from 0 to 60% with warming color temperature.
automation:
trigger:
at: input_datetime.wakeup_time
action:
target:
entity_id: light.bedroom
data:
brightness: 5
kelvin: 2200
count: 6
sequence:
target:
entity_id: light.bedroom
data:
brightness: "{{ 5 + (repeat.index * 25) }}"
kelvin: "{{ 2200 + (repeat.index * 200) }}"
Set `input_datetime.wakeup_time` to 30 minutes before you want to be fully awake. The light ramps from barely visible warm amber to a bright natural white over 30 minutes.
15. Voice Announcements for House Events
Ties multiple triggers to spoken announcements through distributed speakers. Garage opens, doors lock, alarm status changes — all announced by voice.
automation:
trigger:
entity_id: cover.garage_bay_1
to: "open"
id: garage_open
entity_id: cover.garage_bay_1
to: "closed"
id: garage_closed
entity_id: alarm_control_panel.area_1
to: "armed_away"
id: armed_away
entity_id: alarm_control_panel.area_1
to: "disarmed"
id: disarmed
action:
target:
entity_id: tts.piper
data:
media_player_entity_id: media_player.whole_house
message: >
{% if trigger.id == 'garage_open' %}Garage bay 1 is opening.
{% elif trigger.id == 'garage_closed' %}Garage bay 1 is now closed.
{% elif trigger.id == 'armed_away' %}System armed. Away mode.
{% elif trigger.id == 'disarmed' %}System disarmed. Welcome home.
{% endif %}
The trigger `id` pattern is the cleanest way to handle multi-trigger automations. One automation, one action block, multiple trigger sources resolved with templates.
The Pattern Behind Good Automations
Every solid automation shares three traits:
1. **Debouncing** — cooldown timers, `for` durations, or boolean gates prevent repeated firing
2. **Context awareness** — time of day, presence state, and system mode inform the action
3. **Graceful failure** — if one action fails, the others still run (use `parallel` and `continue_on_error`)
If your automation does not have at least one of these, it is going to annoy you within a week.
Get These Automations Pre-Built
All 15 automations above plus 20 more are available in the **Home Assistant Automation Cookbook** — complete YAML packages you can drop into your system and customize in minutes.
The **Night Lights Pack** is also available standalone if you want the most polished version of automation #1 with multi-zone support, per-room brightness curves, and helper entities pre-configured.
---
**Want more automations like these delivered weekly?** Join the newsletter for new YAML templates, automation patterns, and real-world smart home engineering.
[Subscribe to the newsletter →](https://theautomatedhome.beehiiv.com)
Enjoyed this guide?
Get more like it delivered weekly. Real configs, tested YAML, zero fluff.
Join 0+ smart home builders. No spam, unsubscribe anytime.