There are numerous Battery Level Notification solutions here, but most tend to rely on the sensor (or battery-powered device) accurately reporting battery levels. I have many battery-powered motion and multi sensors that I’ve had operational for more than a year, and most have now had their batteries replaced. I have the following Lovelace Card that shows the battery_level of all these devices.
I thought this was a good solution initially, but in only two cases (out of 11 so far) did this Card show anything less than 30% when a battery was clearly dead. The values shown on the Card for the two that didn’t show 0%, ranged from 30% to 90%!
The way I discovered these sensors were dead was that I noticed the temperature graph became suspiciously FLAT. I realized then I needed another way to determine battery failure in my sensors, and came up with a rather simple automation that seems to work well so far. It is binary, and could be enhanced to include notifications with the device name, etc., to suit various needs. But for me, this is more than sufficient. This doesn’t work as well for things like door/window sensors, unless there are some regular updates made by these devices that you can monitor. In my case, I use all my door sensors to control lights and chimes, so I just notice when they stop working.
The following automation works by monitoring the changes in the temperature reported by the sensors. I have my sensors set to report often at < 1 deg F variations. If the temperature doesn’t update over a given period, I set a boolean that turns an icon red on my status Card in Lovelace. I also log the entity in Logbook, which I can check to find the battery that needs replacing. For a couple of outdoor motion sensors that don’t report temperature, but DO report luminance, I monitor that instead of temperature. It really doesn’t matter what you monitor, as long as it changes fairly frequently. For the luminance and a couple of sensors that are in enclosed spaces, I had to set higher duration thresholds, since they hold valid values longer. Basically, when it stops reporting, I assume the battery is dead. I use an input_number to enter the shorter duration so I can tweak it over time to eliminate false positives. Currently it is 3 hours.
# Sensor Update Overdue (Check Battery)
- id: sensor_update_overdue_atm
alias: Sensor Update Overdue (ATM)
mode: parallel
trigger:
# Temp Sensors
- platform: state
entity_id:
- sensor.zooz_zse19_siren_temperature
- sensor.zooz_zse40_multi_garage_entry_temperature
- sensor.zooz_zse40_multi_garage_left_temperature
- sensor.zooz_zse40_multi_garage_right_temperature
- sensor.zooz_zse40_multi_stairs_temperature
- sensor.zooz_zse40_multi_downstairs_temperature
- sensor.zooz_zse40_multi_den_temperature
- sensor.fibaro_eye_office_temperature
- sensor.fibaro_eye_mbr_temperature
- sensor.fibaro_eye_lr_temperature
- sensor.fibaro_eye_foyer_temperature
for:
hours: "{{ states('input_number.time_till_sensor_overdue_in') | int }}"
# Outside Motion Sensors (slower to change)
- platform: state
entity_id:
- sensor.zooz_zse29_outdoor_motion_front_luminance
- sensor.zooz_zse29_outdoor_motion_side_luminance
- sensor.sensative_strips_comfort_temperature
- sensor.zooz_zse40_multi_shed_temperature
- sensor.zooz_zse40_multi_vault_temperature
for:
hours: 24
# Does NOT Check EcoLink Door Sensors, Smoke Detectors, Flood Sensors, Remote Switch
action:
- service: logbook.log
data:
name: Sensor Update
message: "{{ state_attr(trigger.entity_id,'friendly_name') }} update overdue."
- service: homeassistant.turn_on
data:
entity_id: input_boolean.sensor_update_overdue_ib
Here’s the icon on my Status Card.