feat: Add Garage Door Open Notification on Alarm Arming

This commit is contained in:
2024-09-08 16:42:48 -07:00
parent 202a4395da
commit f1d03ca398

View File

@@ -625,3 +625,49 @@ automation:
data: data:
title: "Doorbell" title: "Doorbell"
message: "Home Doorbell Rang but could not create event: {{ event_data['content']['message'] }}" message: "Home Doorbell Rang but could not create event: {{ event_data['content']['message'] }}"
- alias: Notify that Garage Door is Open
trigger:
- platform: state
entity_id: alarm_control_panel.ha_alarm
state:
- 'armed_away'
- 'armed_home'
- 'armed_night'
- 'armed_vacation'
condition: "{{ is_state('binary_sensor.garage_door', 'on') }}"
mode: restart
action:
- alias: Set up variables for the actionable notification
variables:
action_close: "{{ 'CLOSE_' ~ context.id }}"
action_ignore: "{{ 'IGNORE_' ~ context.id }}"
- alias: Ask to close the Garage Door
action: notify.iphone_jp
data:
title: Garage Door Open
message: The garage door is open - close it now?
data:
actions:
- action: "{{ action_close }}"
title: Close
- action: "{{ action_ignore }}"
title: Ignore
- alias: Wait for a response
wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
# waiting for the specific action avoids accidentally continuing
# for another script/automation's notification action
action: "{{ action_close }}"
- alias: Handle the action
choose:
- conditions: "{{ wait.trigger.event.data.action == action_close }}"
sequence:
- action: switch.turn_on
target:
entity_id: switch.garage_door_relay_1