Hi all. Wondering what folks use for low battery/offline device notifications and monitoring. I have a low battery blueprint set up from https://community.home-assistant.io/t/low-battery-notifications-actions/653754. And set up a dashboard with auto entities to show low batteries and unknown/unavailable devices. But wondered what other folks use? Do you bother with unknown or only unavailable? I think the last big part missing from my setup is an automation to alert me when devices are offline. I wasn't sure if something like 5 minutes of being offline notify?
#Low battery and offline devices
1 messages · Page 1 of 1 (latest)
I use auto-entities on my home dashboard so that it is only shown if a battery goes low or if any of the entities of choice becomes unavailable. I have configured it to only show sensors, buttons, outlets and sirens using regmatch. Let's see if the code can be pasted correctly...
type: custom:auto-entities
card:
type: custom:battery-state-card
title: Deviations
filter:
include:
- options:
name: "{attributes.friendly_name|replace(Battery+,)}"
secondary_info: "{attributes.battery_type_and_quantity}"
integration: battery_notes
domain: sensor
attributes:
device_class: battery
state: <=15
- options: {}
name: .*sensor, \w+$
state: unavailable
- options: {}
name: .*switch, \w+$
state: unavailable
- options: {}
name: .*outlet, \w+$
state: unavailable
- options: {}
name: Siren, \w+$
state: unavailable
exclude:
- options: {}
integration: mobile_app
sort:
method: state
numeric: true
card_mod:
class: inline-card
With this formatting (in swedish)
I'm using "battery notes" so that the type of the battery (and when it has been replaced) can be shown.
Ah ok cool. Thanks for sharing. I was looking into battery notes but haven't implemented it yet.
This is my battery level monitoring for tablet dashboard. Write-up in the auto-entities thread. LINK
For unavailable/unknown entities, I tagged entities to be monitored. A template added to configuration.yaml keeps an eye on them. An automation watches the state change of this entities and then sends a notification. Simple Markdown card on dashboard also shown.
template:
- trigger:
- platform: time_pattern
minutes: "/5"
variables:
unavailable_entities: |
{{ label_entities('Monitored') | expand() | selectattr('state' , 'in' , ['unavailable','unknown']) | sort(attribute='name') | map(attribute='name') | list }}
unavailable_entity_count: |
{{ unavailable_entities | count }}
unavailable_entity_list: |
{{ unavailable_entities | join(', ') }}
sensor:
- name: Unavailable Monitored Entities
unique_id: 6fa6ca0b-0c4e-49e5-b95b-c4f3a28719fb
state: "{{ unavailable_entity_count }}"
attributes:
monitored_entities_count: |
{{ label_entities('Monitored') | expand() | map(attribute='name') | list | count }}
unavailable: |
{% if unavailable_entity_count | int > 0 %} {{ unavailable_entity_list }} {% else %} No unavailable entities {% endif %}
type: markdown
content: |
{% set e = "sensor.unavailable_monitored_entities" %}
{% if states(e) | int == 0 %}
<center><font size=5 color="green">All Good!</center>
{% else %}
<center><font size=5 color="red">Unavailable: {{ state_attr(e, "unavailable") }}
{% endif %}
Ahhh cool. That's actually the thread I followed to get the setup I have going. 🙂 Yours looks great.
Does it check every 5 minutes or do they have to be down for 5 minutes?
Is it posssible add secondary_info with last_seen state?
card:
type: entities
filter:
include:
- integration: mqtt
entity_id: "*_battery"
...```
Using the time_pattern /5, HA will run the template every five minutes. The devices don't have to be down for five minutes but it wouldn't take much to modify the template to if that's what you want to look for.
I'm not using the MQTT integration so I'm not sure if the last_seen attribute is from that; I used last-updated for this example. (Interestingly, one sections uses last-updated while the other uses last_updated.) I also excluded some stuff I didn't want to see. ```yaml
type: custom:auto-entities
card:
type: entities
filter:
include:
- entity_id: "*_battery_level"
options:
secondary_info: last-updated
exclude:
- integration: fully_kiosk
- integration: zwave_js
- state: unavailable
sort:
method: last_updated
reverse: true
numeric: true
count: 8
Hmmm digging around more I have a ton of Unknown states for devices. How did you all wrangle them? Some are scenes some are configurations. Did you guys just remove those ones or figure out how to square them up?
You can add a - state: unknown to the exclude section to help with those.
You monitor for unknown right? But you have a selective list you watch? I'd largely like the monitor all devices if possible.