Mobile app notifications open specific dashboard/tab/view as default "click" action

Does anyone know if it’s possible to set a notification so when clicked (anywhere on the notification), it will open the Home Assistant App on a specific view (dashboard/tab/setting/whatever)?

Or can that only be achieved by making an actionable notification, where the action triggers a new automation that sends a command_webview notification (Notification Commands | Home Assistant Companion Docs)? Meaning it can’t be the “default” action for clicking anywhere on the notification?

2 Likes

See “Opening a URL”

3 Likes

Great, exactly what I was looking for, thanks!

Hey, thanks @zacwest for linking this helpful part of the HA Docs. I see that in iOS, you have to “long press” the notification in order for these Actionable Notifications show up. I wonder if anyone out there knows of a way for my tapping of a notification delivered by home assistant (not long pressing) it is possible to perform an actionable notification that way? So if I get an alarm tripped notification, I can just tap the notification to hop over to the specific alarm dashboard. Right now, if I build an actionable notification using the “URI” action, I have to long press in order to go to my alarm dashboard.

2 Likes

Thank you for the post. Have been looking for the same.

1 Like

I’ve been trying to get this to work for me but no matter how I write it doesn’t work. When I click on the notification it opens the Companion App to whatever page I was on last. This seems so simple so I must be missing something obvious but can not figure it out! Here’s two ways I tried - the notification works but the action doesn’t. The only thing I can think of is because I’m using Nabu Casa but I’m not sure…thanks for anything you can offer.

image

image

image

Try just following the example in the docs (Introduction | Home Assistant Companion Docs). I’m not sure where you get URI? It says url, not uri (L not I) in the example.

    action:
      - service: notify.mobile_app_<your_device_id_here>
        data:
          title: "Motion Detected in Backyard"
          message: "Someone might be in the backyard."
          data:
            # iOS URL
            url: "/lovelace/cameras"
            # Android URL
            clickAction: "/lovelace/cameras"

Also remember, url only works for iOS, you need to use ClickAction for Android.

To simplify, maybe try to notify from developer tools, just select the notify device, and in the data section put

url: "/lovelace/notify-test/0"

for iOS or:

clickAction: "/lovelace/notify-test/0"

for Android.

Drop the Lovelace part of the URL because it’s not valid for your relative URL.

Thanks guys. Removing the /lovelace and understanding better the difference between a long iPhone hold and a tap did the trick.

For others’ reference this directs a short tap to the dashboard:

title: Light Activity
message: Someone might be playinig with lights.
data:
url: /notify-test/0

And when you long press an iphone notification a button displays (titled “Open URL” in this case) that will open the dashboard when selected:

actions:

  • action: URI
    title: Open URL
    uri: /notify-test/0

The URI vs. URL is in the same documentation referenced in one of the responses just at a later point. Thanks for the help!

Hello. I apologize for a necro, but I don’t think a new thread over the “same-ol-thing” would have been very respectful, either.

I am trying to get an actionable notification to have a “clickAction/url” (depending on whether its an Android or iOS device) AND be persistent (unable to swipe away)

Below is my current script:

alias: night Confirmable Notification
use_blueprint:
  path: homeassistant/confirmable_notification.yaml
  input:
    notify_device: 325179e1cba09299033239ca60b83252
    title: Night time?
    message: Are you ready for bed?
    data:
      url: "/zwave"
      clickAction: "/zwave"
      persistent: true
      tag: nighttime
    confirm_text: Yes!!
    dismiss_text: Not yet (5m reminder)
    confirm_action:
      - service: automation.trigger
        metadata: {}
        data:
          skip_condition: true
        target:
          entity_id: automation.lights_out_routine
    dismiss_action:
      - service: script.toggle
        target:
          entity_id: script.delay_bedtime
        data: {}
icon: mdi:bell-sleep

clicking the actionable buttons (yes or no) works just fine and either triggers the intended night time mode or delays and then calls this script in a loop to retrigger the actionable notification again.

What is missing is the “url” portion so that if someone accidentally clicks the notification itself, it won’t just go to the “default-view” dashboard, but will instead launch to the specific zwave dashboard where we can manually turn off lights, etc
This dashboards specific location is:
http://IP_ADDRESS:8123/lovelace/zwave

Please note that I have tried:
url: “/zwave”
clickAction: “/zwave”

and
url: “lovelace/zwave”
clickAction: “lovelace/zwave”

I haven’t even begun to try to get persistent notifications working at the same time because I am trying to operate with “one variable at a time”

Thanks for ANY guidance available.

Ray.