alias: Notification Action Script sequence: # inside a automation actions or script sequence - alias: "Set up variables for the actions" variables: # Including an id in the action allows us to identify this script run # and not accidentally trigger for other notification actions action_open: "{{ 'OPEN_' ~ context.id }}" action_close: "{{ 'CLOSE_' ~ context.id }}" - alias: "Ask to close or open the garage" choose: - conditions: - condition: state entity_id: cover.garage_door state: "closed" sequence: action: notify.mobile_app_pixel_10_pro data: message: "The garage is closed. Do you want to adjust this?" data: actions: - action: "{{ action_open }}" title: Open - action: "{{ action_close }}" title: Close - conditions: - condition: state entity_id: cover.garage_door state: "open" sequence: action: notify.mobile_app_pixel_10_pro data: message: "The garage is open. Do you want to adjust this?" data: actions: - action: "{{ action_open }}" title: Open - action: "{{ action_close }}" title: Close - 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_open }}" - platform: event event_type: mobile_app_notification_action event_data: action: "{{ action_close }}" - alias: "Perform the action" choose: - conditions: "{{ wait.trigger.event.data.action == action_open }}" sequence: - action: cover.open_cover target: entity_id: cover.garage_door - conditions: "{{ wait.trigger.event.data.action == action_close }}" sequence: - action: cover.close_cover target: entity_id: cover.garage_door