# HearthNodes recipe 26 - door left open escalation
alias: "Safety - exterior door left open escalates"
id: hn_safety_door_left_open
description: "Chime at 90 s, spoken reminder at 5 min, repeated alert at 15 min"
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id:
- binary_sensor.front_door
- binary_sensor.side_door
- binary_sensor.garage_door
to: "on"
for: "00:01:30"
variables:
door: "{{ trigger.entity_id }}"
door_name: "{{ state_attr(trigger.entity_id, 'friendly_name') }}"
outdoor_c: "{{ states('sensor.outdoor_temperature') | float(15) }}"
condition:
- condition: state
entity_id: input_boolean.moving_furniture_mode
state: "off"
- condition: template
value_template: >-
{{ is_state('person.primary','home') or is_state('person.partner','home') }}
- condition: numeric_state
entity_id: sensor.outdoor_temperature
above: -10
action:
- service: media_player.play_media
target:
entity_id: media_player.kitchen_display
data:
media_content_id: "chime_door_hint"
media_content_type: "music"
extra:
volume: 0.3
- delay: "00:03:30"
- service: tts.speak
target:
entity_id: tts.speaker_hall
data:
message: "The {{ door_name }} is still open"
cache: false
- delay: "00:10:00"
- repeat:
while:
- condition: state
entity_id: "{{ door }}"
state: "on"
sequence:
- service: media_player.play_media
target:
entity_id: media_player.kitchen_display
data:
media_content_id: "chime_door_alert"
media_content_type: "music"
- service: notify.mobile_app_primary
data:
title: "{{ door_name }} still open"
message: "Open for more than 15 minutes. Outdoor {{ outdoor_c }} C."
- delay: "00:01:00"
- choose:
- conditions:
- condition: template
value_template: "{{ outdoor_c | float(15) < 5 }}"
sequence:
- service: climate.set_preset_mode
target:
entity_id: climate.hall_thermostat
data:
preset_mode: "door open"
# A contact stuck reporting 'open' forever must never spam the house: stale
# contacts are excluded from the escalation and raised as low priority maintenance
# instead. Announcements are restricted to hall and kitchen speakers, with a
# notification-only path between 21:00 and 07:00.
触发器 · state
binary_sensor.front_door · binary_sensor.side_door · binary_sensor.garage_door
任意外门门磁保持开启 90 秒。
分步说明
- media_player.kitchen_display90 秒时播放一次轻柔提示音,音量小到只是一个暗示,而不是一条宣告。
play chime · volume 0.3 · at 90 s - tts.speaker_hall5 分钟时用语音点名具体是哪扇门;这一级能抓住那些把门开着、人已经在另一个房间的人。
speak 'The front door is still open' at 5 min - media_player.* · notify.mobile_app从 15 分钟起每分钟在所有室内音箱重复一次并推送通知,因为到那时它确实是被忽略了。
repeat alert every 60 s from 15 min - climate.hall_thermostat暂停开启门附近的供暖,避免整个过程中一直在给大街加热。
set_back · 'door open' mode
分级升级,而不是立即报警
门一开就报警,会让家人在一周内把这条自动化禁用掉。15 分钟内的三级递进贴合真实行为:暗示、提醒、真正的告警。可以根据你家的反应调整各段时间,但要保留三级。
每次都点名是哪扇门
「有扇门开着」会让人去查三扇门。「车库门还开着」只需要他去关一扇。这要求每扇门独立成实体,并用语音而不是通用提示音——为寒冷天气里省下的那几秒,多加的硬件是值得的。
加一个「搬东西」模式
没有覆盖开关,第一次有人抬沙发上楼时就会把这条自动化永久禁用。在面板上放一个布尔量、2 小时后自动清除,就能避免这条自动化死于一年中唯一出错的那一天。
硬件
| 型号 | 协议 | 连接 | 在本链路中的作用 |
|---|---|---|---|
| Matter door contacts on every exterior door | matter |
无线 | 每扇外门一个;共用一个门磁无法说明是哪扇门开着,而分级提醒的全部意义正在于此。 |
| Indoor speakers with TTS support | matter |
有线 | 门厅与厨房的音箱就够了;夜间在卧室播报适得其反。 |
| Outdoor temperature sensor | matter |
无线 | 提供「这个门到底应不应该开着」的判断,在严寒天气下缩短前两级的时间。 |
失效时怎么办
如果某个门磁离线,该门从分级提醒中排除,并抛出一条低优先级维护通知——绝不能允许一个永远上报「开启」的卡死门磁在全屋刷屏。如果音箱不可达,分级提醒回退为仅推送手机通知:更安静,但仍会送达。