Page 1 of 1
More functionality needed with the LUA parser for HTTP/HTTPS Poller
Posted: Friday 06 January 2017 1:11
by Ittiz
So I like the new HTTP/HTTPS poller. I'm using it to act as a motion and sound sensor for my foscams. However, the input data seems to be extremely limited. If I want to update the status of a device based on the data fetched I pretty much have to do it every single time the cam is polled, even if there is no new data. This creates a very messy log and isn't acceptable for something that will generate a message every time it's triggered. I'd like to do something like get data from another device or sensor and then decide whether I'd like to update the status or not. Basically, it'd be nice if we had access to all the functionality (globals ect...) we have with regular LUA scripts in Domoticz.
More functionality needed with the LUA parser for HTTP/HTTPS Poller
Posted: Friday 06 January 2017 8:41
by G3rard
I had the same request and the developer of the poller has implemented this. It is available since about 2 weeks in the beta versions.
https://github.com/domoticz/domoticz/pull/626
https://github.com/domoticz/domoticz/pull/1047
Can you please share your scripts as I have a Foscam as well

Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller
Posted: Friday 06 January 2017 12:40
by Nautilus
G3rard wrote:
Can you please share your scripts as I have a Foscam as well

+1

Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller
Posted: Friday 06 January 2017 13:24
by Ittiz
That's great, any clue to when this might get past beta? I'd prefer to run the stable version. Below is the code I have at the moment, pretty simple for now. I use a pollers that poll my cams at:
HTTP://<Cam IP Addy>:<Port #>/cgi-bin/CGIProxy.fcgi?&usr=<User>&pwd=<Password>&cmd=getDevState every 10 seconds
Code: Select all
-- Retrieve the request content
s = request['content'];
-- Get the device Statuses. 2=alarm, 1=no alarm, 0=disabled.
local motionalert = domoticz_applyXPath(s,'//CGI_Result/motionDetectAlarm/text()')
local soundalert = domoticz_applyXPath(s,'//CGI_Result/soundAlarm/text()')
-- Quick cheap fix to status values
motionalert = motionalert - 1
soundalert = soundalert - 1
-- Apply status value to devices
domoticz_updateDevice(20,motionalert,"0")
domoticz_updateDevice(21,soundalert,"0")
Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller
Posted: Tuesday 10 January 2017 10:17
by Nautilus
Thanks, tested and got it working
Just got me thinking that if we poll the camera every 10 seconds, won't it create quite a bit of strain to both the camera itself, Domoticz (especially if multiple cameras) and the local network? Cannot understand why Foscam took away the possibility to call url from the "new" cameras...

Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller
Posted: Thursday 19 January 2017 17:19
by Ittiz
10 seconds doesn't seem to cause much of an issue on my network and I have 4 cams. The text that is being transferred is pretty small. If you're worried to can space it out more like 30 seconds or something. But yeah it'd be nice if Foscam had kept the ability for the camera to do an HTTP request upon motion detection.
Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller
Posted: Friday 16 February 2018 11:48
by felix63
Hi,
Could you share your poller settings? Perhaps a screen print? I also have some Foscam's Cameras.
Thanks!