(SOLVED) Actionable notification trigger not react

Hi All,

I have some time to migrate my actions but didn’t work your correct for me.
Can someone help me?

First part work correct. I get a notification with the options thats inside the category:

  categories:
    - name: "MEDICINE"
      identifier: "MEDICINE"
      actions:
        - identifier: "MEDICINE_SNOOZE"
          title: "Remind me later again"
          activationMode: "background"
          authenticationRequired: false
          destructive: true
          behavior: "default"

        - identifier: "MEDICINE_TAKE_THEM"
          title: "I take my medicine"
          activationMode: "background"
          authenticationRequired: false
          destructive: true
          behavior: "default"

But when press on the button there is nothing happen (The wait_for_trigger part)

- id: "a7c65cfc-cd58-4475-8df7-fafbd8f9c647"
  alias: "Notification - Take medication"
  trigger:
    - platform: time
      at: "13:49:00"

  condition: []

  action:
    - service: notify.mobile_app_peter_iphone
      data:
        title: "Medication"
        message: "Take your medication!"
        data:
          push:
            category: "MEDICINE"

    - wait_for_trigger:
        - platform: event
          event_type: mobile_app_notification_action
          event_data:
            action: "MEDICINE_TAKE_THEM"

        - platform: event
          event_type: mobile_app_notification_action
          event_data:
            action: "MEDICINE_SNOOZE"

    - choose:
        - conditions: "{{ wait.trigger.event.data.action == MEDICINE_TAKE_THEM }}"
          sequence:
            - service: notify.mobile_app_peter_iphone
              data:
                title: "HA - Notification"
                message: "Well done, now you can sleep this night"

        - conditions: "{{ wait.trigger.event.data.action == MEDICINE_SNOOZE }}"
          sequence:
            - service: notify.mobile_app_peter_iphone
              data:
                title: "HA - Medication ALERT"
                message: "Take your medication!"
                data:
                  push:
                    category: "MEDICINE"

Here the JSON output of both actions:

Event 1 fired 13:49:
{
    "event_type": "mobile_app_notification_action",
    "data": {
        "action": "MEDICINE_TAKE_THEM"
    },
    "origin": "REMOTE",
    "time_fired": "2021-12-23T12:49:05.874207+00:00",
    "context": {
        "id": "4db41d9a7ede03421a77b24126017402",
        "parent_id": null,
        "user_id": "9863ce4921dc47dab852efee983e12c9"
    }
}
Event 0 fired 13:46:
{
    "event_type": "mobile_app_notification_action",
    "data": {
        "action": "MEDICINE_SNOOZE"
    },
    "origin": "REMOTE",
    "time_fired": "2021-12-23T12:46:05.802795+00:00",
    "context": {
        "id": "cb2ddb8996589d7868749892e46d20cf",
        "parent_id": null,
        "user_id": "9863ce4921dc47dab852efee983e12c9"
    }
}

What do I wrong :slight_smile: ?

Cheers,

Happy X-MAS for all of you!!

Finally solved it myself:

- id: "a7c65cfc-cd58-4475-8df7-fafbd8f9c647"
  alias: "Notification - Take medication"
  trigger:
    - platform: time
      at: "16:11:00"

  condition: []

  action:
    - service: notify.mobile_app_peter_iphone
      data:
        title: "Medication"
        message: "Take your medication!"
        data:
          push:
            category: "MEDICINE"

    - wait_for_trigger:
        - platform: event
          event_type: ios.notification_action_fired
          event_data:
            categoryName: MEDICINE

    - variables:
        option: "{{ wait.trigger.event.data.actionName }}"

    - choose:
        - conditions: "{{ option == 'MEDICINE_TAKE_THEM' }}"
          sequence:
            - service: notify.mobile_app_peter_iphone
              data:
                title: "HA - Notification"
                message: "Well done, now you can sleep this night"

        - conditions: "{{ option == 'MEDICINE_SNOOZE' }}"
          sequence:
            - service: notify.mobile_app_peter_iphone
              data:
                title: "HA - Medication ALERT"
                message: "Take your medication!"
                data:
                  push:
                    category: "MEDICINE"

category-based notifications are the feature which is deprecated. You will want to not send it in the message and instead send the actions themselves. Brief migration guide, which is mostly pasting things around: Actionable Notifications | Home Assistant Companion Docs

1 Like

Changed everything. Moved all category stuff into the automation as actions.
Thanks