I’ve been reading through the documentation and looked at several tutorials, but I can’t get actionable notifications working.

Here’s an example YAML that was originally done in the GUI. It’s intented to send an actionable notification with two options, and when you click one, it should send another notification to confirm it worked.

It sends the notification fine, and when I tap the button the wait for trigger section in Home Assistant lights up to indicate that it’s been triggered. But nothing further happens.

Any help appreciated!

alias: Actionable notification test
description: ""
trigger: []
condition: []
action:
  - service: notify.notify
    metadata: {}
    data:
      message: Message me?
      data:
        actions:
          - action: ACTION_NOTIFY
            title: Message me
          - action: ACTION_IGNORE
            title: Ignore
  - wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: ACTION_NOTIFY
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: ACTION_IGNORE
    continue_on_timeout: false
    timeout:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 0
  - alias: Perform the action
    choose:
      - conditions:
          - condition: template
            value_template: "{{ wait.trigger.event.data.action == \"ACTION_NOTIFY\" }}"
        sequence:
          - service: notify.notify
            metadata: {}
            data:
              message: Requested message
mode: single
  • eco_game
    link
    fedilink
    English
    arrow-up
    2
    ·
    9 months ago

    As @CondorWonder@lemmy.ca already mentioned, I would recommend using a new automation for the action. Here is a simple example from my setup:

    alias: Notification Action - Disable Theater Mode
    description: ""
    trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: THEATER_MODE_OFF
    condition: []
    action:
      - service: input_boolean.turn_off
        data: {}
        target:
          entity_id: input_boolean.theater_mode
    mode: single
    
    • Dave@lemmy.nzOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      9 months ago

      Thanks! I managed to get it working using one automation with three triggers (original trigger, plus one trigger for each of the two actions), where I have a conditional checking which of the triggers was the one that started the automation. It seems to work 🙂