Replies: 4 comments 2 replies
-
|
Hi @nsleigh! Great use case — and good news: the card already handles this natively with entity_filter. No need for a template that concatenates everything into one string. entity_filter matches all entities whose ID or friendly name contains the pattern, and creates one individual alert per matching entity — so each low-battery device gets its own slide in the rotation. Here's an example that covers most setups: type: custom:alert-ticker-card
This will match every entity whose ID or name contains battery, read the battery_level attribute for the comparison, and show a separate alert for each device below 20% with its friendly name and current level. If your battery sensors store the level as the main state (e.g. sensor.device_battery = 15), just drop the attribute line and use a glob pattern:
You can also exclude specific devices (phones, tablets, etc.) — click the entity count badge in the editor to see all matched entities and toggle exclusions visually. Hope that covers your setup! 🙏 |
Beta Was this translation helpful? Give feedback.
-
|
I am not sure that works - in devtools state if I filter by battery there are lots of entities but none have and attribute: battery_level. The only entities I can find with battery_level are some device_trackers. (I think this is why I needed to filter on device_class) Am I missing something? |
Beta Was this translation helpful? Give feedback.
-
|
Hi @nsleigh, you're right — standard HA battery sensors are the battery level (their state is the percentage directly), so no attribute needed. With the new device_class filter added in the next release, your setup is simply: alerts:
This auto-discovers every entity with device_class: battery, compares their state directly against the threshold, and shows one individual alert per low-battery device — no templates, no groups, no manual list. New devices added to HA are picked up automatically. Sorry for the confusion in the earlier reply with attribute: battery_level — that was incorrect for standard battery sensors. 🙏 |
Beta Was this translation helpful? Give feedback.
-
|
Looking good - by the way I don't think you need the % on the end of the message as it comes from the state. The other part for my template is removal of " battery" and " level" from the text. I assume it can be done in the message using jinja but can't seem to get it to work (will keep try and report back). Currently have this: Just realised - I can just use "🔋 {device}: {state}" - much cleaner. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if this is something that could be accommodated with this card but I have a quite complex requirement with regards to battery monitoring. I have about 80+ devices with batteries that I monitor. Before the alert card I had a template that filters all sensors by attributes.device_class = 'battery' and then checks the level, if too low it adds the sensor to a string that is displayed in a markdown tile. (There is some additional logic to filter out things like my phone, ipad and also change names to more friendly names e.g. "Living room motion Battery level" is "Living room motion".)
I can still use the template with alert card but you only get one alert with more than one battery mentioned (if there are too many it doesn't word wrap so they are missing).
Is there anyway the card could accept the template and use the values as multiple alerts (template would probably need to return something different).
In part this issue is related #77
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions