feat: Update garage door close script to cancel on disarm

This commit is contained in:
2024-09-21 17:48:12 -07:00
parent 08816f2b9b
commit 22e4607716

View File

@@ -626,7 +626,8 @@ automation:
title: "Doorbell"
message: "Home Doorbell Rang but could not create event: {{ event_data['content']['message'] }}"
- alias: Notify that Garage Door is Open
- alias: Notify that Garage Door is Open when Alarm Arms
description: Send a Garage Door Open Notice to Phones
trigger:
- platform: state
entity_id: alarm_control_panel.ha_alarm
@@ -649,7 +650,7 @@ automation:
action_close: "{{ 'CLOSE_' ~ context.id }}"
- alias: Send notice to devices
action: notify.iphone_jp
action: notify.security
data:
message: "Garage door is open! It will close in 10 minutes if not ignored."
data:
@@ -671,37 +672,47 @@ automation:
event_type: mobile_app_notification_action
event_data:
action: "{{ action_close }}"
- platform: state
entity_id: alarm_control_panel.ha_alarm
to: disarmed
timeout:
seconds: "30"
minutes: "10"
- alias: Process callback
choose:
- conditions: "{{ wait.trigger.event.data.action == action_ignore }}"
- conditions: "{{ wait.remaining > 0 and wait.trigger.event.data.action == action_ignore }}"
sequence:
- alias: Notify that the event was ignored
action: notify.iphone_jp
action: notify.security
data:
message: >
{%
set person = states.person
|selectattr('attributes.user_id', 'eq', wait.context.user_id)
|selectattr('attributes.user_id', 'eq', wait.trigger.event.context.user_id)
|first|default({'attributes':{'friendly_name':'Automation'}})
%}Open garage door ignored by {{ person.attributes.friendly_name }}
- conditions: "{{ wait.trigger.event.data.action == action_close }}"
- conditions: "{{ wait.remaining > 0 and wait.trigger.event.data.action == action_close }}"
sequence:
- alias: Close garage door
action: switch.turn_on
target:
entity_id: switch.garage_door_relay_1
- conditions: "{{ wait.remaining > 0 and wait.trigger.entity_id == 'alarm_control_panel.ha_alarm' }}"
sequence:
- alias: Notify the event was cancelled
action: notify.security
data:
message: "Garage door timeout cancelled because alarm was disarmed"
- conditions: "{{ not wait.completed }}"
sequence:
- alias: Notify the event timed out
action: notify.iphone_jp
data:
message: "Garage door closing automatically"
- alias: Close garage door
action: switch.turn_on
target:
entity_id: switch.garage_door_relay_1
- alias: Notify the event timed out
action: notify.security
data:
message: "Garage door closing automatically"