I’ve implemented this triggered template sensor:
- trigger:
- platform: mqtt
topic: "birdnet"
- platform: time
at: "00:00:00"
id: reset
sensor:
- unique_id: c893533c-3c06-4ebe-a5bb-da833da0a947
name: BirdNET-Go Events
state: "{{ today_at(trigger.payload_json.Time) }}"
attributes:
bird_events: >
{% if trigger.id == 'reset' %}
{{ [] }}
{% else %}
{% set time = trigger.payload_json.Time %}
{% set name = trigger.payload_json.CommonName %}
{% set confidence = trigger.payload_json.Confidence|round(2) * 100 ~ '%' %}
{% set current = this.attributes.get('bird_events', []) %}
{% set new = dict(time=time, name=name, confidence=confidence) %}
{{ current + [new] }}
{% endif %}
Unfortunately I have very noisy earthworks going on in my garden at the moment (replacing my PITA lawn with a native garden) so I will be waiting a while for the next detection.
Once I get some data I’ll start on the display.
EDIT: Landscapers were quiet for a bit. Baby steps…
type: markdown
title: "BirdNET-Go"
content: |-
Time|CommonName|Confidence
:---|:---|:---
{%- set t = now() %}
{%- for bird in state_attr('sensor.birdnet_go_events','bird_events') or [] %}
{{ bird.time}} | {{bird.name}} | {{ bird.confidence }}
{%- endfor %}
.
Now to make it fancier.