Dismiss Notifications

I’m sure there is a simple answer to this, but I cant seem to find anything within the forum about this specific problem. One of my integrations I have been struggling with lost its mind overnight and now I have almost 3k notifications. The problem here is when I click the notification bell to dismiss, it crashes the web browser. Does anyone know of a service I can call to dismiss these on the back end? I can’t do it through the GUI.
image

There is a service persistent_notification.dismiss but it requires a notification_id - it’s not clear how you find out what that is, let alone 3,000 of them.

How about this: Dismiss all persistent notifications script - #4 by pnbruckner

As @Stiltjack mentioned you can use the persistent_notification.dismiss service. To get the notification ID use a template… The notification_id is the same as the persistent notification entity’s object ID.

I would just roll it all into a script with a repeat for each:

alias: Clear All Persistent Notifications
sequence:
  - alias: Repeat Dismiss action for all
    repeat:
      for_each: |
        {{ states.persistent_notification | map(attribute='object_id') | list }}
      sequence:
        - service: persistent_notification.dismiss
          data:
            notification_id: "{{ repeat.item }}"
mode: single
1 Like

Thank you all! Problem solved!

2 Likes