Lighting layer
4 automations
1. Hallway light follows motion, with a 2-minute off-delay
What it does: Turns the hallway light on the instant motion is seen, and off automatically once the hallway has been clear of motion for 2 minutes.
Placeholders to replace: binary_sensor.hallway_motion, light.hallway
alias: "Hallway light follows motion, with a 2-minute off-delay"
id: hallway_motion_light_off_delay
description: "Turns the hallway light on for motion and off 2 minutes after motion clears."
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.hallway_motion
to: "on"
id: motion_on
- trigger: state
entity_id: binary_sensor.hallway_motion
to: "off"
for:
minutes: 2
id: motion_off
actions:
- choose:
- conditions:
- condition: trigger
id: motion_on
sequence:
- action: light.turn_on
target:
entity_id: light.hallway
- conditions:
- condition: trigger
id: motion_off
sequence:
- action: light.turn_off
target:
entity_id: light.hallway
Source: State trigger, to:/for:/id: — https://www.home-assistant.io/triggers/state/
Source: Cross-cutting trigger mechanics, trigger id: — https://www.home-assistant.io/docs/automation/trigger/
Source: Triggered by condition (condition: trigger, id:) — https://www.home-assistant.io/docs/scripts/conditions/
Source: choose action — https://www.home-assistant.io/docs/scripts/
Source: light.turn_on / light.turn_off with target: — https://www.home-assistant.io/docs/automation/action/
2. Turn on the porch and living room lights at sunset
What it does: Turns on two lights 30 minutes before sunset every day, using Home Assistant's own sunset calculation for your location — no fixed clock time to update with the seasons.
Placeholders to replace: light.porch, light.living_room
alias: "Turn on the porch and living room lights at sunset"
id: sunset_porch_living_room_lights
description: "Turns on the porch and living room lights 30 minutes before sunset."
mode: single
triggers:
- trigger: sun
event: sunset
offset: "-00:30:00"
actions:
- action: light.turn_on
target:
entity_id:
- light.porch
- light.living_room
data:
brightness: 180
Source: Sun trigger (event: sunset, offset:) — https://www.home-assistant.io/docs/automation/trigger/
Source: light.turn_on with target: (list) + data.brightness — https://www.home-assistant.io/docs/automation/action/
3. Closet light turns off only after motion is truly gone
What it does: Turns the closet light off 5 minutes after motion clears, instead of the instant the sensor blips clear — the fix for a light that flickers off while you're still standing there.
Placeholders to replace: binary_sensor.closet_motion, light.closet
alias: "Closet light turns off only after motion is truly gone"
id: closet_light_no_flicker_off_delay
description: "Turns the closet light off 5 minutes after motion clears, to stop it flickering off."
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.closet_motion
to: "off"
for:
minutes: 5
actions:
- action: light.turn_off
target:
entity_id: light.closet
Source: State trigger for: field — https://www.home-assistant.io/triggers/state/
Source: for: misuse and why a for: delay prevents premature firing — https://www.home-assistant.io/docs/automation/trigger/
Source: light.turn_off with target: — https://www.home-assistant.io/docs/automation/action/
4. Office motion light: bright by day, dim after dark
What it does: One motion sensor, two behaviors: full brightness during the day, a low dim glow once the sun is down, so the light never blinds you at night.
Placeholders to replace: binary_sensor.office_motion, light.office
alias: "Office motion light: bright by day, dim after dark"
id: office_motion_light_day_night_brightness
description: "Motion turns the office light on at full brightness by day, dim after dark."
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.office_motion
to: "on"
actions:
- if:
- condition: sun
after: sunset
before: sunrise
then:
- action: light.turn_on
target:
entity_id: light.office
data:
brightness: 40
else:
- action: light.turn_on
target:
entity_id: light.office
data:
brightness: 255
Source: State trigger to: "on" — https://www.home-assistant.io/triggers/state/
Source: Sunset/sunrise condition ("When dark") — https://www.home-assistant.io/docs/scripts/conditions/
Source: if/then/else; light.turn_on data.brightness — https://www.home-assistant.io/docs/scripts/
Presence layer
3 automations
5. Welcome-home lights, but only after dark
What it does: When a household member's presence changes to home, turns on the entryway and living room lights — but only if it's already dark outside, so it stays quiet on a summer evening.
Placeholders to replace: person.family_member, light.entryway, light.living_room
alias: "Welcome-home lights, but only after dark"
id: welcome_home_lights_after_dark
description: "Turns on the entryway and living room lights when someone arrives home after dark."
mode: single
triggers:
- trigger: state
entity_id: person.family_member
to: "home"
conditions:
- condition: sun
after: sunset
before: sunrise
actions:
- action: light.turn_on
target:
entity_id:
- light.entryway
- light.living_room
data:
brightness: 200
Source: State trigger to: "home" — https://www.home-assistant.io/triggers/state/
Source: Sunset/sunrise condition ("When dark") — https://www.home-assistant.io/docs/scripts/conditions/
Source: light.turn_on, multiple entity_id + data.brightness — https://www.home-assistant.io/docs/automation/action/
6. Everyone left: lights off and Eco Mode on
What it does: When the home zone's tracked-person count drops to zero, turns off every light and flips on an Eco Mode helper that your own thermostat automation, or your thermostat's own schedule, can watch for.
Placeholders to replace: input_boolean.eco_mode
alias: "Everyone left: lights off and Eco Mode on"
id: everyone_left_lights_off_eco_mode
description: "When nobody is left in the home zone, turns off all lights and enables Eco Mode."
mode: single
triggers:
- trigger: numeric_state
entity_id: zone.home
below: 1
actions:
- action: light.turn_off
target:
entity_id: all
- action: input_boolean.turn_on
target:
entity_id: input_boolean.eco_mode
Source: Numeric state trigger (below:) — https://www.home-assistant.io/triggers/numeric_state/
Source: zone state = number of tracked persons currently inside — https://www.home-assistant.io/integrations/zone/
Source: light.turn_off target: entity_id: all — https://www.home-assistant.io/docs/automation/yaml/
Source: input_boolean.turn_on — https://www.home-assistant.io/integrations/input_boolean/
7. Notify if a door is still open after everyone leaves
What it does: A second, independent layer on top of the 'everyone left' automation above: if the front door is still reading open once the home is empty, sends a phone notification.
Placeholders to replace: binary_sensor.front_door, notify.mobile_app_your_phone
alias: "Notify if a door is still open after everyone leaves"
id: door_open_when_everyone_left
description: "Notifies you if the front door is still open once the home zone is empty."
mode: single
triggers:
- trigger: numeric_state
entity_id: zone.home
below: 1
conditions:
- condition: state
entity_id: binary_sensor.front_door
state: "on"
actions:
- action: notify.mobile_app_your_phone
data:
message: "Everyone left, but the front door is still open."
Source: Numeric state trigger — https://www.home-assistant.io/triggers/numeric_state/
Source: State condition — https://www.home-assistant.io/docs/scripts/conditions/
Source: notify.mobile_app_<device_id> — https://companion.home-assistant.io/docs/notifications/notifications-basic/
Security layer
4 automations
8. Remind me when the back door stays open
What it does: Sends a phone notification if the back door has been open for 5 minutes straight.
Placeholders to replace: binary_sensor.back_door, notify.my_device
alias: "Remind me when the back door stays open"
id: back_door_open_too_long
description: "Notifies you if the back door has been open for 5 minutes."
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.back_door
to: "on"
for: "00:05:00"
actions:
- action: notify.send_message
target:
entity_id: notify.my_device
data:
message: "The back door has been open for 5 minutes."
Source: State trigger to:+for: (verbatim "Remind me when the back door stays open" example) — https://www.home-assistant.io/triggers/state/
Source: notify.send_message with target: entity_id: — https://www.home-assistant.io/integrations/notify/
9. Leak sensor sends an urgent phone alert
What it does: The instant a water leak sensor trips, sends a phone notification so you can shut off the water before it spreads.
Placeholders to replace: binary_sensor.basement_leak, notify.mobile_app_your_phone
alias: "Leak sensor sends an urgent phone alert"
id: leak_sensor_phone_alert
description: "Sends an urgent phone notification the instant the basement leak sensor trips."
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.basement_leak
to: "on"
actions:
- action: notify.mobile_app_your_phone
data:
title: "Water leak detected"
message: "The basement leak sensor just tripped. Check it now."
Source: State trigger to: "on" — https://www.home-assistant.io/triggers/state/
Source: notify.mobile_app_<device_id>, title+message — https://companion.home-assistant.io/docs/notifications/notifications-basic/
10. Night-time backyard motion sends a photo alert
What it does: Between sunset and sunrise, if the backyard camera's motion sensor trips, sends a phone notification with a live snapshot attached.
Placeholders to replace: binary_sensor.backyard_camera_motion, camera.backyard, notify.mobile_app_your_phone
alias: "Night-time backyard motion sends a photo alert"
id: night_camera_motion_alert
description: "Sends a phone notification with a snapshot if backyard motion fires after dark."
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.backyard_camera_motion
to: "on"
conditions:
- condition: sun
after: sunset
before: sunrise
actions:
- action: notify.mobile_app_your_phone
data:
message: "Motion detected in the backyard."
data:
image: "/api/camera_proxy/camera.backyard"
Source: State trigger to: "on" — https://www.home-assistant.io/triggers/state/
Source: Sunset/sunrise condition — https://www.home-assistant.io/docs/scripts/conditions/
Source: notification attachment via /api/camera_proxy/camera.NAME — https://companion.home-assistant.io/docs/notifications/notification-attachments/
11. Nightly check: is any door still open at 11 PM
What it does: Every night at 11 PM, checks the front, back, and garage door sensors together and sends one notification if any of them is still open.
Placeholders to replace: binary_sensor.front_door, binary_sensor.back_door, binary_sensor.garage_door, notify.mobile_app_your_phone
alias: "Nightly check: is any door still open at 11 PM"
id: nightly_open_door_check
description: "At 11 PM, checks the main doors and notifies you if any is still open."
mode: single
triggers:
- trigger: time
at: "23:00:00"
conditions:
- condition: state
entity_id:
- binary_sensor.front_door
- binary_sensor.back_door
- binary_sensor.garage_door
match: any
state: "on"
actions:
- action: notify.mobile_app_your_phone
data:
message: "At least one door is still open at 11 PM. Check the app for which one."
Source: Time trigger at: — https://www.home-assistant.io/triggers/time/
Source: State condition, multiple entities, match: any — https://www.home-assistant.io/docs/scripts/conditions/
Source: notify.mobile_app_<device_id> — https://companion.home-assistant.io/docs/notifications/notifications-basic/
Climate layer
2 automations
12. Space heater follows a comfort schedule
What it does: Uses a Schedule helper to turn a smart-plug space heater on during your defined comfort hours and off outside them — handy if your heater isn't a built-in Home Assistant climate device.
Placeholders to replace: schedule.heating_comfort_hours, switch.living_room_heater
alias: "Space heater follows a comfort schedule"
id: comfort_schedule_space_heater
description: "Turns the living room heater switch on and off with a Schedule helper."
mode: single
triggers:
- trigger: state
entity_id: schedule.heating_comfort_hours
to: "on"
id: schedule_on
- trigger: state
entity_id: schedule.heating_comfort_hours
to: "off"
id: schedule_off
actions:
- choose:
- conditions:
- condition: trigger
id: schedule_on
sequence:
- action: switch.turn_on
target:
entity_id: switch.living_room_heater
- conditions:
- condition: trigger
id: schedule_off
sequence:
- action: switch.turn_off
target:
entity_id: switch.living_room_heater
Source: schedule helper (on while inside a block, off otherwise) — https://www.home-assistant.io/integrations/schedule/
Source: State trigger to: "on"/"off", id: — https://www.home-assistant.io/triggers/state/
Source: Triggered by condition — https://www.home-assistant.io/docs/scripts/conditions/
Source: choose — https://www.home-assistant.io/docs/scripts/
Source: switch.turn_on (verbatim); switch.turn_off inferred from the turn_on/turn_off pairing shown for light (01/05) and input_boolean (04) — https://www.home-assistant.io/docs/automation/trigger/
13. Pause the heater while a window is open
What it does: If the living room window opens while the heater is running, switches it off; switches it back on when the window closes. Saves energy and avoids heating the outdoors.
Placeholders to replace: binary_sensor.living_room_window, switch.living_room_heater
alias: "Pause the heater while a window is open"
id: window_open_heater_pause
description: "Turns the heater off while the living room window is open, back on when it shuts."
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.living_room_window
to: "on"
for:
minutes: 1
id: window_open
- trigger: state
entity_id: binary_sensor.living_room_window
to: "off"
id: window_closed
actions:
- choose:
- conditions:
- condition: trigger
id: window_open
sequence:
- action: switch.turn_off
target:
entity_id: switch.living_room_heater
- conditions:
- condition: trigger
id: window_closed
sequence:
- action: switch.turn_on
target:
entity_id: switch.living_room_heater
Source: State trigger to:+for:, id: — https://www.home-assistant.io/triggers/state/
Source: Triggered by condition — https://www.home-assistant.io/docs/scripts/conditions/
Source: choose — https://www.home-assistant.io/docs/scripts/
Source: switch.turn_on (verbatim); switch.turn_off inferred by the same convention as above — https://www.home-assistant.io/docs/automation/trigger/
Energy layer
3 automations
14. Alert me when whole-home power draw spikes
What it does: Sends a notification the moment your home's total power draw crosses a high threshold — useful for catching a stuck appliance or an unexpected space heater.
Placeholders to replace: sensor.home_power, notify.mobile_app_your_phone
alias: "Alert me when whole-home power draw spikes"
id: high_power_usage_alert
description: "Notifies you when whole-home power draw crosses 5000 W."
mode: single
triggers:
- trigger: numeric_state
entity_id: sensor.home_power
above: 5000
actions:
- action: notify.mobile_app_your_phone
data:
message: >
Whole-home power draw just crossed 5000 W ({{ states('sensor.home_power') }} W now).
Source: Numeric state trigger (above:) — https://www.home-assistant.io/triggers/numeric_state/
Source: states() function used inside a message template — https://www.home-assistant.io/template-functions/states/
Source: notify.mobile_app_<device_id> — https://companion.home-assistant.io/docs/notifications/notifications-basic/
15. Notify when the washer (or EV charger) finishes
What it does: Watches a plug's power sensor for the classic 'running, then stopped' pattern and notifies you once the appliance has been idle for 2 minutes — the same pattern works for an EV charger's power sensor, just point it at a different entity.
Placeholders to replace: sensor.washer_power, notify.mobile_app_your_phone
alias: "Notify when the washer (or EV charger) finishes"
id: appliance_finished_notification
description: "Notifies you once the washer's power draw has stayed low for 2 minutes."
mode: single
triggers:
- trigger: numeric_state
entity_id: sensor.washer_power
below: 5
for:
minutes: 2
actions:
- action: notify.mobile_app_your_phone
data:
message: "The washer has finished its cycle."
Source: Numeric state trigger below:+for: — https://www.home-assistant.io/triggers/numeric_state/
Source: "Notify or do something when an appliance finishes" pattern (context only) — https://community.home-assistant.io/t/notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes/254841
Source: notify.mobile_app_<device_id> — https://companion.home-assistant.io/docs/notifications/notifications-basic/
16. Reminder: the entertainment center has been idling for hours
What it does: If the entertainment center's smart plug reports low standby power for 3 hours straight, sends a reminder that it's probably been left on.
Placeholders to replace: sensor.entertainment_center_power, notify.mobile_app_your_phone
alias: "Reminder: the entertainment center has been idling for hours"
id: standby_power_reminder
description: "Notifies you if the entertainment center draws standby power for 3 hours straight."
mode: single
triggers:
- trigger: numeric_state
entity_id: sensor.entertainment_center_power
above: 3
for:
hours: 3
actions:
- action: notify.mobile_app_your_phone
data:
message: "The entertainment center has been drawing standby power for 3 hours. Still need it on?"
Source: Numeric state trigger above:+for: — https://www.home-assistant.io/triggers/numeric_state/
Source: notify.mobile_app_<device_id> — https://companion.home-assistant.io/docs/notifications/notifications-basic/
Notifications & Voice layer
5 automations
17. Garage door left open: notification with a Close button
What it does: If the garage door has been open for 15 minutes, sends a phone notification with a 'Close Garage' button right on it — tapping the button closes the door without opening the app.
Placeholders to replace: binary_sensor.garage_door, notify.mobile_app_your_phone, cover.garage_door
alias: "Garage door left open: notification with a Close button"
id: actionable_garage_door_notification
description: "Sends an actionable notification with a Close button if the garage stays open."
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.garage_door
to: "on"
for:
minutes: 15
id: garage_open_too_long
actions:
- action: notify.mobile_app_your_phone
data:
message: "The garage door has been open for 15 minutes."
data:
actions:
- action: "CLOSE_GARAGE"
title: "Close Garage"
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: "CLOSE_GARAGE"
timeout:
minutes: 10
- if:
- "{{ wait.completed }}"
then:
- action: cover.close_cover
target:
entity_id: cover.garage_door
Source: State trigger to:+for: — https://www.home-assistant.io/triggers/state/
Source: actionable notification data.actions + mobile_app_notification_action event — https://companion.home-assistant.io/docs/notifications/actionable-notifications/
Source: cover.open_cover / cover.close_cover consuming example — https://companion.home-assistant.io/docs/notifications/actionable-notifications/
Source: wait_for_trigger, timeout:, wait.completed, if/then — https://www.home-assistant.io/docs/scripts/
18. Evening wind-down announcement
What it does: At 9 PM, speaks a reminder on the living room speaker that lights and doors are about to lock down for the night.
Placeholders to replace: tts.home_speaker, media_player.living_room_speaker
alias: "Evening wind-down announcement"
id: evening_winddown_tts
description: "Speaks a 9 PM reminder that lights and doors lock down for the night soon."
mode: single
triggers:
- trigger: time
at: "21:00:00"
actions:
- action: tts.speak
target:
entity_id: tts.home_speaker
data:
media_player_entity_id: media_player.living_room_speaker
message: "It's 9 PM. Lights and doors lock down for the night in 15 minutes."
Source: Time trigger — https://www.home-assistant.io/triggers/time/
Source: tts.speak with target: + data.media_player_entity_id + data.message — https://www.home-assistant.io/actions/tts.speak/
19. Morning briefing: weather now, and calendar reminders as they start
What it does: At 7 AM, speaks the current outdoor temperature and conditions. Through the rest of the day, also speaks a reminder the moment any event starts on your shared calendar.
Placeholders to replace: sensor.outdoor_temperature, weather.home, calendar.family, tts.home_speaker, media_player.kitchen_speaker
alias: "Morning briefing: weather now, and calendar reminders as they start"
id: morning_briefing_weather_calendar
description: "Speaks the weather at 7 AM, and a reminder whenever a calendar event starts."
mode: queued
triggers:
- trigger: time
at: "07:00:00"
id: morning_time
- trigger: calendar.event_started
target:
entity_id: calendar.family
id: calendar_event
actions:
- choose:
- conditions:
- condition: trigger
id: morning_time
sequence:
- action: tts.speak
target:
entity_id: tts.home_speaker
data:
media_player_entity_id: media_player.kitchen_speaker
message: >
Good morning. It is currently {{ states('sensor.outdoor_temperature') }} degrees,
with {{ states('weather.home') }} conditions.
- conditions:
- condition: trigger
id: calendar_event
sequence:
- action: tts.speak
target:
entity_id: tts.home_speaker
data:
media_player_entity_id: media_player.kitchen_speaker
message: "Reminder: {{ trigger.calendar_event.summary }} is starting now."
Source: Time trigger; calendar.event_started trigger with target: (and the "avoid mode: single for calendar triggers" note, hence mode: queued here) — https://www.home-assistant.io/triggers/time/, https://www.home-assistant.io/triggers/calendar.event_started/
Source: Triggered by condition — https://www.home-assistant.io/docs/scripts/conditions/
Source: choose; tts.speak — https://www.home-assistant.io/docs/scripts/, https://www.home-assistant.io/actions/tts.speak/
Source: states() function; trigger.calendar_event.summary — https://www.home-assistant.io/template-functions/states/, https://www.home-assistant.io/docs/automation/templating/
20. Sunrise wake-up light (simple version) — or import the full blueprint
What it does: A hand-rollable approximation of Home Assistant's popular community 'Wake-up light alarm with sunrise effect' blueprint: gradually raises the bedroom light in 5 steps, 3 minutes apart, starting at your chosen wake time. For the full-featured version (color-temperature shift, alarm-sensor integration, more options) import the official blueprint instead — see the Source link below.
Placeholders to replace: input_datetime.wake_up_time, light.bedroom
alias: "Sunrise wake-up light (simple version)"
id: sunrise_wakeup_light_simple
description: "Gradually raises the bedroom light in 5 steps starting at your chosen wake time."
mode: restart
triggers:
- trigger: time
at: input_datetime.wake_up_time
actions:
- repeat:
count: 5
sequence:
- action: light.turn_on
target:
entity_id: light.bedroom
data:
brightness: "{{ repeat.index * 51 }}"
- delay:
minutes: 3
Source: Time trigger, at: from an input_datetime helper — https://www.home-assistant.io/triggers/time/
Source: repeat (count:, repeat.index), delay, light.turn_on data.brightness — https://www.home-assistant.io/docs/scripts/
Source: Wake-up light alarm with sunrise effect — official forum page: https://community.home-assistant.io/t/wake-up-light-alarm-with-sunrise-effect/255193 — official one-click import URL: https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fgist.github.com%2Fsbyx%2F96c43b13b90ae1c35b872313ba1d2d2d
21. Voice command: 'good night' turns off the lights
What it does: Say 'good night' (or 'goodnight everyone') to your Assist voice assistant, and every light in the house turns off with one phrase — no app required.
Placeholders to replace: notify.mobile_app_your_phone
alias: "Voice command: 'good night' turns off the lights"
id: voice_goodnight_command
description: "Saying 'good night' to Assist turns off every light in the house."
mode: single
triggers:
- trigger: conversation
command:
- "good night"
- "goodnight everyone"
actions:
- action: light.turn_off
target:
entity_id: all
- action: notify.mobile_app_your_phone
data:
message: "Good night command received — all lights are off."
Source: Conversation trigger (sentence triggers) — https://www.home-assistant.io/integrations/conversation/
Source: light.turn_off target: entity_id: all — https://www.home-assistant.io/docs/automation/yaml/
Source: notify.mobile_app_<device_id> — https://companion.home-assistant.io/docs/notifications/notifications-basic/
Reliability layer
4 automations
22. Notice when Home Assistant finishes starting up
What it does: Posts an in-app notification every time Home Assistant finishes starting, so you have a visible record if it restarted unexpectedly (for example, after a power blip).
Placeholders to replace: None beyond entities already used above — this automation needs no new devices.
alias: "Notice when Home Assistant finishes starting up"
id: ha_restart_notice
description: "Posts an in-app notice every time Home Assistant finishes starting up."
mode: single
triggers:
- trigger: homeassistant
event: start
actions:
- action: persistent_notification.create
data:
title: "Home Assistant restarted"
message: "Home Assistant finished starting up just now. If you didn't restart it yourself, check for a power interruption."
Source: Home Assistant trigger (event: start) — https://www.home-assistant.io/triggers/homeassistant/
Source: persistent_notification.create — https://www.home-assistant.io/actions/persistent_notification.create/
23. Remind me when the door lock battery stays low
What it does: If the front door lock's battery has read below 20% for a full 30 minutes (not just one shaky reading), posts an in-app notification so you remember to replace it.
Placeholders to replace: sensor.front_door_lock_battery
alias: "Remind me when the door lock battery stays low"
id: low_battery_report
description: "Posts an in-app notice if the front door lock battery stays below 20% for 30 minutes."
mode: single
triggers:
- trigger: numeric_state
entity_id: sensor.front_door_lock_battery
below: 20
for:
minutes: 30
actions:
- action: persistent_notification.create
data:
title: "Low battery"
message: "The front door lock battery has been below 20% for 30 minutes."
Source: Numeric state trigger below:+for: (verbatim "Remind me when the door lock battery stays low") — https://www.home-assistant.io/triggers/numeric_state/
Source: persistent_notification.create — https://www.home-assistant.io/actions/persistent_notification.create/
24. Goodnight routine: notice if a door is still open
What it does: Runs a goodnight check at 10:30 PM. If the back door is still open, posts an in-app failure notice explaining exactly what wasn't ready, and marks the run as failed so it stands out in Logbook and traces.
Placeholders to replace: binary_sensor.back_door
alias: "Goodnight routine: notice if a door is still open"
id: goodnight_routine_failure_notice
description: "At 10:30 PM, posts a failure notice if the back door is still open."
mode: single
triggers:
- trigger: time
at: "22:30:00"
actions:
- if:
- condition: state
entity_id: binary_sensor.back_door
state: "on"
then:
- action: persistent_notification.create
data:
title: "Goodnight routine did not complete"
message: "The back door is still open, so the goodnight routine stopped early. Close it and run the routine again."
- stop: "Back door still open"
error: true
else:
- action: persistent_notification.create
data:
title: "Goodnight routine complete"
message: "All checked doors were closed. Goodnight!"
Source: Time trigger — https://www.home-assistant.io/triggers/time/
Source: State condition — https://www.home-assistant.io/docs/scripts/conditions/
Source: if/then/else; stop with error: true; persistent_notification.create — https://www.home-assistant.io/docs/scripts/, https://www.home-assistant.io/actions/persistent_notification.create/
25. Notify me when the power sensor stops updating
What it does: If the whole-home power sensor's value hasn't changed at all for 30 minutes, posts an in-app notice — a stuck sensor can otherwise sit silently broken for days.
Placeholders to replace: sensor.home_power
alias: "Notify me when the power sensor stops updating"
id: sensor_stopped_updating_alert
description: "Posts an in-app notice if the whole-home power sensor hasn't updated in 30 minutes."
mode: single
triggers:
- trigger: state
entity_id: sensor.home_power
to: null
for:
minutes: 30
actions:
- action: persistent_notification.create
data:
title: "Sensor may be stuck"
message: "The power sensor value has not changed for 30 minutes."
Source: State trigger to: null + for: (verbatim "Notify me when power stops updating") — https://www.home-assistant.io/triggers/state/
Source: persistent_notification.create — https://www.home-assistant.io/actions/persistent_notification.create/
Already Read the Book?
If you have read Home Assistant Smart Home for Beginners, you are welcome to share your honest opinion on Amazon. Reviews - positive, mixed, or critical - help other readers decide whether the book is a good fit. There is no obligation.
Share an honest Amazon reviewAs an Amazon Associate I earn from qualifying purchases. Certain content that appears on this site comes from Amazon. This content is provided "as is" and is subject to change or removal at any time.