The app notification platforms have persistent notifications, which are great for more immediate notifications. It would be nice if the persistent notifications (the ones that appear in the ‘Notifications’ drawer of the Home Assistant UI) had similar support, allowing users to open URLs and perform actions based on the notification. A GitHub issue with more detail exists already but was not taken any further:
opened 05:03PM - 02 Jan 20 UTC
closed 06:35PM - 12 Jan 22 UTC
feature-request
architecture
backend change required
Currently persistent notifications in Home Assistant just have a single "DISMISS… " button no matter what. Not too useful and it feels like a waste of the available space.
Open the [demo site](https://demo.home-assistant.io/) for example and look at the demo notification there - it says that motion was detected in the backyard. Chances are you'd wanna check that out immediately, but all you get is a dismiss button. Wouldn't it be cooler if there was a button to show the `camera.backyard` stream? Or a button to navigate directly to your "Backyard" Lovelace view so you could turn on the lights and scare off any intruders?
In my opinion, if something is important enough to want a notification for, it's usually something important enough to either look at or act upon in some fashion. So why not make that super easy with Actionable Notifications. iOS app has these ([docs](https://companion.home-assistant.io/en/notifications/actionable)), HTML5 notify and I believe Telegram integration does as well.
Below are some mockups and examples of how this could be beneficial.
## Core System Examples
This first mockup just shows a handful of ideas on how these can be used to notify of core system stuff.
* If a new device tracker is added, help the user assign it to a person right away. Or maybe they don't want to track that device, so just press a button for that too.
* If a new light is added, help the user place that light into one of their existing scenes.
* If a device gets added with ugly default MAC address like `binary_sensor.wyzesense_77793176`, allow the user to rename it right from the notification. This would open `more-info` for that entity where the user could conveniently rename it to `binary_sensor.front_door` rather than hunting through the States page.
* Last example is of an active timer. This idea is kind of inspired by iOS lock screen which shows active timers and alarms on top of your notifications.
![mockup-system](https://i.imgur.com/OlRbJmG.png)
Other ideas not in these mockups:
* Newly created user accounts could have a "Welcome to Home Assistant" notification with actionable buttons that initiate a guided tour.
* Can have a tips system later on, to notify the user of things that would make their experience better. One example would be if the user doesn't have a device tracker entity after 2-3 weeks, briefly explain presence detection with a button that goes to Integrations panel. Would also be an opt-out button if the user never wanted to see tips.
* The invalid config notification ([pic](https://community-home-assistant-assets.s3.dualstack.us-west-2.amazonaws.com/original/3X/5/7/5764ac12b06d02ac285adc6a3ebb0d1b2326e01d.png)) just has Dismiss, maybe the button(s) could bring user directly to Developer Tools > Logs panel to see what's going on and Server Control panel to check config again etc.
* The awesome feature Bram added in https://github.com/home-assistant/home-assistant-polymer/pull/4356 to add all entities of a device to Lovelace, could also be shown in a notification as well. User adds a new device, restarts, sees that notification and can do it without having to navigate to device page.
* Maybe the user has just signed up for Nabu Casa trial, they could get a notification linking them to the website where it explains how to configure Google/Alexa/webhooks etc.
## User Created Automation Examples
I think the above examples already justify this, but it also would be great in user-created automations. You might want to be reminded when a door was left open or unlocked too long, with an actionable button to take care of that. Or be reminded to take your medications which could toggle an `input_boolean` on. Maybe a parent wants to know when their kid is playing too much video games and have a button to pause WiFi on their consoles. There's lots of possibilities.
![mockup-automations](https://i.imgur.com/aFQxSQa.png)
And then of course there's update alert notifications. I have two automations that are very similar to these mockups below, but I had to add the links as Markdown to the `message:` portion instead. Would look a lot cleaner if they could be actual buttons.
![mockup-updates](https://i.imgur.com/BD6ZlEd.png)
## YAML Config
Below is how the YAML config could potentially look. Would be very similar to Lovelace `tap_action` config, so it should be familiar to users and easy for them to adopt. And hopefully easier to implement too?
This example would display three buttons underneath the notification text - View Camera, Turn on Lights, and Dismiss.
```
- service: persistent_notification.create
data:
title: Motion Detected in Backyard!
message: Motion detected and no one is home.
actions:
- action_name: "View Camera"
type: more-info
service_data:
entity_id: camera.backyard
- action_name: "Turn on Lights"
type: call-service
service: light.turn_on
service_data:
entity_id: light.exterior_lights
- action_name: "Dismiss"
type: dismiss
```
I'm not too sure about the Dismiss part - my thought process was that whenever `actions:` are defined it'd replace that bottom button row completely, so the user has more space for their own custom actions. They'd still be able to add Dismiss back manually like in the example. But maybe Dismiss should just be forced and always show?
But I think this would be super cool and make Home Assistant notifications 1000x more useful.