Can't Dismiss Actionable Notification When Using URI Action

Hi all - I’m struggling to clear an android notification when I click the notification button. It uses the URI action to take me to a lovelace dashboard, but when I test the automation, it doesn’t clear.

  - service: notify.notify
    data:
      message: |-
        {{ expand('light.lights')
           | selectattr('state', 'eq', 'on') 
           | map(attribute='name') 
           | list 
           | join (', ')
        }}
      title: Lights On For 30 Mins+
      data:
        ttl: 0
        priority: high
        actions:
          - action: URI
            title: Open Lights Dashboard
            uri: /lovelace-mushroom/lightson
        tag: lights-on
  - wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: URI
  - service: notify.notify
    data:
      message: clear_notification
      data:
        ttl: 0
        priority: high
        tag: lights-on

I think the issue is the ‘wait for trigger’ section, as the notification fired and immediately dismissed when I removed this. What’s wrong with this section - I have a similar notification with this logic (for closing the garage door) that works, so a bit confused!

Thanks

there is no action sent back for URI actions so the trigger will never work.

FR: https://github.com/home-assistant/android/issues/2275

Edit: A better check in this case would be to enable the app importance sensor and send the clear event when the state becomes foreground

1 Like

Huge thanks :slight_smile: All working now!

1 Like