How to push any Persistent Notifications to HA app?

Sometimes I have Persistent Notifications in the HA frontend (like any 3rd party integration requiring some action due to a breaking change or whatever). Or imagine a user login failure, which usually also results in a persistent notification in the frontend only.

Is it possible to push any notifications also to the app? (because I hardly ever look into the frontend in my browser).

I do this with the bad login notification. The same principles can be used for other notifications.

But how can I trigger on any persistent_notification? I would not want to list all of them as a trigger one after the other…

1 Like

Could solve it as follows (though don’t know it it’s the correct way. But it works):

trigger:

event_data:
  domain: persistent_notification
  service: create
event_type: call_service
platform: event

action:

data_template:
  message: '{{trigger.event.data.service_data.message}}'
  title: 'Persistent: {{trigger.event.data.service_data.title}}'
service: notify.mobile_app
10 Likes

Thanks for this, works well.

Whoever is using this, here is the update:

domain: persistent_notification
domain: notify
service: create
service: persistent_notification

1 Like

Thanks! Took me a little bit to figure out the indentation as I’m not that fluent in YAML. For anyone else that wants this. Create a new automation, go into YAML mode, remove everything and paste this in, change the service to your device and save.

alias: Notification Push Persistant Notifications
description: ""
trigger:
  - event_data:
      domain: notify
      service: persistent_notification
    event_type: call_service
    platform: event
condition: []
action:
  - service: notify.mobile_app   # Change this to your device
    data_template:
      message: "{{trigger.event.data.service_data.message}}"
      title: "P: {{trigger.event.data.service_data.title}}"
mode: single

2 Likes