Finally figure out what it is:
The flow is that
- Set up an actionable notification. The action can be of any name like
STOP_THE_SIREN
. - When you press the button on the notification of the app, a trigger
mobile_app_notification_action
withevent
data
STOP_THE_SIREN
is fired. - You use the trigger in #2 to trigger ANOTHER automation.
- In this automation, do everything you want.
Here’s my result:
Automation 1: Send the notification until turned off
alias: Repeat Notification when Siren Switch Turned On
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.siren_switch
from: null
to: "on"
condition: []
action:
- repeat:
sequence:
- service: notify.notify
data:
message: Button pressed
title: Warning
data:
sound:
name: default
actions:
- action: TURN_OFF_SIREN
title: Turn off
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
until:
- condition: state
entity_id: input_boolean.siren_switch
state: "off"
mode: single
Automation 2: Listen to the app action and then turn off the siren switch
alias: Turn off siren switch using mobile app
description: ""
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: TURN_OFF_SIREN
condition: []
action:
- service: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.siren_switch
mode: single
I think the official document is written in a way that not everyone can understand. Thanks for the YouTube video https://www.youtube.com/watch?v=QZsY5a7R10c . Hope this helps.
Cheers