Notification actions

Would like the ability to react to tapping a notification. Right now it’s only possible to configure actions that appear under the notification, or to react to dismissing the notification.
Tapping on the body of the notification dismisses it but does not generate an event in home assistant, and as far as I’ve been able to discern, there’s no way to set an action for tapping a notification.

you can use clickAction to do somethings Introduction | Home Assistant Companion Docs

You cant send an event back as we need to open an activity associated with the notification.

For feature requests you should put them on github as we don’t track them there.

That’s exactly what I’ve been looking for! Unfortunately it doesn’t work for me.

I used the service call below in Developer Tools > Services. It creates a notification on my phone, but tapping the notification merely dismisses it and there is no other effect.

service: notify.mobile_app_pixel_4a_5g
data:
    title: "Testing"
    message: "This is a test. Please tap this notification."
    data:
      url: "/lovelace/default_view"
      clickAction: "/lovelace/default_view"

I also tested “https://www.google.com/” and “app://io.homeassistant.companion.android”.

Strangely this works on my wife’s phone but not mine. I’ve cleared the cache for the Home Assistant app on my phone but otherwise am not sure what could be causing this.

are you on the beta? have you checked open issues on github? There is a known issue in the beta and all you need to do is grant the app draw over other apps permission as a workaround for now.

You may want to edit your subject since it is completely unrelated to your question

2 Likes

I couldn’t find it anywhere so i’m going to ask here, is there a way for clickAction to behave like a regular action?

I have a notification that fires to my wife’s phone whenever the tv turns on and sun is below_horizon. That notification has 2 actions, one is to turn off the lights and the other to dismiss the notification.

What I’d like to know is if there’s a way to make it so that if you accidentally miss the action button (this happens a lot) and accidentally tap the notification if that action (tapping the notification) could fire the same event as the action.

I found that you can make it fire a URL (i’m on android btw), but not an action.

you can submit a feature request for this

you can work around that by making the notification persistent or sticky so it doesn’t disappear when selected

Yep, I thought about making it persistent, but then I’d have to deal with clearing it which now I know is inevitable hehe. Never mind, I thought I’d missed it, but that answers my question. Thanks!