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.
Ittiz
Posts: 11
Joined: Tuesday 03 January 2017 1:37
Target OS: Windows
Domoticz version:
Contact:

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

Postby Ittiz » Friday 06 January 2017 2:11

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: 612
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.5877
Location: The Netherlands
Contact:

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

Postby G3rard » Friday 06 January 2017 9:41

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
Ubuntu Server 14.04 | Domoticz v3.5877 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos | Dark th3me

Nautilus
Posts: 383
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

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

Postby Nautilus » Friday 06 January 2017 13:40

G3rard wrote:Can you please share your scripts as I have a Foscam as well


+1 :)

Ittiz
Posts: 11
Joined: Tuesday 03 January 2017 1:37
Target OS: Windows
Domoticz version:
Contact:

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

Postby Ittiz » Friday 06 January 2017 14:24

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: 383
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

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

Postby Nautilus » Tuesday 10 January 2017 11:17

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: 11
Joined: Tuesday 03 January 2017 1:37
Target OS: Windows
Domoticz version:
Contact:

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

Postby Ittiz » Thursday 19 January 2017 18:19

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.


Return to “Suggestions”

Who is online

Users browsing this forum: No registered users and 4 guests