FOSCAM FI8910W - LUUP ON/OFF

Hi,

I have a FOSCAM FI8910W and everything is working ok. I created a multiswitch button to turn ON and OFF the motion and sound detection via LUUP CODE.

This is the code I am using:

luup.inet.wget('http://192.168.1.11:8090/set_alarm.cgi?motion_armed=1&user=admin&pwd=xxxx')
luup.inet.wget('http://192.168.1.11:8090/set_alarm.cgi?sounddetect_armed=1&user=admin&pwd=xxxx')

1= ON and 0 = OFF

I am trying to control the motion and sound sensitivity in the same LUUP code and tried the following but it entered in a loop and the sensors turn on and off, so I had to go back and only turn them on and off.

luup.inet.wget('http://192.168.1.11:8090/set_alarm.cgi?motion_armed=1&user=admin&pwd=xxxxx')
luup.inet.wget('http://192.168.1.11:8090/set_alarm.cgi?motion_sensitivity=7&user=admin&pwd=xxxxx')

luup.inet.wget('http://192.168.1.11:8090/set_alarm.cgi?sounddetect_armed=1&user=admin&pwd=xxxxx')
luup.inet.wget('http://192.168.1.11:8090/set_alarm.cgi?sounddetect_sensitivity=7&user=admin&pwd=xxxx')

ANY HELP on how to create both commands in the same LUUP?

Have you tried setting the sensitivity first and then arming them? Perhaps with a 5 second delay between each command to give the camera time o process it?

Nope, havn’t tried anything besides this. I really don’t know how to work with luup, I just found this code on the forum and replaced the variables and it worked fine, but don’t really know how to do delays, etc.

Make sure this is at the top of your code

local http = require(“socket.http”)

Try inserting below between each of the luup.init.wget lines in your code.

http.TIMEOUT = 5

Thanks BOFH…it worked perfectly!!!

Great to hear. You can play with the value for the http.timeout (which is seconds) if you have time criticality. Try reducing them to eg 4 or 3 or 2 or even 1 and see if everything still works. If it breaks, add 1 second and that should be your sweet spot. :smiley: