Loop through all devices and get battery status

Moderator: leecollings

Post Reply
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Loop through all devices and get battery status

Post 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?
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Loop through all devices and get battery status

Post 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)
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Loop through all devices and get battery status

Post 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 :)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Loop through all devices and get battery status

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Loop through all devices and get battery status

Post 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!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest