hello,
Ive completed it.
Im using BirdnetPi. A acoustic bird classification on a Raspberrypi.
Every time a new bird is identified, the pi sends a persistent notification to Home Assistant via apprise.
Apprise could speak mqtt, but with the home assistant persistent notification I don’t need a mqtt broker.
Created a template sensor, I map all messages from persistent_notification containing “New BirdNET-Pi Detection”
- sensor:
- name: "notification_list"
state: >-
{{ ((states.persistent_notification | selectattr('attributes.title', 'eq', 'New BirdNET-Pi Detection') | list)[-1].attributes).title }}
availability: "{{ states.persistent_notification | list != [] }}"
attributes:
message: >-
{{ ((states.persistent_notification | selectattr('attributes.title', 'eq', 'New BirdNET-Pi Detection') | list)[-1].attributes).message }}
So I can show the newest detection on the dashboard.
Because there a more than 100 messages, a automation dismiss all notifications at 9:00 containing “New BirdNET-Pi Detection”
alias: dismis
description: ""
mode: single
trigger:
- platform: time
# This trigger will fire at 9:00
at: "09:00:00"
action:
#- alias: Repeat Dismiss action for all
repeat:
for_each: >-
{{ states.persistent_notification | selectattr('attributes.title', 'eq', 'New BirdNET-Pi Detection') | map(attribute='object_id') | list }}
sequence:
- service: persistent_notification.dismiss
data:
notification_id: "{{ repeat.item }}"
Thank you!