Auto-dismiss Persistent Notification by Title

I’ve added an Apple TV to my house, but have no other Apple devices (except for a bonus child that has an iPhone, but she’s not interested in doing anything).

Every time Home Assistant gets restarted (and some other trigger I haven’t identified), I get ~20 persistent notifications with QR codes to allow me to pair several devices with HomeKit.

I finally sat down and made an automation and now a blueprint that includes a condition to check the title of the notification. If there’s a match (currently an exact match), it will dismiss the notification and add an entry of “warning” severity to the logs.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Persistent Notification Auto-dismissal
  description: Auto-dismiss persistent notifications by title
  domain: automation
  input:
    notification_title:
      name: Notification Title
      description: Any persistent notifications whose title matches will be dismissed

variables:
  notification_title: !input notification_title

trigger:
  - platform: persistent_notification
    update_type:
      - added
    notification_id: ""

condition:
  - condition: template
    value_template: "{{ trigger.notification.title == notification_title }}"

action:
  - service: persistent_notification.dismiss
    data:
      notification_id: "{{ trigger.notification.notification_id }}"

  - service: system_log.write
    data:
      level: warning
      message: "Persistent notification '{{ trigger.notification.title }}' dismissed. {{ now() }}"
2 Likes