Repository navigation
Security and Doors
Doors left open, locks left unlocked, an alarm nobody set, movement in an empty house. Recipes run from simple to advanced; ● marks are explained on the Home page. Entity IDs are examples: change them to yours.
- Garage door left open ●
- Front door unlocked ●
- Public locks unlocked at night ●●
- Alarm not armed while away ●●
- Window open while the heating is on ●●
- Motion while away ●●
- Door open, then left open ●●●
● Basic · State · delay before firing, a notification button
The problem. The garage door gets left open: after unloading the car, after taking the bins out. A minute open is normal; ten minutes probably isn't.
Why this kind. One entity, one state: a State alert. The delay before firing is what makes it left open rather than open; if the door closes within ten minutes, nothing happens at all. A notification button lets you close it from wherever you are.
In the UI (Add alert → State):
| Field | Value |
|---|---|
| Name | Garage Door Left Open |
| Priority | Warning |
| Icon | mdi:garage-open |
| Entity | cover.garage_door |
| State | open |
| Delay before firing | 10 minutes |
| Notifications → On message | The garage door has been open for 10 minutes. |
| Notifications → Done message | The garage door is closed. |
| Notifications → Notification buttons |
Close door: cover.close_cover on cover.garage_door
|
To import:
format: alert_redux
version: 1
alerts:
- name: Garage Door Left Open
kind: state
priority: warning
icon: mdi:garage-open
entity_id: cover.garage_door
target_state: open
delay_on: "00:10:00"
message: The garage door has been open for 10 minutes.
done_message: The garage door is closed.
buttons:
- label: Close door
action:
- action: cover.close_cover
target:
entity_id: cover.garage_doorWhat you'll see. After ten minutes, a phone notification with Close door, Acknowledge, and Snooze Alert, and the alert on the card with the same buttons. Unacknowledged, it reminds you on the default schedule (10, 30, 60 minutes, then hourly). Tapping Close door runs the action as you; the alert ends when the door is closed, and its done message replaces the notification.
Variations.
- A garage door that's a
binary_sensor(a tilt sensor, say) isonwhen open: use Stateon. - To hear the moment it opens and when it's been left, see Door open, then left open.
- Every door in the house, with one definition: Generators.
● Basic · State · a lock, a message about its subject
The problem. The front door was unlocked to let someone in, and nobody locked it again.
Why this kind. Again one entity in one state. Locks report locked,
unlocked, jammed, and a few others; the alert fires on unlocked. (A separate
alert on jammed is worth having too.) The message uses subject_entity_name, the
name of the lock, so the same wording works if you copy the alert for the back
door.
In the UI (Add alert → State):
| Field | Value |
|---|---|
| Name | Front Door Unlocked |
| Priority | Notice |
| Icon | mdi:lock-open-variant |
| Entity | lock.front_door |
| State | unlocked |
| Delay before firing | 15 minutes |
| Notifications → On message | {{ subject_entity_name }} has been unlocked for 15 minutes. |
| Notifications → Notification buttons |
Lock it: lock.lock on lock.front_door, Only from an unlocked phone on |
To import:
format: alert_redux
version: 1
alerts:
- name: Front Door Unlocked
kind: state
priority: notice
icon: mdi:lock-open-variant
entity_id: lock.front_door
target_state: unlocked
delay_on: "00:15:00"
message: "{{ subject_entity_name }} has been unlocked for 15 minutes."
buttons:
- label: Lock it
require_unlock: true
action:
- action: lock.lock
target:
entity_id: lock.front_doorWhat you'll see. A Notice-priority alert: it shows on the card in Notice's colour, and through a loud group it would wait for the end of quiet hours (Notice is below the default threshold). Only from an unlocked phone means iOS asks for Face ID or the passcode before the button runs; on the card, it asks you to confirm.
Variations.
- Locking is harmless, but for a button that unlocks or opens something, always turn on Only from an unlocked phone.
- Many locks: a generator over the
lockdomain makes one each (Generators).
●● Intermediate · State · an extra condition, a protected button
From a real home: this is one of the author's own alerts.
The problem. During the day, the doors the public uses (the front door, the side gate) are often unlocked. At night they should be locked, and if they aren't, someone should know.
Why this kind. A State alert on the locks, with an extra condition that
limits it to night-time. The condition is a template that must also be true; when
it becomes false (morning comes), the alert ends by itself. Here the "locks" are a
lock group, lock.public_door_locks, which is unlocked while any of them is.
In the UI (Add alert → State):
| Field | Value |
|---|---|
| Name | Public Locks Unlocked At Night |
| Priority | Warning |
| Icon | mdi:door-closed-lock |
| Entity | lock.public_door_locks |
| State | unlocked |
| Extra condition | {{ is_state('schedule.night', 'on') }} |
| Notifications → On message | The public door locks are unlocked at night. |
| Notifications → Reminder message | The public door locks have been unlocked at night for {{ duration }}. |
| Notifications → Done message | The public door locks are now secure. |
| Notifications → Notification buttons |
Lock Doors: lock.lock on lock.public_door_locks, Only from an unlocked phone on |
To import:
format: alert_redux
version: 1
alerts:
- name: Public Locks Unlocked At Night
kind: state
priority: warning
icon: mdi:door-closed-lock
entity_id: lock.public_door_locks
target_state: unlocked
condition: "{{ is_state('schedule.night', 'on') }}"
message: The public door locks are unlocked at night.
reminder_message: The public door locks have been unlocked at night for {{ duration }}.
done_message: The public door locks are now secure.
buttons:
- label: Lock Doors
require_unlock: true
action:
- action: lock.lock
target:
entity_id: lock.public_door_locksWhat you'll see. Nothing during the day. When the schedule.night helper turns
on with a door unlocked, or a door is unlocked during the night, the alert fires,
with Lock Doors on the notification and the card. The reminder message uses
{{ duration }}, how long it's been firing ("1 hour 5 minutes").
Variations.
-
{{ is_state('sun.sun', 'below_horizon') }}instead of a schedule, for "after dark". - The author's own version watches a template binary sensor that combines the locks
and the time of night, and fires on
on: useful when the same rule drives other things too.
●● Intermediate · Template · a message that explains, a subject entity
From a real home: this is one of the author's own alerts.
The problem. Everyone has left, and the alarm should have armed itself (or been armed), but it hasn't. Often because a door is open or unlocked, which blocks arming.
Why this kind. Two entities are involved (nobody home, and the alarm's state), so this is a Template alert. The delay before firing gives the household a few minutes to finish leaving and the alarm its exit delay. The subject entity is the alarm panel, so the alert is about that rather than about a template. The message does the useful part: it says why, listing the doors that are open or unlocked, so you can fix it from the notification.
zone.home's state is the number of people at home. binary_sensor.outside_doors
and lock.outside_door_locks are groups of the outside doors and their locks.
In the UI (Add alert → Template):
| Field | Value |
|---|---|
| Name | Alarm Not Armed While Away |
| Priority | Critical |
| Icon | mdi:shield-alert |
| Template | {{ states('zone.home') | int(0) == 0 and states('alarm_control_panel.house') not in ['armed_away', 'arming', 'pending', 'triggered'] }} |
| Delay before firing | 6 minutes |
| Subject entity | alarm_control_panel.house |
| Notifications → On message | see the import file: a list of what's open or unlocked |
| Notifications → Reminder message | The house has been empty with the alarm NOT armed for {{ duration }}. |
| Notifications → Done message | The alarm is now {{ states('alarm_control_panel.house') }}. |
To import:
format: alert_redux
version: 1
alerts:
- name: Alarm Not Armed While Away
kind: template
priority: critical
icon: mdi:shield-alert
template: >-
{{ states('zone.home') | int(0) == 0
and states('alarm_control_panel.house')
not in ['armed_away', 'arming', 'pending', 'triggered'] }}
delay_on: "00:06:00"
subject_entity: alarm_control_panel.house
message: >-
Everyone has left but the house alarm is NOT armed.
{%- set open = expand('binary_sensor.outside_doors')
| selectattr('state', 'eq', 'on') | map(attribute='name') | list %}
{%- set unlocked = expand('lock.outside_door_locks')
| rejectattr('state', 'eq', 'locked') | map(attribute='name') | list %}
{%- for door in open %}
✦ {{ door }} is open
{%- endfor %}
{%- for lock in unlocked %}
✦ {{ lock }} is not locked
{%- endfor %}
reminder_message: The house has been empty with the alarm NOT armed for {{ duration }}.
done_message: The alarm is now {{ states('alarm_control_panel.house') }}.What you'll see. Six minutes after the last person leaves with the alarm disarmed, a Critical notification: "Everyone has left but the house alarm is NOT armed. ✦ Back Door is open". On an iPhone, Critical alerts are sent as time-sensitive, so they come through a Focus. The card shows the same message, and re-renders it as doors close: the list stays current while you watch.

Variations.
- Add an Arm button (
alarm_control_panel.alarm_arm_away), with Only from an unlocked phone on, if your panel can arm without a code. - Give it a different Card message (
display_message) from the notification: just the list, without the opening sentence. - If you're the kind of household that forgets often, add the Speakers group so the house says it as well, once someone is home again.
●● Intermediate · Template · delays on both sides
The problem. A window has been left open with the heating on: money out of the window, quite literally.
Why this kind. Two conditions (any window open, the heating in heat mode), so a
Template. A delay before firing of five minutes lets you air a room. A
delay before ending of two minutes means closing one window and opening another
doesn't end the alert and start a new one. binary_sensor.windows is a group of the
window sensors, on while any is open.
In the UI (Add alert → Template):
| Field | Value |
|---|---|
| Name | Window Open With Heating On |
| Priority | Notice |
| Icon | mdi:window-open-variant |
| Template | {{ is_state('binary_sensor.windows', 'on') and is_state('climate.house', 'heat') }} |
| Delay before firing | 5 minutes |
| Delay before ending | 2 minutes |
| Notifications → On message | see the import file: names the open windows |
| Notifications → Reminder schedule |
30 (Use the default reminder schedule off) |
To import:
format: alert_redux
version: 1
alerts:
- name: Window Open With Heating On
kind: template
priority: notice
icon: mdi:window-open-variant
template: "{{ is_state('binary_sensor.windows', 'on') and is_state('climate.house', 'heat') }}"
delay_on: "00:05:00"
delay_off: "00:02:00"
message: >-
The heating is on with
{{ expand('binary_sensor.windows') | selectattr('state', 'eq', 'on')
| map(attribute='name') | join(', ') }} open.
reminder_schedule: [30]What you'll see. A Notice alert naming the open windows, then a reminder every
30 minutes rather than the default schedule (reminder_schedule: [30]: the last
interval repeats).
Variations.
- Turn the heating down instead of nagging: a button
climate.set_hvac_modetooff. - If the template's entities are unavailable (the thermostat is offline), the alert shows no data rather than staying quiet: see Zigbee bridge down for watching the thing that went offline.
●● Intermediate · Trigger · a condition that sees the trigger, a duration
The problem. There's movement in the house, and nobody's home.
Why this kind. Motion is a moment, not a condition that lasts: by the time you
read about it, the sensor has gone quiet again. A Trigger alert fires on the
trigger and stays up for a duration (here 15 minutes), so you see it. Its
condition is checked when it triggers, and can use trigger ("which sensor?").
If the condition can't be judged, the alert fires anyway: a broken template never
silences a security alert. Further motion while it's firing restarts the 15
minutes, and the alert counts each one.
In the UI (Add alert → Trigger):
| Field | Value |
|---|---|
| Name | Motion While Away |
| Priority | Critical |
| Icon | mdi:motion-sensor |
| Triggers | a State trigger on binary_sensor.hall_motion and binary_sensor.kitchen_motion, to on
|
| Condition | {{ states('zone.home') | int(0) == 0 }} |
| Duration | 15 minutes |
| Notifications → On message | Motion in the {{ trigger.to_state.attributes.friendly_name }} while nobody is home. |
| Notifications → Notifier groups | Phone and Persistent (Use the default notifier groups off) |
To import:
format: alert_redux
version: 1
alerts:
- name: Motion While Away
kind: trigger
priority: critical
icon: mdi:motion-sensor
triggers:
- trigger: state
entity_id:
- binary_sensor.hall_motion
- binary_sensor.kitchen_motion
to: "on"
condition: "{{ states('zone.home') | int(0) == 0 }}"
duration: "00:15:00"
message: Motion in the {{ trigger.to_state.attributes.friendly_name }} while nobody is home.
notifier_groups: [Phone, Persistent]What you'll see. A Critical alert naming the sensor; on the card, a bar along the bottom that drains over the 15 minutes. More motion restarts the bar and sends the on message again, with the new count, unless you've acknowledged it. After 15 quiet minutes, it ends.
Variations.
- To keep it firing until someone does something, rather than for a fixed time, use an On/off alert: on triggers as above, off when the alarm is disarmed or someone arrives home. It's like the dishwasher recipe.
- To alert on a door opening while away, add the door sensors to the same trigger.
- Keep until acknowledged, so a burst of motion at 2 p.m. is still there at 6 p.m. if nobody looked.
●●● Advanced · two State alerts · supersession, propagation
From a real home: these are two of the author's own alerts, on the workshop's roller door.
The problem. For the workshop door, you want two things: to hear at once that it opened (it's at the back, and you'd like to know), and, if it's still open ten minutes later, to hear that it's been left open, which is more urgent. But not both at the same time, and not reminders about it being open while you're already being told it's been left open.
Why this kind. Two State alerts on the same door: Workshop Door Open (no delay, Notice) and Workshop Door Left Open (10 minutes, Warning). The second supersedes the first: while Left Open is firing, Open sends no reminders, and folds under it on the card. And the relationship propagates: acknowledging Open ("yes, I'm working in there") snoozes Left Open for four hours in advance, so it doesn't nag you while you're working, but does speak up if the door is still open after four hours.
A delay before ending of 5 seconds on each absorbs the door sensor's bounce as it closes.
In the UI (Add alert → State, twice):
Workshop Door Open
| Field | Value |
|---|---|
| Name | Workshop Door Open |
| Priority | Notice |
| Icon | mdi:garage-open |
| Entity / State |
cover.workshop_door / open
|
| Delay before ending | 5 seconds |
| Notifications → On message | The workshop door is open. |
| Notifications → Reminder message | The workshop door has been open for {{ duration }}. |
| Notifications → Done message | The workshop door is closed. |
| Notifications → Notification buttons |
Close Door: cover.close_cover on cover.workshop_door
|
Workshop Door Left Open
| Field | Value |
|---|---|
| Name | Workshop Door Left Open |
| Priority | Warning |
| Entity / State |
cover.workshop_door / open
|
| Delay before firing | 10 minutes |
| Delay before ending | 5 seconds |
| Notifications → On message | The workshop door has been left open. |
| Notifications → Done message | The workshop door has been closed, after being left open for {{ duration }}. |
| Notifications → Notification buttons |
Close Door, as above |
| Supersession → Supersedes | Alert Workshop Door Open, When it's acknowledged Snooze this alert, Snooze for 4 hours |
To import (both together):
format: alert_redux
version: 1
alerts:
- name: Workshop Door Open
kind: state
priority: notice
icon: mdi:garage-open
entity_id: cover.workshop_door
target_state: open
delay_off: "00:00:05"
message: The workshop door is open.
reminder_message: The workshop door has been open for {{ duration }}.
done_message: The workshop door is closed.
buttons:
- label: Close Door
action:
- action: cover.close_cover
target:
entity_id: cover.workshop_door
- name: Workshop Door Left Open
kind: state
priority: warning
icon: mdi:garage-open
entity_id: cover.workshop_door
target_state: open
delay_on: "00:10:00"
delay_off: "00:00:05"
message: The workshop door has been left open.
done_message: The workshop door has been closed, after being left open for {{ duration }}.
buttons:
- label: Close Door
action:
- action: cover.close_cover
target:
entity_id: cover.workshop_door
supersedes:
- alert: alert_redux.workshop_door_open
propagation: snooze
snooze_duration: "04:00:00"What you'll see.
| Time | What happens |
|---|---|
| 0:00 | The door opens. Open fires: "The workshop door is open." |
| 0:10 | Nobody acknowledged it. Left Open fires: "The workshop door has been left open." Open is superseded: no more reminders from it, and on the card it folds under Left Open. |
| 0:20 | A reminder from Left Open only. |
| 0:25 | The door closes. Both end together; you get one done message, Left Open's ("…after being left open for 15 minutes": duration counts from when Left Open fired). |
Or, if you acknowledge Open at 0:02: Left Open is pre-snoozed (its
pre_snoozed_until attribute says until when). At 0:10 it fires already snoozed,
silently, and stays quiet until 4:02. If the door is still open then, it reminds you.

Variations.
- Propagation Acknowledge this alert instead of snooze: acknowledging Open covers Left Open for as long as the door stays open.
- Different priorities and groups make the pair more useful still: Open to the Phone only, Left Open to the Speakers as well.
- For every door at once, a pair of generators, the second superseding the first: Generators.
- Longer chains, and more about how supersession works: Escalation and Supersession.
Start here
Recipes
- Security and Doors
- Leaks and Climate
- Appliances and Chores
- Devices and Infrastructure
- Reminders and Household Events
Patterns
- Escalation and Supersession
- Keeping Alerts Until Acknowledged
- Generators: One Alert per Device
- Designing Your Notifications
- Taking Alerts Out of Service
- Voice Control
- Building on Alert Redux
- Reacting to Alerts
Moving and maintaining