41 paste-ready automations, plus the setup blocks and drop-in patterns that wire them into one system. Copy-paste YAML with field notes, failure modes, and customization guidance, built from an actual home setup.
Home Lab Series · Volume 3 · Automation Pack · First Edition
❌ Not Permitted
🚫Sharing, forwarding, or gifting this file to others
🚫Reselling, redistributing, or uploading publicly
🚫Republishing YAML as your own product or course material
🚫Using as AI training data in any form
✅ Permitted
✔Using all YAML in your own Home Assistant setup
✔Modifying automations to fit your devices
✔Printing a personal reference copy
✔Sharing the benchnotes.net URL (not the file)
YAML + Free Updates: All automations in this pack are tested on a real setup and updated when HA changes break them. Future updates are free, message me with your order number.
Questions? hello@benchnotes.net · Your order confirmation contains your access details.
Table of Contents
00How to Use This PackStart Here
, Structure of each automation · Required baseline · Quick-start guide
01Core Lighting AutomationsSTART HERE
1.1Sunset Auto Lighting
1.2Motion-Based Room Lighting
1.3Smart Dim Evening Mode
1.4"All Lights Off" One-Tap Scene
02Presence & OccupancyREQUIRED
2.1Home / Away Mode (Single Person)
2.2Multi-Person Presence Logic
2.3Room-Level Presence with Helper
2.4Welcome Home Notification
03Night Mode & SleepHigh Value
3.1Night Mode Activation
3.2Night Lighting Rules
3.3Bedtime Shutdown Routine
3.4Morning Wake-Up Routine
04Notifications That Don't Annoy YouOPTIONAL
4.0One-Time Setup: The ntfy Command
4.1Critical Alerts, Weather, Power, Safety
4.2Filtered Notifications (Away-Only)
4.3Quiet Hours, Suppress at Night
4.4HA Restart Notification
05Safety & MonitoringREQUIRED
5.1Door/Window Left Open Alert
5.2Service Offline Detection & Alert
5.3Weather Alert with Light Flash
5.4Weather Alert Cleared & Restore
06Energy & ClimateOPTIONAL
6.1Idle Device Shutdown
6.2Climate Away Setback (Eco Mode)
6.3Climate Home Restore
6.4Energy Spike Alert
07Reliability & Self-HealingREQUIRED
7.1Power Restore, Night Safety
7.2Power Restore, Startup Notification
7.3System Health, Service Down Alert
7.4System Health, Recovery & Restore
08Scenes & One-Tap ActionsOPTIONAL
8.1Movie Mode, Enter & Exit
8.2Goodnight Scene
8.3Morning Routine, First Motion
8.4Away Scene, Leave Home
09Debug & Fix PlaybookREFERENCE
AppAppendices
AEntity Naming Reference
BCopy/Paste Index, Every Block
CYAML Crash Course
Chapter 00 · Start Here
How to Use This Pack
📋
Prerequisites
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.
Anatomy of an Automation Entry
①②③④⑤
Header, automation number, name, difficulty badge, and ★ Real YAML tag when sourced from a live setup
Meta row, What it does · When to use · Required entities (3 columns)
YAML block, the copy-paste code. Yellow highlighted lines are the only things you need to change for your setup.
Customize / Failure modes, 2-3 things to tweak + the most common reason it doesn't work
Notes From the Field, appears when there's a real story behind why the automation is built the way it is
⚡Quick-Start, Single Automation Only
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.
📋Required Baseline
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.
⚙️
Automation Modes, Know Before You Deploy
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:
mode: single
Default. Only one instance runs at a time, new triggers are ignored while it is running. Safe for most automations.
mode: restart
Cancels the current run and starts fresh on a new trigger. Use this for motion lights, you want the timer to reset, not stack.
mode: queued
Each trigger waits its turn. Use for sequential announcements or notifications where you want every event processed in order.
mode: parallel
All triggers run simultaneously. Rare, use only when you explicitly need concurrent execution. Can cause race conditions.
⚡
This replaces 10–15 hours of trial and error
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.
Running continuously for 2+ years on a live 2-NUC home setupTested across 30+ HA updates12 automations sourced directly from live configField-tested on Zigbee, Z-Wave, and Wi-Fi devicesMaintained through Home Assistant updates since 2023
📝
On Entity IDs
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.
Chapter 00.5 · Before You Build
How These Automations Work Together
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.
Two limits to know before you build. (1) A trigger’s for: countdown resets if HA restarts or automations reload; fine for motion lights, but a deadline that must survive a restart belongs in an input_datetime helper. (2) scene.create snapshots are temporary: a reload discards them and re-creating the same scene_id overwrites the previous one. Treat snapshot-restore as best-effort visual recovery, never as durable state.
System Dependency Map
Layer 1 · Foundation
§2.1 Presence Home/Away §2.2 Anyone Home sensor §3.1 Night Mode boolean
Nothing else works without these.
These 3 helpers are read by almost every other automation. Build first.
Layer 2 · Visibility
§1.1 Sunset Lighting §1.2 Motion Lighting §4.4 HA Restart Notify
Immediate value. Works standalone. Deploy after Layer 1.
→
Layer 3 · Intelligence
§3.2 Night Dim Rules §6.2 Climate Setback §8.4 Away Scene
The house starts adapting to context.
Reads from Layer 1. Makes Layer 2 smarter, lights behave differently at night and when away.
Layer 4 · Safety Net
§7.1 Power Restore §7.3 Service Health §5.3 Weather Alert
The system that watches the system.
Works independently. Protects the system. Deploy any time after Layer 1.
→
Layer 5 · Refinement
§8.1 Movie Mode §8.2 Goodnight §4.2 Notification Filters
You stop thinking about it.
Quality of life. These work best once the lower layers are stable.
Result
A self-aware home that responds to time, presence, weather, and failures, automatically.
💡Lighting + Presence
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.
🌡Presence + Climate
§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.
🔄Reliability + Notifications
§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.
Chapter 00.6 · Setup Required
Required Helpers Setup
Helpers are the shared state layer, they're what allow multiple automations to coordinate without knowing about each other. Create these five core helpers before following the Fast Track. Bonus block 4★ needs one extra acknowledgment helper (input_boolean.garage_alert_acknowledged), created on that block’s page.
📍
Where to create helpers
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
input_select.house_mode, Options to configure
Day
Evening
Night
Movie
Away
Chapter 00.7 · Before You Start
Prerequisite Checklist & Build Order
Two minutes here saves two hours of debugging later. Verify the checklist, then follow the build order, each step validates the one before it.
✓ Before You Deploy Anything
Home Assistant running
Can reach the UI at your server's IP
Location set in HA
Settings → System → General → Home Location. Required for sun-based triggers.
At least one device integrated
A light, switch, or sensor that shows up in Developer Tools → States
Entity names verified
Know your actual entity IDs, don't assume. Check in Dev Tools before using in YAML.
Companion App installed
Required for presence automations (§2.x) and push notifications (§4.x)
Required helpers created
See page 00.6, create all 5 core helpers before deploying any automation (bonus 4★ adds its own on that page)
→ Recommended Build Order
1
§2.1, Home/Away Presence Foundation
Everything else reads from this. If presence is wrong, nothing else works correctly.
2
§2.2, Anyone Home Sensor Foundation
Unlocks climate setback, notification filters, and away scenes.
3
§1.1, Sunset Lighting Quick Win
First automation that provides immediate visible value. Validates your sun trigger.
4
§7.1 + §7.2, Power Restore Safety
Deploy before you forget. Protects against 2am outage light blast immediately.
5
§3.1, Night Mode Layer 1
Unlocks §3.2 dim rules, §3.3 shutdown, and §8.3 first-motion wakeup.
6
§6.2 + §6.3, Climate Energy
Immediate energy savings. Depends on §2.2 being correct.
7
Everything else, in any order
Once layers 1–6 are stable, the remaining automations are independent.
Fast Track · No Thinking Required
30-Minute System Install
If you follow only one section in this guide, follow this one.
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.
Create TWO automations: Settings → Automations → + New → Edit in YAML → paste §2.1 Part A. Repeat for Part B. Never paste both blocks into one editor Change person.your_name and input_boolean.presence_you to match your entities
~4 min✓ Leave home, boolean turns off within 5 min
3
Deploy §2.2, Anyone Home sensor
Add template sensor to configuration.yaml under template: block Reload: Developer Tools → YAML → Template Entities
⚠ Only step requiring a configuration.yaml edit, all others use the Automations UI File location: /config/configuration.yaml in File Editor add-on, or via SSH. See Vol. 2 §Install for the full config.yaml setup.
~3 min✓ binary_sensor.anyone_home shows correct state
4
Deploy §7.1 + §7.2, Power Restore
Two automations. Paste §7.1 and §7.2 YAML blocks. Update entity IDs in §7.1 to match your lights and switches. No changes needed for §7.2 except your notify service name.
~5 min✓ ▶ Run tests actions only; then flip the source entity in Dev Tools and check the trace
5
Deploy §1.1, Sunset Lighting
Two automations (Part A + Part B). Change light.porch to your outdoor or living room light. Optional: set offset to -00:15:00 to turn on 15 minutes before dark.
~3 min✓ ▶ Run for actions now; the real sun trigger verifies itself after tonight’s sunset
6
Deploy §3.1, Night Mode
Two automations (Activate + Deactivate). Set your preferred night time in the trigger. Creates the boolean state that §3.2, §3.3, and §8.3 all depend on.
~3 min✓ Toggle boolean manually in Dev Tools, automations respond
7
Deploy §6.2 + §6.3, Climate Setback
Change climate.living_room to your thermostat entity. Verify preset_mode value: eco for Nest, away for Ecobee. Reads directly from §2.2 anyone_home.
~4 min✓ Leave home → thermostat switches to eco within 5 min
✓
Baseline entered in ~25 minutes; real triggers (presence, sun, debounce) validate over the first day
Presence tracking · Power restore safety · Sunset lighting · Night mode · Climate setback. Everything else in this pack builds on these seven automations.
DONEDeploy remaining chapters in any order
⚡
First automation working in under 5 minutes
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.
Cold Start · No Prior Guide Needed
Skipped Vol. 2? Do These 4 Checks First
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.
📍Check 1, Location & Sun
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).
Validate: Developer Tools → States → sun.sun shows elevation and azimuth values
📱Check 2, Mobile Companion App
Install 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.
Validate: Developer Tools → States → person.your_name shows "home" or "not_home"
💡Check 3, RGB-Capable Light
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.
Validate: Developer Tools → Actions → light.turn_on with rgb_color: [255,0,0]
🔔Check 4, Notification Method
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.
Validate: Developer Tools → Actions → search "notify" → at least one service appears
Optional Integrations, Used by Specific Automations
NWS Alerts → §5.3, §5.4
HACS → NWS Alerts integration. Free, no API key. Adds sensor.nws_weather_alerts. US-only.
ntfy Push → §4.4, §7.x
Self-hosted push notification server. Used in real YAML blocks. Substitute with notify.mobile_app_* if not running ntfy.
Uptime Kuma → HA → §5.2, §7.3
Monitoring service that creates binary_sensor.*_status entities per monitored service. See Vol. 1 for setup.
Climate Entity → §6.2, §6.3
Any HA-compatible thermostat. Nest, Ecobee, Honeywell all work. Find your entity at climate.* in Dev Tools → States.
Chapter 01 · Start Here
Core Lighting Automations
Immediate quality-of-life wins. These four automations are the most universally useful starting point, every home benefits from them on Day 1.
1.1
Sunset Auto Lighting
Turn on outdoor/porch lights at sunset. Off at sunrise. The "hello world" of HA automations.
1.2
Motion-Based Room Lighting
Lights on with motion detection. Auto-off after configurable timeout. Uses a helper to prevent false triggers.
1.3
Smart Dim Evening Mode
Time-based brightness and color temperature shift. Full power during day → warm dim after 18:00.
1.4
"All Lights Off" One-Tap
One automation that turns off every light in the house. Optional exclusions for kids' rooms or nightlights.
💡
Build 1.1 First
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.
1.1Sunset Auto Lighting
Beginner★ Real YAMLCOMFORT
What it does
Turns on lights at sunset. Turns them off at sunrise. Adjusts automatically every day, no seasonal maintenance needed.
When to use
Any outdoor light, porch, backyard, or interior light you want on every evening automatically.
Required
light.your_light Location set in HA settings (for sun calculations)
OutcomeTurns the selected lights on at sunset and off at sunrise, without relying on fixed clock times.
Part A · Create as automation 1 of 2Settings → Automations → + New Automation → Edit in YAML
alias: Sunset Auto Lightingmode: single# ── TRIGGER ──────────────────────────────────────────triggers:
- trigger: sunevent: sunsetoffset: "00:00:00"# use "-00:15:00" to trigger 15 min before# ── ACTIONS ───────────────────────────────────────────actions:
- action: light.turn_ondata:
brightness_pct: 100color_temp_kelvin: 2203# warm whitetarget:
entity_id: light.porch# ← change to your light
Part B · Create as a SECOND automationTurn off at sunrise
Light on when motion detected. Off after 5 minutes of no motion. Uses a helper boolean to track whether motion triggered the light (prevents false-off).
When to use
Basement, hallway, bathroom, laundry room, any space you walk through but don't manually control lights in.
At 18:00, dims living room lights to 35% and shifts to warm white (3500K). Activates an input_select mode that other automations can read.
When to use
Any room you want to automatically transition from work-mode lighting to evening-mode lighting without manual adjustment.
Required
light.your_lights input_select.house_mode (create in Helpers)
OutcomeThe habit of manually dimming lights every evening disappears. Your house transitions itself, you just notice it feels right.
Time-triggered mode shift
alias: Evening Mode, Auto Dimmode: single# ── TRIGGER ──────────────────────────────────────────triggers:
- trigger: timeat: "18:00:00"# ← when to dim# ── ACTIONS ───────────────────────────────────────────actions:
- action: input_select.select_optiondata:
option: Eveningtarget:
entity_id: input_select.house_mode
- action: light.turn_ondata:
brightness_pct: 35# ← dim levelcolor_temp_kelvin: 3500# ← warm whitetransition: 30# 30-second fadetarget:
entity_id:
- light.living_room_floor_lamp
- light.living_room_table_lamp# add more lights here
1.4"All Lights Off" One-Tap
BeginnerSAVES TIME
What it does
Single action turns off every light and switch in the house. Triggered manually, by a button, or by other automations. Excludes specified entities.
When to use
Goodnight button, leaving home scene, or power outage recovery. The foundation for more complex shutdown routines.
Required
All your light and switch entity IDs. Or use area targeting for clean code.
OutcomeThe nightly room-to-room light hunt is gone. One tap and it's done, every time, without forgetting a room.
Approach A · Choose ONE approach, never deploy both
# APPROACH A: Target by area (cleanest)alias: All Lights Offmode: single# ── TRIGGER ──────────────────────────────────────────triggers: [] # trigger from another automation or manually# ── ACTIONS ───────────────────────────────────────────actions:
- action: light.turn_offtarget:
area_id:
- living_room
- kitchen
- bedroom# list all your area IDs
Approach B · The other option (do not deploy alongside A)Explicit list with exclusions
alias: All Lights Off (with exclusions)mode: singletriggers: [] # trigger from another automation or manuallyactions:
- action: light.turn_offtarget:
entity_id:
- light.living_room_overhead
- light.kitchen_ceiling
- light.bedroom_overhead# NOT including: light.kids_nightlight
- action: switch.turn_offtarget:
entity_id:
- switch.kitchen_lights
- switch.basement_fans
1★Context-Aware Lighting
AdvancedCOMFORT
OutcomeOne motion sensor delivers five different lighting outcomes based on night mode and house mode (including Away). This is what separates a smart home from a home with timers.
What it does
When motion is detected, chooses lighting behavior from 5 branches: night mode → dim nightlight, movie mode → do nothing, away → do nothing, evening → warm dim, default → full task lighting.
When to use
Living room, kitchen, or any high-traffic room where the "right" lighting depends on context, not just whether someone walked in.
You've read the setup, prerequisites, and the Core Lighting chapter. The full pack includes 9 more chapters, 41 paste-ready automations across presence, night mode, notifications, safety, energy, reliability, scenes, and debug playbooks, in both PDF and web-reader form. About 100 pages.
Get the full guide
Read offline. Print it. Support the work.
The polished, printable version of Vol. 3, formatted for letter size, ad-free, yours to keep.
✓ Full guide, about 100 pages
✓ Polished PDF for print & tablet
✓ Pay once, no subscription
✓ PDF yours to keep; web reader access runs 30 days