I’m having a hard time triggering automations from the actionable notifications events. At first I couldn’t get them to fire at all, based on the documentation. Through trial & error I got it working but just discovered that it’s still partially broken. Here’s what’s going on:
I have an actionable notification that has ‘YES’ or ‘NO’ response options. When the actionable button ‘YES’ is pressed I get an event to show up on the bus like this:
{
"event_type": "ios.notification_action_fired",
"data": {
"sourceDevicePermanentID": "removed",
"sourceDeviceID": "iphonex",
"actionName": "YES",
"sourceDeviceName": "iPhoneX"
},
"origin": "REMOTE",
"time_fired": "2019-02-22T00:19:11.370258+00:00",
"context": {
"id": "removed",
"user_id": "removed"
}
}
I set up two automations to trigger, one if ‘YES’ the other if ‘NO’
- alias: Clicked Yes
initial_state: True
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
data:
actionName: YES
action:
- service: notify.ios_iphonex
data:
message: "Great"
title: "Follow up"
- service: input_boolean.turn_off
data:
entity_id: input_boolean.actionable_test
- alias: Clicked No
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
data:
actionName: NO
action:
- service: notify.ios_iphonex
data:
message: "Darn"
title: "Follow up"
- service: input_boolean.turn_off
data:
entity_id: input_boolean.actionable_test
The problem I’m having is that both automations are being triggered when either button is pressed. The automation is not recognizing/respecting the ‘event_data’ portion which indicates ‘YES’ or ‘NO’.
Previously, the documentation called for this format:
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: NO
but I could never get it to fire any automations, I stumbled onto adding the ‘data’ field which allowed the automations to fire but caused them to fire without respect to the ‘actionName’ field. Does anyone have a solution to this problem? Thank you!