# ============================================================================== # Front Door Open Alert — Home Assistant automation pair # ------------------------------------------------------------------------------ # Two related automations: # # 1. "Front Door Left Open Alert" # Fires when the front door has been open for 30 seconds. Sends a phone # push + plays a TTS announcement on the Nest display. Loops every # ~10 minutes while the door stays open. # # 2. "Front Door Closed Announcement" # Plays a 'door closed' TTS when the door is finally shut, but only if # the door had been open more than 30 seconds (skips quick in-and-out # trips so the house doesn't talk every time you grab the mail). # # Retarget by swapping three entity_ids: # binary_sensor.front_door_door -> your door/window/contact sensor # notify.mobile_app_magikh0e_phone -> your phone's notify target # media_player.nest_display -> your speaker / display # # Place under config/automations.yaml (or include via packages: as you prefer) # ============================================================================== # Automation 1: Alert when door is left open - alias: "Front Door Left Open Alert" description: "Notifies + announces when front door has been open for 30s, repeating every ~10 min" trigger: - platform: state entity_id: binary_sensor.front_door_door to: "on" for: "00:00:30" action: # Loop while the door remains open - repeat: while: - condition: state entity_id: binary_sensor.front_door_door state: "on" sequence: # 1. Push notification to phone - action: notify.mobile_app_magikh0e_phone data: title: "Front Door" message: "The front door has been left open" # 2. TTS announcement on the Nest display - action: media_player.play_media target: entity_id: media_player.nest_display data: media_content_id: >- media-source://tts/tts.piper?message=The+front+door+has+been+left+open&language=en_US media_content_type: audio/mp3 # 3. Wait before the next reminder (only fires if door is still open) - delay: "00:10:45" # Automation 2: Announce when the door is closed (only if it had been open a while) - alias: "Front Door Closed Announcement" description: "Plays a 'door closed' TTS when the front door is closed after being open more than 30s" trigger: - platform: state entity_id: binary_sensor.front_door_door from: "on" to: "off" condition: # Only fire if the door had been open at least 30 seconds — skips quick in/out - condition: template value_template: >- {{ (now() - trigger.from_state.last_changed).total_seconds() > 30 }} action: - action: media_player.play_media target: entity_id: media_player.nest_display data: media_content_id: >- media-source://tts/tts.piper?message=The+front+door+has+been+closed&language=en_US media_content_type: audio/mp3