EasyN IP Camera, Motion Detection and Foscam Plugin

I bought a EasyN IP outdoor camera (easyn-hs-691a-a105) and trying to integrate with my VeraLite.

It appears to be a affiliated to Foscam, since the support page links to Foscam

I have snapshot working by using the following URL //camera-ip/tmpfs/snap.jpg

I am trying to get motion detection working. I downloaded the XML plugin (v2.2) file for Foscam and trying to make changes on it to make it work with EasyN.

I changed the this piece of code from

if (lug_path == “”) then
luup.variable_set(CAM_SID, “URL”, “/snapshot.cgi”, lul_device)
end

if (lug_path == “”) then
luup.variable_set(CAM_SID, “URL”, “/tmpfs/snap.jpg”, lul_device)
end

On the motion detection piece of the code, I see the following lines

local status = luup.inet.wget(“http://”… lug_ip …“/set_alarm.cgi?motion_armed=1&http=1&http_url=”… urlEncode(url) …“&user=”… lug_username …“&pwd=”… lug_password, 5)

How does this enable motion detection or is it checking the MD status or what does this piece of code do?

I enabled motion detection directly on the camera and monitored the request via chrome tools and found HTTP POST requests to set MD parameters. I am thinking, if I can build the POST request correctly in luup I could get it work. Appreciate help/thoughts.