Persistent notification
The persistent notification integration is behind the notifications in the sidebar of Home Assistant. A failed login, an integration that could not be set up, your own automation saying the filter needs changing: they all end up there, until somebody dismisses them.
Since Home Assistant 2023.6, a notification is no longer an entity with a state. Only the sidebar shows them. An automation or a template cannot see what is in there: not to show the titles on a dashboard, not to send the ones still open to your phone.
Spook adds an action for that: list the notifications.
Actions
Spook adds one action to the persistent notification integration. You find it wherever you add an action, marked with a 👻.
List notifications
Lists the persistent notifications, the oldest first: their ID, title and message, and when they were created. The same ones the sidebar shows.
A notification created again with the same ID replaces the one before it. It gets the new message and the new time, so it moves to the back of the list. A dismissed notification is gone, and not listed anymore.
Everybody can list the notifications, as everybody sees them in the sidebar.
Only want the number of notifications? Spook already has a sensor for that, sensor.persistent_notifications, under devices and entities.
How to use it
- Open the automation or script that needs the notifications, and select Add action.
- Search for list notifications, and select Persistent notification: List notifications 👻.
- Under Response variable, give the list a name, like
result. The steps after this one can use it. - Select Save.
| Action properties | |
|---|---|
| Action | Persistent notification: List notifications 👻 |
| Action name | persistent_notification.list |
| Action targets | No targets |
| Action response | Yes, the notifications |
| Spook's influence | Newly added action |
| Tools | Try this action |
This action takes no data.
The response:
| Attribute | Type | Description |
|---|---|---|
notifications | list | The notifications, the oldest first. |
notifications[].notification_id | string | The ID of the notification. Home Assistant's dismiss action takes it. |
notifications[].title | string or null | Its title, null when it has none. |
notifications[].message | string | Its message, in Markdown. |
notifications[].created_at | string | When it was created, in UTC, like 2026-12-01T09:30:00+00:00. |
A sensor for your dashboard, with the number of notifications as its state and their titles as an attribute. Home Assistant's own persistent notification trigger keeps it up to date, every time a notification comes or goes. The start and the reload of template entities fill it in for the notifications that are already there:
template:
- triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type: event_template_reloaded
- trigger: persistent_notification
actions:
- action: persistent_notification.list
response_variable: result
sensor:
- name: Open notifications
icon: mdi:bell
state: "{{ result.notifications | count }}"
attributes:
titles: >-
{{ result.notifications
| map(attribute='title')
| reject('none')
| list }}
Every morning, send every notification that is still open to your phone:
triggers:
- trigger: time
at: "08:00:00"
actions:
- action: persistent_notification.list
response_variable: result
- repeat:
for_each: "{{ result.notifications }}"
sequence:
- action: notify.mobile_app_phone
data:
title: "{{ repeat.item.title or 'Home Assistant' }}"
message: "{{ repeat.item.message }}"
- The list is the notifications at the moment of the call. To act on a new notification right when it comes in, use Home Assistant's own persistent notification trigger instead.
- Home Assistant keeps the notifications in memory, not on disk. After a restart, only the ones created since are listed.
- The message is the Markdown the sidebar shows it from. A phone shows that as it is, asterisks and all.
Missing something here?
An action, an entity or a repair this integration should have? Say so. Stuck, or found a bug? There is help.
