Help with Actionable Notification event triggers?

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!

Never mind, I just solved this: ‘event_data’ needs to be formatted like so:

trigger:
    - platform: event
      event_type: 'ios.notification_action_fired'
      event_data: {'actionName': 'YES'}

I put in a pull request for the documentation to be fixed.

This works for me:

  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: DEACTIVATEAUTOARM

So I suspect your problem has something to do with the word “Yes”. It probably evaluates to True/On/1.

Likewise with “NO”, being False/Off/0.

If you put your action name in quotes it will probably work:

  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      data:
        actionName: 'YES'

Yep, it looks like you are correct. Thanks for the reply!