Page 1 of 1
Battery Level Check Script
Posted: Thursday 23 November 2017 0:48
by Brutus
I have several Battery powered Fibaro Zwave devices. I would like to know when to change the battery in time before they run out of juice. So I used the "Alternate LUA script" as provided on the Wiki page:
http://www.domoticz.com/wiki/Battery_le ... LUA_script
After inserting this in my Windows Domoticz environment and changing my email adres, Domoticz IP, json path, and the day and time so I can test the script at the given time it stops at line 30:
Code: Select all
for i,device in ipairs(devices.result) do
With error:
Code: Select all
2017-11-23 00:34:00.587 Error: EventSystem: in LUA-Batterij: [string "-- =========================================..."]:30: attempt to index global 'devices' (a nil value)
Do I miss something?
Re: Battery Level Check Script
Posted: Thursday 23 November 2017 10:33
by BakSeeDaa
Brutus wrote: ↑Thursday 23 November 2017 0:48
Do I miss something?
I'd guess you haven't configured the script properly (Domoticz = "localhost" and DomoticzPort = "8080") or that you haven't configured "Local Networks (no username/password)" properly.
Re: Battery Level Check Script
Posted: Thursday 23 November 2017 11:17
by emme
I'm using the plugin (
viewtopic.php?t=17531 ) with no big problems
except that some devices are NOT sending the right information....

Re: Battery Level Check Script
Posted: Thursday 23 November 2017 19:44
by Brutus
BakSeeDaa wrote: ↑Thursday 23 November 2017 10:33
Brutus wrote: ↑Thursday 23 November 2017 0:48
Do I miss something?
I'd guess you haven't configured the script properly (Domoticz = "localhost" and DomoticzPort = "8080") or that you haven't configured "Local Networks (no username/password)" properly.
I have used several options:
I also tested the link from the LUA script:
Code: Select all
http://192.168.1.5:8080/json.htm?type=devices&order=name
And that gives me this result in the browser:
Code: Select all
ActTime 1511462217
ServerTime "2017-11-23 19:36:57"
Sunrise "08:06"
Sunset "16:38"
result […]
status "OK"
title "Devices"
So I think there is no problem with the ip address, port or authentication.
emme wrote: ↑Thursday 23 November 2017 11:17
I'm using the plugin (
viewtopic.php?t=17531 ) with no big problems
except that some devices are NOT sending the right information....
I just installed this plugin successfully and added the corresponding devices. I'm going to monitor the levels for a couple of days.
Re: Battery Level Check Script
Posted: Saturday 28 July 2018 14:52
by Benneton
Hi,
I installed this script yesterday and got this error message back:
2018-07-28 09:01:31.192 Error: EventSystem: in Batterij_check: /home/pi/domoticz/scripts/lua/JSON.lua:660: html passed to JSON:decode(): <html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
I have no idea what is not authorized in the script JSON.lua
For local Networks no password/user needed.
ohter seetings:
BatteryThreshold = 40
WeeklySummary = true
SummaryDay = 1 -- Sunday is 1
EmailTo = "
[email protected]"
ReportHour = 9
ReportMinute = 01
Domoticz = "192.168.2.230"
DomoticzPort = "8080"
Message = ''
Domoticz version is 4.9700 stable.
Someone got any idea what I do wrong?
Bernard
Re: Battery Level Check Script
Posted: Sunday 29 July 2018 12:05
by Benneton
Hi,
This morning I received 30 e-mails, 30 times the same stating:
"Flood sensor Keuken battery level is 95%"
Checked log and see 30 entries:
2018-07-29 09:01:02.623 Status: EventSystem: Script event triggered: Batterij_check
2018-07-29 09:01:03.808 Status: LUA: Flood sensor Keuken battery level is 95%
The Flood sensor is connected via- Z-wave
No entries in the Problem log.
What I miss my RFXCom sensors and HUE sensors.
2 Hue ones
7 RFXCom connected battery powered devices
Do I need to do something special to reveive notification for Hue and RFXCom?
Also why do I receive 30 mails for the 1 sensor? 1 message will be more then sufficient
Thanks for the support,
Bernard
Re: Battery Level Check Script
Posted: Monday 30 July 2018 11:11
by Benneton
Hi,
And today, yet again 30 mails but now with 'encrypted' data:
----------------734275898421037446387058
Content-type: text/plain; charset=utf-8; format=flowed
Content-transfer-encoding: 7bit
X-CMAE-Envelope: MS4wfC7CWojMvysNEhSYBCX/oISiVqalFtnR+9ciMzbKgpc6V9DMdCrWCYMrWulJtKmCYWtnPOuVdwQMve2Tm1TIWUl1/0YWqOxPG5vApJl6j10oGpxi0t+r
2emTGn6u68SqxKSH/8pxUuKLq63wEb1b01GEVYLo0joaOiXGVa9NKtzz
No idea what I do wrong, some support greatly appreciated.
Bernard