Page 1 of 1
Loop through all devices and get battery status
Posted: Friday 02 August 2019 23:08
by Plantje
Not sure what the best scripting language is to do this, but what I am basically looking for is to create a simple script that loops through all devices. For all battery operated sensors I then want to check the battery level and in case below x% send me a message containing the name of the sensor and the battery level.
Something like that...
All I have found now, is that you can loopt through a list of named devices. Can it be done the other way around as well?
Re: Loop through all devices and get battery status
Posted: Saturday 03 August 2019 6:56
by hoeby
Isn't that default made in domoticz?
In system settings --> other you can fill in a low battery value.
When reached this value, you get a notification. Of course you have to programmed a notification option
(In Dutch te location is: Instellingen-->overige)
Re: Loop through all devices and get battery status
Posted: Saturday 03 August 2019 11:19
by Plantje
Ah, ok, thanks!
I did find the setting...
hoeby wrote: ↑Saturday 03 August 2019 6:56
Of course you have to programmed a notification option
What do you mean with this?
I also found this one:
https://www.domoticz.com/wiki/Battery_level_check Perhaps I can use the LUA script from there (it seems to be the most straight forward)
And while looping through devices I may also be able to raise an alert if a device hasn't reported for x hours. I have quite some sensors and I cannot pro actively check the status of all of them on a daily basis. But it would also suck if my house burns down, because a smoke detector didn't report to Domoticz for quite a while

Re: Loop through all devices and get battery status
Posted: Saturday 03 August 2019 12:40
by waaren
Plantje wrote: ↑Friday 02 August 2019 23:08
Not sure what the best scripting language is to do this, but what I am basically looking for is to create a simple script that loops through all devices. For all battery operated sensors I then want to check the battery level and in case below x% send me a message containing the name of the sensor and the battery level.
Have you looked at the examples in <domoticz dir>/scripts/dzVents/examples/ ? There is an almost ready example for battery level check coded in dzVents.
Re: Loop through all devices and get battery status
Posted: Saturday 03 August 2019 13:00
by Plantje
No, I had not looked there as I hadn't yet decided what scripts I wanted to use.
Found this one:
https://www.domoticz.com/forum/viewtopi ... ry#p208493
That seems to cover way more than I was looking for. But I will see if I can get this to work. If I start working with it I can ask more specific questions. Thanks!