just as a heads up but also as an open question to the fellow HA users of persistent_notifications:
Persistent notifications are no longer stored in the state machine. This means that we no longer create an entity for each persistent notification.
as I have more than a few rather important notification automations in my system, I am puzzled how to proceed after this. Asked a few times in the #beta channel, but it remained silent on that, so here’s for a more open discussion on the matter.
I use the state of persistent_notifications in the frontend, to have conditionals like:
- type: conditional
conditions:
- entity: binary_sensor.trash_notification
state: 'on'
card: !include /config/dashboard/includes/button/include_button_trash_alert.yaml
based on:
- binary_sensor:
- unique_id: trash_notification
state: >
{{is_state('persistent_notification.trash_notification_today','notifying') or
is_state('persistent_notification.trash_notification_tomorrow','notifying')}}
some more backend examples, like:
template:
- binary_sensor:
- unique_id: rss_feeds
state: >
{% set feed = states.persistent_notification|map(attribute='object_id')|join %}
{{'rss_feed' in feed}}
icon: >
mdi:{{is_state(this.state,'on')|iif('rss','rss-off')}}
attributes:
count: >
{% for state in states.persistent_notification if 'rss_feed' in state.object_id %}
{% if loop.first %}{{loop.length}}{% endif %}
{% endfor %}
and
{% set feed = states.persistent_notification|map(attribute='attributes.message')
|list|join(',\n ') %}
{{feed if feed and 'New Rss feed' in feed else 'No Rss feeds'}}
ofc, there’s more in automations to auto dismiss on existence:
condition:
- >
{{states.persistent_notification.trash_notification_tomorrow is not none}}
- condition: state
entity_id: persistent_notification.trash_notification_tomorrow
state: notifying
action:
service: persistent_notification.dismiss
data:
notification_id: trash-notification-tomorrow
or a bit more complex, templating the id:
- service: persistent_notification.dismiss
data:
notification_id: >
trash-notification-{{is_state('persistent_notification.trash_notification_today','notifying')
|iif('today','tomorrow')}}
or
- service: persistent_notification.create
data:
title: >
Low ink ({{color}})
message: >
{{trigger.to_state.name}} is low
notification_id: >
low-printer-ink-level-alert-{{color}}
Id been keen to hear from other users how they will take care of this significant breaking change, and if we have tools at our disposal to replace these.
I did have a look at creating more input_booleans, but it will become very crowded in that regard, with nested booleans etc… not optimal
thanks for your ideas/suggestions