More functionality needed with the LUA parser for HTTP/HTTPS Poller

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
Ittiz
Posts: 48
Joined: Tuesday 03 January 2017 0:37
Target OS: Linux
Domoticz version: 13939
Location: USA
Contact:

More functionality needed with the LUA parser for HTTP/HTTPS Poller

Post 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.
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

More functionality needed with the LUA parser for HTTP/HTTPS Poller

Post 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 Image
Not using Domoticz anymore
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller

Post by Nautilus »

G3rard wrote: Can you please share your scripts as I have a Foscam as well Image
+1 :)
Ittiz
Posts: 48
Joined: Tuesday 03 January 2017 0:37
Target OS: Linux
Domoticz version: 13939
Location: USA
Contact:

Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller

Post 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")
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller

Post 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... :(
Ittiz
Posts: 48
Joined: Tuesday 03 January 2017 0:37
Target OS: Linux
Domoticz version: 13939
Location: USA
Contact:

Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller

Post 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.
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: More functionality needed with the LUA parser for HTTP/HTTPS Poller

Post by felix63 »

Hi,

Could you share your poller settings? Perhaps a screen print? I also have some Foscam's Cameras.

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest