Hello all,
I have this simple code to choose to turn my light on or off:
iphone_test1:
sequence:
- alias: "Set up action variables"
variables:
action_on: "{{ 'ON_test1' }}"
action_off: "{{ 'OFF_test1' }}"
- alias: "Send the notification"
service: notify.mobile_app_myiphone
data:
message: "Light ON or OFF??"
data:
actions:
- action: "{{ action_on }}"
title: "Light ON"
- action: "{{ action_off }}"
title: "Light OFF"
- alias: "Wait for a response"
wait_for_trigger:
# We wait for specific actions because we don't want to run for
# any action, only for a response to the one we just sent
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_on }}"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_off }}"
- alias: "Handle the response"
choose:
- conditions: "{{ wait.trigger.event.data.action == action_on }}"
sequence:
- service: light.turn_on
entity_id: light.mylight
- conditions: "{{ wait.trigger.event.data.action == action_off }}"
sequence:
- service: light.turn_off
entity_id: light.mylight
The problem is that only the first message with the question appears on the iphone,
message: "Light ON or OFF??"
while the answers to be selected do not appear and the script waits for an answer. I don’t understand what the mistake could be. Can you help me?
Thanks in advance.