Page 1 of 1
Battery level info
Posted: Wednesday 13 February 2019 16:36
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
Re: Battery level info
Posted: Wednesday 13 February 2019 17:19
by waaren
Did you check
the wiki ? (search for battery) and
this post if you need more accurate readings ?
Re: Battery level info
Posted: Wednesday 13 February 2019 18:07
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

Re: Battery level info
Posted: Wednesday 13 February 2019 19:14
by multinet
Hello
You can install battery level plugin and the manipulate the level via dzvents
Re: Battery level info
Posted: Wednesday 13 February 2019 19:15
by multinet
Re: Battery level info
Posted: Wednesday 13 February 2019 21:31
by rkarolek
this plugin works only for z-wave, and i have EasyESP and mysensor nodes
Re: Battery level info
Posted: Wednesday 13 February 2019 22:33
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¶m=switchlight&idx=XXX&switchcmd=Set%20Level&"
myUrl = myUrl .. "level=" ..newBatterylevel
domoticz.openURL({
url = myUrl,
callback = "setBatterylevel"
})
end
end
}
Re: Battery level info
Posted: Saturday 16 February 2019 12:25
by rkarolek
tyvm!
it works quite nice
