Battery level info

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
rkarolek
Posts: 33
Joined: Friday 31 August 2018 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Battery level info

Post by rkarolek »

hi
I have some battery devices conected to domoticz, they report info about battery and radio level.
Is it possible to get info about those lvl to set alarm or using them in scripts in other way?

ty in advance
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Battery level info

Post by waaren »

Did you check the wiki ? (search for battery) and this post if you need more accurate readings ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
rkarolek
Posts: 33
Joined: Friday 31 August 2018 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Battery level info

Post by rkarolek »

yes, but i cant understand how i read this battery lvl :(
i try

Code: Select all

local test = domoticz.devices('test_ds').batteryLevel
but w/o success, so im really dont have idea how i can read batterylevel device's test_ds :(
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Battery level info

Post by multinet »

Hello

You can install battery level plugin and the manipulate the level via dzvents
PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Battery level info

Post by multinet »

PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
rkarolek
Posts: 33
Joined: Friday 31 August 2018 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Battery level info

Post by rkarolek »

this plugin works only for z-wave, and i have EasyESP and mysensor nodes
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Battery level info

Post by hoeby »

I am running this script for getting the battery status and set it to a dummy
Using it for a Xiaomi device, which has the battery inside its open/close status.
Now i can use it for other scripts on each value it has.

you need to fill in IP-address and IDX number of the dummy
I am running json for a local set a local dummy. I should be changing it to a local command and not json.
But it works and at the moment i am working on other things that i still didn't changed it.

Code: Select all

--[[ 
   updateBatterylevel
]] --

return {
	on = { 
		devices = { 'Garage poort'} , 
        	timer = { 'at 10:00' },      
        	httpResponses = { 'setBatterylevel' }
    },
	
    execute = function(domoticz, trigger)
	local debug = true
        function debug_print(myLine)
        	if debug then print("***** updateBatterylevel ****** "  .. myLine) end
        end
	
	if trigger.isHTTPResponse then
		if (trigger.ok) then -- statusCode == 2xx
               		local setting = trigger.json.status
         	end
	else
          	local batteryDevice = domoticz.devices("Garage poort")
         	local newBatterylevel = batteryDevice.batteryLevel
        	
        	local myUrl           = "http://xxx.xxx.xxx.xxx:xxxx/json.htm?type=command&param=switchlight&idx=XXX&switchcmd=Set%20Level&"
        	myUrl = myUrl .. "level=" ..newBatterylevel
              
               domoticz.openURL({
                	url = myUrl,
                    callback = "setBatterylevel"
            	})
        end
    end
}
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
rkarolek
Posts: 33
Joined: Friday 31 August 2018 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Battery level info

Post by rkarolek »

tyvm!
it works quite nice :)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest