I just wanted to be able to use the persistent notification as an actual notification platform/service, so that it can be used in alerts or in notify groups.
I had seen complex solutions with automations detecting alert events or persistent notifications creations to then call another notification service, but I think I found a more straightforward solution. It simply uses the RESTful notification and the HA REST API:
notify: - name: persist_it platform: rest resource: 'http://localhost:8123/api/services/persistent_notification/create' method: POST_JSON headers: authorization: !secret persist_notif_token #create a long-term token in your profile page and add 'Bearer ' before it in your secrets file content-type: 'application/json' message_param_name: message title_param_name: title target_param_name: notification_id
You can then call it as another notify service, with the usual
message parameters, and it will create the desired persistent notification.
Optionally, you can use the
target parameter of the notify service to specify a persistent
notification_id, if you want to be able to discard it later on with a call to the