38 deployable YAML blocks you can deploy in minutes. Copy-paste YAML with field notes, failure modes, and customization guidance — built from an actual home setup.
This guide assumes you can create a basic automation in the HA UI and understand what triggers, conditions, and actions are. If you are new to HA automations, Vol. 2 covers the basics before you start here — it is free at benchnotes.net/ha. New to YAML syntax entirely? See Appendix C at the back of this guide.
Every automation in this pack follows the same structure. Learn it once and you can read any page in 30 seconds.
For deploying one automation in isolation: Settings → Automations → + New Automation → Edit in YAML. Paste any block, change highlighted entity IDs, save, test with ▶ Run. To build the full system, use the Fast Track Install page instead.
These automations assume you've completed the Vol. 2 setup guide: static IPs assigned, Companion App installed, entities properly named, at least one protocol (Zigbee or Wi-Fi) working.
Every automation runs in one of four modes. The mode controls what happens when a second trigger fires while the automation is already running. Each block in this pack includes a mode comment — here is what they mean:
Every automation here was discovered the slow way — wrong approach, debug session, revised approach, working. These automations have run continuously for over two years through power outages, every HA breaking change, and multiple hardware migrations. The YAML in this pack skips all that. You get the version that already works, with the failure modes already documented.
Every YAML block uses generic entity IDs like light.porch or person.your_name. Replace these with your actual entity IDs — find them in Developer Tools → States. Lines that need changing are highlighted in yellow.
Individual automations are useful. A connected system is transformational. This page shows the dependency chains — build in the right order and each automation amplifies the next.
Motion lights stay off when you're away (§4.2 filter). Night mode dims them automatically (§3.2). One boolean controls the whole lighting personality of the house.
§2.2 "Anyone Home" feeds directly into §6.2 and §6.3. Your thermostat goes to eco when you leave, restores on arrival — no manual adjustment ever.
§7.1–7.4 form a self-healing loop: power restore → lights safe → notification confirms → service health watches. Fail-state and recovery both handled automatically.
Helpers are the shared state layer — they're what allow multiple automations to coordinate without knowing about each other. Create these before deploying any automation in this pack.
Settings → Devices & Services → Helpers → + Create Helper. Choose the type, set the name exactly as shown below, save. No YAML needed — all helpers in this pack are created through the UI.
| Helper Name | Type | Why it exists | Used by |
|---|---|---|---|
| input_boolean.night_mode | Toggle | Master night state switch. When on, lighting automations dim instead of full-bright. Bedtime and wake routines toggle this. | §3.1, §3.2, §3.3, §3.4, §8.3 |
| input_boolean.presence_[name] | Toggle | Debounced presence flag per person. More reliable than reading person.entity directly — eliminates GPS flicker. Create one per household member. | §2.1, §2.2 |
| input_boolean.kitchen_motion_triggered | Toggle | Tracks whether a motion automation turned a light on. Prevents the auto-off rule from firing when a light was turned on manually (not by motion). | §1.2 |
| input_boolean.office_occupied | Toggle | Room-level presence flag. Set by motion + time conditions, cleared after sustained absence. Other automations read this instead of the raw sensor. | §2.3 |
| input_select.house_mode | Dropdown | Whole-house mode selector with options: Day, Evening, Night, Movie, Away. Lighting and climate automations branch on this value using choose: blocks. | §1.3, §8.1, §8.4 |
Two minutes here saves two hours of debugging later. Verify the checklist, then follow the build order — each step validates the one before it.
Follow this sequence exactly. Each step takes 2–5 minutes. No decisions, no judgment calls — just the order that works. The other navigation aids (Build Order, System Map, TOC) are reference material for after your baseline system is running.
Deploy §1.1 first if you want a single-automation quick win before setting up the full foundation. It works standalone — no helpers, no presence, no conditions. Sunset fires, lights turn on. Done. Then return to Step 1 of the Fast Track above to build the rest.
This pack assumes a working Home Assistant setup. If you're coming in cold, these four checks confirm you have everything the automations depend on — before you hit a wall at step 3 of the Fast Track.
Settings → System → General → Home Location. Set your coordinates. This enables sun-based automations (§1.1, §5.3) and NWS weather alerts (§5.3, §5.4).
sun.sun shows elevation and azimuth valuesInstall the Home Assistant Companion App on your phone. Required for presence automations (§2.1, §2.2, §2.4) and all push notifications (§4.x, §7.2). iOS and Android both supported.
person.your_name shows "home" or "not_home"Chapters 5 and 7 use RGB color (red flash for alerts, green pulse for recovery). You need at least one RGB or color-temperature light integrated into HA. Philips Hue, TRADFRI, or any RGBW Zigbee bulb works.
light.turn_on with rgb_color: [255,0,0]All notification automations need a notify service. The simplest: Companion App push (notify.mobile_app_your_phone). Optional but powerful: ntfy.sh for server-side push without cloud.
Immediate quality-of-life wins. These four automations are the most universally useful starting point — every home benefits from them on Day 1.
Sunset lighting is the fastest win — it takes under 5 minutes, it's useful immediately, and it validates that your sun trigger is configured correctly. If 1.1 works, all other sun-based automations will too.
alias: Sunset Auto Lighting mode: single # ── TRIGGER ────────────────────────────────────────── triggers: - trigger: sun event: sunset offset: "00:00:00" # use "-00:15:00" to trigger 15 min before # ── ACTIONS ─────────────────────────────────────────── actions: - action: light.turn_on data: brightness_pct: 100 color_temp_kelvin: 2203 # warm white target: entity_id: light.porch # ← change to your light # TURN OFF AT SUNRISE alias: Sunrise Lights Off triggers: - trigger: sun event: sunrise actions: - action: light.turn_off target: entity_id: light.porch # ← same light
# PART 1: Motion detected → lights on alias: Motion Light On mode: restart # ── TRIGGER ────────────────────────────────────────── triggers: - trigger: state entity_id: binary_sensor.kitchen_motion # ← your sensor to: "on" # ── CONDITIONS ─────────────────────────────────────── conditions: - condition: time after: "06:00:00" before: "23:00:00" - condition: state entity_id: switch.kitchen_lights # ← your light state: "off" # ── ACTIONS ─────────────────────────────────────────── actions: - action: switch.turn_on target: entity_id: switch.kitchen_lights # ← your light - action: input_boolean.turn_on target: entity_id: input_boolean.kitchen_motion_triggered # PART 2: No motion for 5 min → lights off alias: Motion Light Off mode: restart triggers: - trigger: state entity_id: binary_sensor.kitchen_motion to: "off" for: "00:05:00" # ← change timeout here conditions: - condition: state entity_id: input_boolean.kitchen_motion_triggered state: "on" actions: - action: switch.turn_off target: entity_id: switch.kitchen_lights - action: input_boolean.turn_off target: entity_id: input_boolean.kitchen_motion_triggered
alias: Evening Mode — Auto Dim mode: single # ── TRIGGER ────────────────────────────────────────── triggers: - trigger: time at: "18:00:00" # ← when to dim # ── ACTIONS ─────────────────────────────────────────── actions: - action: input_select.select_option data: option: Evening target: entity_id: input_select.first_floor_mode - action: light.turn_on data: brightness_pct: 35 # ← dim level color_temp_kelvin: 3500 # ← warm white transition: 30 # 30-second fade target: entity_id: - light.living_room_floor_lamp - light.living_room_table_lamp # add more lights here
# APPROACH A: Target by area (cleanest) alias: All Lights Off mode: single # ── TRIGGER ────────────────────────────────────────── triggers: [] # trigger from another automation or manually # ── ACTIONS ─────────────────────────────────────────── actions: - action: light.turn_off target: area_id: - living_room - kitchen - bedroom # list all your area IDs # APPROACH B: Explicit list with exclusions alias: All Lights Off (with exclusions) actions: - action: light.turn_off target: entity_id: - light.living_room_overhead - light.kitchen_ceiling - light.bedroom_overhead # NOT including: light.kids_nightlight - action: switch.turn_off target: entity_id: - switch.kitchen_lights - switch.basement_fans
alias: Context-Aware Lighting — Living Room mode: restart # ── TRIGGER ────────────────────────────────────────── triggers: - trigger: state entity_id: binary_sensor.living_room_motion to: "on" # ── CONDITIONS ─────────────────────────────────────── conditions: - condition: state # skip entirely when nobody home entity_id: binary_sensor.anyone_home state: "on" # ── ACTIONS ─────────────────────────────────────────── actions: - choose: - # Branch 1: Night mode → dim nightlight only conditions: - condition: state entity_id: input_boolean.night_mode state: "on" sequence: - action: light.turn_on data: {brightness_pct: 8, color_temp_kelvin: 2200} target: {entity_id: light.living_room_floor_lamp} - # Branch 2: Movie mode → do nothing (respect the scene) conditions: - condition: state entity_id: input_select.house_mode state: Movie sequence: [] # intentionally empty — don't interrupt the film - # Branch 3: Evening mode → warm, dim ambiance conditions: - condition: state entity_id: input_select.house_mode state: Evening sequence: - action: light.turn_on data: {brightness_pct: 35, color_temp_kelvin: 3000, transition: 2} target: {entity_id: light.living_room_floor_lamp} - # Default: daytime, someone home, no special mode → task lighting default: - action: light.turn_on data: {brightness_pct: 80, color_temp_kelvin: 4000, transition: 1} target: {entity_id: light.living_room_floor_lamp}
You've read the setup, prerequisites, and the Core Lighting chapter. The full pack includes 8 more chapters — 38 deployable YAML automations across presence, night mode, notifications, safety, energy, reliability, scenes, and debug playbooks. About 85 pages.
v1.2.0 · Last updated May 2026