Monitoring Battery Health in sensors

I am looking to add some logic to monitor the battery heath of various sensor devices and am looking for what others have done … Some of my sensors have the following battery related status:

“Battery Voltage” - Number:ElectricalPotential
“Battery Level” - Number
“Battery Alarm” - String
“Low Battery” - Switch

zigbee_manufacturercode = 0x1241
vendor = Samjin

Any thoughts on which one would be the best to monitor health? Seems the simplest would be to just watch the “Low Battery”.

Strange that this topic reappeared to the top…

Better late than never. I just have battery level (in percentage) for my devices, and I put them all in the gBatteries group. Then every day send an email to myself with a list of devices that are offline and those with a low battery

Then using a jruby script

DESTINATION_EMAIL = "my_email@address.com"
LOW_BATTERY_THRESHOLD = 20

def email(msg, **kwargs)
  things["mail:smtp:local"].send_mail(DESTINATION_EMAIL, kwargs[:subject] || "OpenHAB Alert", msg)
end

rule "Battery: Monitor Levels" do
  every :day, at: "10:55"
  run do 
    online, offline = gBatteries.members.partition(&:state?)

    offline_items = offline.map { |item| "#{item}: OFFLINE" }.sort

    low_batteries = online.select { |item| item.state < LOW_BATTERY_THRESHOLD }
                          .map { |item| "#{item}: #{item.state}%" }
                          .sort

    list = offline_items + low_batteries
    next if list.empty?

    email("Devices with low battery:\n\n#{list.join("\n")}", subject: "Low Battery Alert!")
  end
end

1 Like

It reappeared cause of a spam message which has been removed.