I can’t get the action part of an actionable notification to work following (generally) these instructions. The notification works, and I select the action on my phone. In the same automation, I then use a wait for trigger action, which seems to work, but in the final action to actually perform the action, I don’t think the template is rendering properly:
{{ wait.trigger.event.data.action == DISABLE_SOLAR }}
For now, this is just a test automation, I trigger it using a lovelace number slider, and I’m trying to make it turn off an input boolean. Here is the complete code:
alias: Notify - Test actionable notifications
description: ""
trigger:
- platform: numeric_state
entity_id: input_number.test_number
for:
hours: 0
minutes: 0
seconds: 0
above: 6
condition: []
action:
- service: notify.mobile_app_patricks_iphone_13
data:
title: Good Solar
message: >-
Solar power is now: {{
(states('input_number.test_number')|float|round(1)) }} kW
data:
actions:
- action: DISABLE_SOLAR
title: Disable these notifications
- action: URI
title: Go to energy page in HA
uri: /lovelace/solar
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: DISABLE_SOLAR
- choose:
- conditions: "{{ wait.trigger.event.data.action == DISABLE_SOLAR }}"
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.grid_power_alert
data: {}
enabled: false
- if:
- condition: template
value_template: "{{ wait.trigger.event.data.action == DISABLE_SOLAR }}"
then:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.grid_power_alert
mode: restart
Note that I’ve tried a choose
condition, and because I couldn’t get that working, I’ve tried an if
also.