# automation: # - alias: turn_off_everything # mode: single # trigger: # - platform: time # at: "02:00:00" # action: # # 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_turn_off: "{{ 'OFF_' ~ context.id }}" # action_turn_off_later: "{{ 'LATER_' ~ context.id }}" # - alias: "Ask to turn off everything" # service: notify.mobile_app_sm_g998b # data: # message: "Do you want to turn off the lights" # data: # actions: # - action: "{{ action_turn_off }}" # title: Turn off # - action: "{{ action_turn_off_later }}" # title: Turn off later # - 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_turn_off }}" # - platform: event # event_type: mobile_app_notification_action # event_data: # action: "{{ action_turn_off_later }}" # - alias: "Perform the action" # choose: # - conditions: "{{ wait.trigger.event.data.action == action_turn_off }}" # sequence: # - service: homeassistant.turn_off # target: # entity_id: light.living_room_lights # #- service: homeassistant.turn_off # # target: # # entity_id: light.all_lights # - conditions: "{{ wait.trigger.event.data.action == action_turn_off_later }}" # sequence: # - service: cover.close_cover # target: # entity_id: cover.some_cover # - alias: turn_off_everything # trigger: # - platform: time # at: "15:00:00" # action: # - service: notify.mobile_app_sm_g998b # data: # message: "Something happened at home!" # data: # actions: # - action: "REPLY" # title: "Sound Alarm" # - action: "URI" # title: "Open Url" # uri: "https://google.com"