I’d be curious what you mean by “it dies” for both the dashboard and the tags. I’ve used both strategies with good success. I’ve ended up getting rid of the dashboards, but I still use tags (it’s the easiest way to identify which things are batteries I want to track).
First, I tag all the batteries with “Battery Tracking.”
Second, I have a template binary_sensor to figure out if ANY battery is below 20%. The state template for that is:
Third, I have HA create a notification that lists all the batteries that are low.
alias: Notify on Low Batteries
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.batteries_low
to: "on"
for:
hours: 0
minutes: 5
seconds: 0
conditions: []
actions:
- action: persistent_notification.create
metadata: {}
data:
title: Low Batteries
message: >-
{% set s = label_entities('Battery Tracking') | expand() |
selectattr('state', 'is_number') | list -%} {% set n = s |
map(attribute='name') | list -%} {% set v = s | map(attribute='state') |
map('int', 100) | list -%} {% set l = zip(n, v) | selectattr(1, '<', 20)
%} {% for i in l %}{{ i[0] }} {% endfor %}
mode: queued
Does that integration have the option to select 'Cheap Chinese batteries bought from cheapest vendor"? Guessing on battery life without sensing, based on passage of time, may not be consistently reliable.
When saying ‘dies’ - more mening me remembering to ‘tag’ all the new devices.
I where hopeing for some smart automated functions in HA that I had missed…
But i think your solution is the next best … I will try to set it up like you have described.
I do a riff on this. Device class + a specific ‘exclude’ label for a lot of things. I just add a filter - not in label_entities(foo) befoyi get the result and it drops all the ones I want excluded for… Whatever. It’s pretty flexible.
Battery notes is my goto. It’s pretty good.
The templates are more for information to the llm and I’m looking at grocy as future solution.
But… Grocy is HEAVY it’s a great home erp solution but you need to commit to grocy I wouldn’t do it just for batteries. (fun side note I’m doing a ton of llm work with grocy specifically the battery integration this weekend funny enough… and my recommendation will likely change from battery notes to Grocy IF you use an AI to drive it AND have a good LLM tool for Grocy)
It was about everything I could do to figure out the YAML to do the list of things in the tag. I think my head might explode if I try and subtract one list from another. Although I do like that with the exclude tag things get tracked by default. I might have to risk a brain aneurism and try that out.