📓
Bench Notes
Vol. 3 · Automation Pack
Bench Notes · Home Lab Series · Vol. 3

Home Assistant
Automation Pack

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.

Copy-Paste YAML 38 Automation Blocks Field-Tested Lighting · Presence · Safety Reliability · Energy · Scenes
Published by Bench Notes · benchnotes.net · © 2025 All rights reserved
🏠 💡 👤 🔒 🔄 🎬 LIGHTS PRESENCE SAFETY ENERGY RELIAB. SCENES BENCH NOTES · VOL. 3
benchnotes.net · Home Lab Series · Volume 3 of 3 © 2025 Bench Notes · Personal use only
📓
Bench Notes
benchnotes.net
© 2025 Bench Notes. All rights reserved.
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 — check HomeLabGuides on Etsy with your order number.
Questions? hello@benchnotes.net · Purchased via Etsy? Your order confirmation contains 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.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 — All 38 Blocks
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 setup Tested across 30+ HA updates 12 automations sourced directly from live config Field-tested on Zigbee, Z-Wave, and Wi-Fi devices Survived every HA breaking change 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.

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 before deploying any automation in this pack.

📍
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 NameTypeWhy it existsUsed 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 helpers before deploying any automation
→ 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.

1
Create the 5 required helpers
Settings → Devices & Services → Helpers → + Create Helper
Create: input_boolean.night_mode · input_boolean.presence_you · input_boolean.kitchen_motion_triggered · input_select.house_mode (options: Day, Evening, Night, Movie, Away)
~3 min✓ All appear in Developer Tools → States
2
Deploy §2.1 — Home/Away Presence
Settings → Automations → + New → Edit in YAML → paste §2.1 Part A & Part B
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✓ Test with ▶ Run — check logbook for entry
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✓ Developer Tools → States → sun.sun shows "below_horizon" at trigger
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 system running — ~25 minutes total
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 → Services → 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 → Services → 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.

💡
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.1 Sunset 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)
OutcomeEliminates manual exterior light switching permanently. Zero missed sunset-lighting events after deploy.
Two automations — create separately in HASettings → Automations → + New Automation → Edit in YAML
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
1.2 Motion-Based Room Lighting
Intermediate★ Real YAMLSAVES TIME
What it does
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.
Required
binary_sensor.motion
switch.your_light
input_boolean.motion_triggered
OutcomeReduces manual light switching by ~80% in any room with a motion sensor. Pays for the sensor cost in convenience within a week.
Two automations — deploy both
# 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
1.3 Smart Dim Evening Mode
IntermediateCOMFORT
What it does
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.floor_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 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
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.
Two approaches — pick one
# 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
1★ Context-Aware Lighting
Advanced COMFORT
OutcomeOne motion sensor delivers 5 different lighting experiences depending on what's actually happening in the house — time, presence, house mode, and previous state all factor in. 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, evening → warm dim, away → skip, 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.
Required
input_boolean.night_mode
input_select.house_mode
binary_sensor.room_motion
binary_sensor.anyone_home
Single automation — 5-branch choose blockRequires helpers from §00.6 to be created first
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}
◆ End of the sample chapter ◆

The other 8 chapters are in the PDF.

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.

Get the PDF

Read offline. Print it. Support the work.

The polished, printable version of Vol. 3 — formatted for letter size, ad-free, yours to keep.

Get the PDF on Etsy
Bench Notes shop · HomeLabGuides
  Etsy checkout · Instant PDF download
Inside the PDF
02Presence & Occupancy
03Night Mode & Sleep Automation
04Notifications That Don't Annoy You
05Safety & Monitoring
06Energy & Climate
07Reliability & Self-Healing
08Scenes & One-Tap Actions
09Debug & Fix Playbook
10What Comes Next
AEntity Naming Examples

v1.2.0 · Last updated May 2026