First, you need to decide how to store the data for the day. Typically I use MQTT to store a list inside an attribute. @TheFes typically uses template sensors with attributes.
This is what I use for MQTT discovery and state updates:
mqtt_automated_states:
alias: Publish State and Attributes
mode: parallel
fields:
<<: &mqtt-fields
domain:
description: The entities domain
selector:
text:
type: text
unique_id:
description: The entities unique_id
selector:
text:
type: text
object_id:
description: The entities object_id
selector:
text:
type: text
state:
description: The entities state
selector:
text:
type: text
attributes:
description: The entities attributes
example: A dictionary {} in yaml
selector:
object:
variables:
<<: &mqtt-variables
root: "homeassistant"
topic_root: >
{%- if domain is not defined or unique_id is not defined %}
{{- [ root, 'error'] | join('/') }}
{%- else %}
{{- [ root, domain, unique_id ] | join('/') }}
{%- endif %}
service_data: >
{{ {
'topic': topic_root ~ '/state',
'payload': '' ~ { 'state': state, 'attributes': attributes | default({}) } | tojson,
'retain': retain | default(True)
} }}
sequence:
- service: mqtt.publish
data: "{{ service_data }}"
mqtt_automated_config:
alias: Publish Discovery
mode: parallel
fields:
<<: *mqtt-fields
device_class:
description: The entities device class
selector:
text:
type: text
variables:
name: >
{% if object_id is defined %}
{{ object_id | default('') | replace('_', ' ') | title }}
{% elif unique_id is defined %}
{{ unique_id | default('') | replace('_', ' ') | title }}
{% else %}
Unknown Entity
{% endif %}
<<: *mqtt-variables
service_data: >
{%- set items = [
("name", name),
("unique_id", unique_id | default(none)),
("object_id", object_id | default(none)),
("state_topic", topic_root ~ "/state"),
("value_template", "{{ value_json.state }}"),
("json_attributes_topic", topic_root ~ "/state"),
("json_attributes_template", "{{ value_json.attributes | tojson }}"),
("device_class", device_class | default(none) ),
("unit_of_measurement", unit_of_measurement | default(none) ),
("state_class", state_class | default(none)),
("device", device | default(none))
] %}
{% set payload = dict.from_keys(items | rejectattr('1', 'none') | list) %}
{{ {
'topic': topic_root ~ '/config',
'payload': '' ~ payload | tojson,
} }}
sequence:
- service: mqtt.publish
data: "{{ service_data }}"
Then with an automation, make the entity taht will store the info
- alias: Birdnet List
trigger:
- id: reset
platform: time
at: "00:00:00"
- id: discovery
platform: homeassistant
event: start
- id: update
platform: mqtt
topic: topic/of/source/birdnet/data
variables:
<<: &common
domain: sensor
object_id: birdnet_list
action:
- choose:
- conditions:
- platform: template
value_template: "{{ trigger.id == 'reset' }}"
sequence:
- service: script.mqtt_automated_states
data:
<<: *common
state: "{{ today_at() }}"
attributes: >
{{ {'items': []} }}
- conditions:
- platform: template
value_template: "{{ trigger.id == 'discovery' }}"
sequence:
- service: script.mqtt_automated_config
data:
<<: *common
name: List
device_class: timestamp
device:
name: Birdnet
identifiers:
- 0fff6
manufacturer: Tom
model: Birdnet List
sw_version: "1.0"
- conditions:
- platform: template
value_template: "{{ trigger.id == 'update' }}"
sequence:
- service: script.mqtt_automated_states
data:
<<: *common
state: "{{ now() }}"
attributes: >
{% set current = states(domain ~ '.' ~ object_id, 'items') or [] %}
{{ (current + [{
'datetime': trigger.payload_json.BeginTime,
'name': trigger.payload_json.CommonName,
'confidence': trigger.payload_json.Confidence,
}]) | sort(attribute='datetime', reverse=True) }}
This automation will create discovery on startup for a sensor, it will reset the sensors data at midnight, and it will update the sensors state when your mqtt source topic updates.
Next, if you just want a table of this in markdown:
type: markdown
content: >
Time|CommonName|Confidence
:---:|:---:|:---:
{%- set t = now() %}
{%- for bird in states('sensor.birdnet_list','items') or [] %}
{{ relative_time(bird.datetime | as_datetime) }} | {{bird.name}} | {{ bird.confidence }}
{%- endfor %}
If you want fancy cards, you need to decide what card to use. Above I used mushroom I think?
type: custom:auto-entities
card:
type: vertical-stack
card_param: cards
filter:
template: >
[{%- set t = now() %}
{%- for bird in states('sensor.birdnet_list','items') or [] %}
{
"type": "custom:mushroom-template-card",
"primary": "{{ bird.name }}",
"secondary": "Confidence: {{ bird.confidence }}\n{{ relative_time(bird.datetime | as_datetime) }}",
"multiline_secondary": true
},
{%- endfor %}]