Actionable Notification: action URI to open app but also run automation

Hi,

After doing some research, I haven’t found an answer yet, so thought to ask the community.
I want to use actionable notifications, which is so far all good and fine, it works mostly.

1 action I define in the notification is to open an app, via action: URI
But, at the same time I want to take this action and process further in HA to run an automation, in my case to turn off a toggle helper.
In my case it’s a reminder and when I open the app on the smartphone I want to use this “open app action” to also turn off the helper, meaning, I have done what was asked in the reminder.

When I try to listen to the action: URI, home assistant doesn’t fire any events at all I could use.

Can this be achieved?
Thank you

use a normal action to get the event back so you can automate things, you can still force the app to open stuff using an automation. There is no event sent back for URI action types and it probably won’t be possible given the various uses this feature has which would prevent it from sending back an event in certain situations. If you use the launch app notification command or even command activity you should be able to do what you are trying to do.

Thanks for the response. Took me now a while to see what you really meant. I was familiar with the command_activity, but I didn’t think of using action: whatever to then trigger another automation.
Maybe the following helps someone :slight_smile:
What I ended up with is, having a script with a normal actionable notification, on my phone I now have 2 options, either “Done already” or “Open App”.

service: notify.mobile_app_phone
data:
  message: Don't forget to review the HF order tonight.
  title: Reminder HF
  data:
    actions:
      - action: OPEN_HFRESH
        title: Open HF App
      - action: DONE_HFRESH
        title: Already done

Open App then triggers the following automation to turn off the helper toggle and opening the app on the smartphone:

alias: Reminder options on smartphone for order
description: ""
trigger:
  - platform: event
    event_type: mobile_app_notification_action
    context: {}
    event_data:
      action: OPEN_HF
    id: open-hf
  - platform: event
    event_type: mobile_app_notification_action
    event_data:
      action: DONE_HF
    id: done-hf
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: open-hf
        sequence:
          - service: notify.mobile_app_phone
            data:
              message: command_launch_app
              title: HF order review
              data:
                package_name: com.HF.androidapp
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.HF_order_ongoing
      - conditions:
          - condition: trigger
            id: done-hf
        sequence:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.hf_order_ongoing
mode: single

1 Like