Skip to content

Instantly share code, notes, and snippets.

@chadbaldwin
Last active October 11, 2022 07:19
Show Gist options
  • Save chadbaldwin/155260ad44ae438f038f348cb107dc37 to your computer and use it in GitHub Desktop.
Save chadbaldwin/155260ad44ae438f038f348cb107dc37 to your computer and use it in GitHub Desktop.
Home Assistant automation to send a notification every X minutes the garage door was left open without motion
alias: Garage Door Open Notification
description: Send out repeating notifications or announcements that the garage door is left open
mode: restart
trigger:
- platform: state
entity_id:
- group.garage_motion
- binary_sensor.contact_7_contact
condition:
- condition: state
entity_id: binary_sensor.contact_7_contact
state: "on"
action:
- delay:
minutes: 10
- repeat:
while:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.contact_7_contact
state: "on"
- condition: state
entity_id: group.garage_motion
state: "off"
for:
minutes: 5
sequence:
- service: tts.cloud_say
data:
entity_id: media_player.living_room_home
message: Garage door is open
- delay:
minutes: 5
alias: Garage door open notification
description: Send out repeating notifications or announcements that the garage door is left open
mode: single
trigger:
- platform: time_pattern
minutes: /5
condition:
- condition: state
entity_id: binary_sensor.contact_7_contact
state: "on"
for:
minutes: 10
- condition: state
entity_id: group.garage_motion
state: "off"
for:
minutes: 5
action:
- service: tts.cloud_say
data:
entity_id: media_player.living_room_home
message: Garage door is open
@chadbaldwin
Copy link
Author

Two methods listed here.

One method uses a simple datetime trigger....it runs every 5 minutes...if the garage has been left open and there hasn't been any motion it will announce. This is a much simpler design and for something like this, it doesn't need to be perfectly accurate with regard to 5 minute intervals. If you leave the garage open at 5:41 then it won't announce until 5:50, and that's probably going to be fine.

The other method is more complex, uses multiple triggers, loops etc. It's more "accurate" in that the announcement will always be at the 5 minute mark. But why overcomplicate it if you don't have to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment