Hi All,
I do a automation to send a notification on my iPhone to ask to turn on my coffee machine.
It was working on HA 2021.6 but since I upgrade to 2021.7 don’t get back the answer of the actionable notification.
Here is the code
Thanks all for your replays and suggestions.
I had modified my automation and now it works.
As said here, the trick, was to don’t declare a static entity but declare a variable.
Here is my new automation
alias: Coffee Machine Notification to iPhone (v3)
description: ''
trigger:
- platform: time
at: '12:10:00'
- platform: time
at: '15:20:00'
- platform: time
at: '18:30:00'
condition:
- condition: zone
entity_id: person.me
zone: zone.home
- condition: device
type: is_off
device_id: 5989f3d038c76ee1054569eb4cabaxxx
entity_id: switch.smart_plug_2
domain: switch
action:
- alias: Set up variables for the actions
variables:
action_oui: '{{ ''OUI_'' ~ context.id }}'
action_non: '{{ ''NON_'' ~ context.id }}'
- alias: Ask to turn on coffee machine
service: notify.mobile_app_me_iphone
data:
message: Turn on Coffee machine ?
data:
actions:
- action: '{{ action_oui }}'
title: 'Yes'
- action: '{{ action_non }}'
title: 'No'
- alias: Wait for a response
wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_oui }}'
- platform: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_non }}'
continue_on_timeout: false
timeout: '00:00:30'
- alias: Perform the action
choose:
- conditions:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_oui }}'
sequence:
- type: turn_on
device_id: 5989f3d038c76ee1054569eb4cabaxxx
entity_id: switch.smart_plug_2
domain: switch
mode: single