just 2 share: made a small script which will notify me if battery powered devices are running low on battery
Code: Select all
return {
on = {
devices = {
'test' -- put in any manual trigger you want to do for the dives
},
timer = {
'at 20:00', -- when you want 2 run the script
}
},
logging = {
level = domoticz.LOG_INFO,
marker = 'Battery',
},
execute = function(domoticz, item)
domoticz.log("Started",domoticz.LOG_DEBUG)
domoticz.devices().forEach(function(device)
if (device.batteryLevel) then
domoticz.log("device "..device.name.." has batterylevel "..device.batteryLevel.."%",domoticz.LOG_DEBUG)
if (device.batteryLevel < 15) then -- set to whatever treshold you like
domoticz.log("Device "..device.name.." has low batterylevel ("..device.batteryLevel.."%)",domoticz.LOG_INFO) -- change notification logline to suit your needs
domoticz.notify(device.name,"Batterij moet vervangen worden ("..device.batteryLevel.."%)",domoticz.PRIORITY_NORMAL) -- change notification message to suit your needs
end
end
end)
end
}