fix: Fix garage door notification automation
This commit is contained in:
@@ -643,16 +643,18 @@ automation:
|
||||
condition: "{{ is_state('binary_sensor.garage_door', 'on') }}"
|
||||
mode: restart
|
||||
action:
|
||||
- alias: Set up variables for the actionable notification
|
||||
- alias: Set up action variables
|
||||
variables:
|
||||
action_close: "{{ 'CLOSE_' ~ context.id }}"
|
||||
action_ignore: "{{ 'IGNORE_' ~ context.id }}"
|
||||
|
||||
- alias: Ask to close the Garage Door
|
||||
- alias: Send the notification with Close/Ignore actions
|
||||
action: notify.iphone_jp
|
||||
data:
|
||||
title: Garage Door Open
|
||||
message: The garage door is open - close it now?
|
||||
title: Garage Door Left Open
|
||||
message: >
|
||||
The garage door is open - close it now? It will automatically
|
||||
close in 10 minutes.
|
||||
data:
|
||||
actions:
|
||||
- action: "{{ action_close }}"
|
||||
@@ -661,6 +663,8 @@ automation:
|
||||
title: Ignore
|
||||
|
||||
- alias: Wait for a response
|
||||
timeout:
|
||||
minutes: 10
|
||||
wait_for_trigger:
|
||||
- platform: event
|
||||
event_type: mobile_app_notification_action
|
||||
@@ -668,6 +672,10 @@ automation:
|
||||
# waiting for the specific action avoids accidentally continuing
|
||||
# for another script/automation's notification action
|
||||
action: "{{ action_close }}"
|
||||
- platform: event
|
||||
event_type: mobile_app_notification_action
|
||||
event_data:
|
||||
action: "{{ action_ignore }}"
|
||||
|
||||
- alias: Handle the action
|
||||
choose:
|
||||
@@ -676,3 +684,13 @@ automation:
|
||||
- action: switch.turn_on
|
||||
target:
|
||||
entity_id: switch.garage_door_relay_1
|
||||
|
||||
- conditions: "{{ wait.trigger.event.data.action == action_ignore }}"
|
||||
sequence: []
|
||||
# no-op
|
||||
|
||||
- conditions: "{{ not wait.completed }}"
|
||||
sequence:
|
||||
- action: switch.turn_on
|
||||
target:
|
||||
entity_id: switch.garage_door_relay_1
|
||||
|
||||
Reference in New Issue
Block a user