Has anybody made something clever for monitoring batteries in sensors and remotes?

I saw the ‘monster-card’ thing, but that requires a visible interface, which I haven’t made, and I’m not sure I really want to.
My thought was to make a loop that runs through all the entities in a group, and then sends out Google Voice TTS messages for low battery levels accordingly.
I can read that I need to use templates for that.
The more I’ve read about this the more confused I’ve gotten, it looks like it’s a changing field for HA.
I can of course just make an automation for each entity, but it seems kinda silly.

My idea was to make a timed trigger that would iterate through a group.
By beg, borrow and steal, this is what I’ve gotten to so far, but of course it doesn’t work.

- alias: Batterycheck
  initial_state: 'on'
    platform: time
    at: '17:30:00'
  condition:
  - condition: template
    {%- for entity_id in states.group.batterycheck.entity_id -%}
      {% set parts = entity_id.split(’.’) -%}
      {%- if states(entity_id.battery_level) < ‘20’ %}
        {%- if loop.first %} {% elif loop.last %} and the {% else %}, the {% endif -%}{{ states[parts[0]][parts[1]].name }}
      {% endif -%}
    {%- endfor %}
  action:
  - service: tts.google_say
    data_template:
      message: 'Battery alert'

Anybody that has done something like this? I have no experience in Python, I would prefer keeping it in HA.

1 Like

A search for ‘battery alert’ brings back this as the first result.

No point reinventing the wheel :wink:

1 Like

Ha ha, no, there’s enough wheels in the world as it is :smiley:
Thankyou, I’ve searched like crazy for all sorts of things, never found this one.

1 Like