Basic luup codes to get http.

Hey there newbey at the helm. I have tried searching the forum and can’t seem to understand how to simply request a http. I have read the 3 methods on the wiki but I haven’t used code before doesn’t really make sense how to do it. I’m trying to add this httpto a scene via luup. Iv tried

http.request/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=<.>&pwd=<.>

This code turns my ip cam off and I have another one to turn it on. Sorry as this is probably a stupid question but have to start somewhere.

Simplest thing to try is luup.inet.wget, as per here [url=http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#Module:_luup.inet]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#Module:_luup.inet[/url].

So something like

luup.inet.wget "<myip>/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=<.>&pwd=<.>"

…might do what you need.

Thanks Akbooer, works a treat :slight_smile: now when I Lock and unlock my house the Web cam turns on and off with motion detection. Web cam foscam fi9831

Hey again, just wondering with that lupp code if I could add a delay before it is actioned. Like wait 30 seconds then send the lupp code to the Web cam so I can exit the door?

Well, that would be something like:

function my_scene_delay1 ()
  luup.inet.wget "<myip>/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=<.>&pwd=<.>"
end

luup.call_delay ("my_scene_delay1", 30)

akbooer.
Awesome job :slight_smile: worked straight away. I wasn’t adding the (my scene delay) and just trying something completely wrong using U5 code and this saved me many hours. Just made my night cheers.

Can anyone help with a POST with a JSON object? I cannot seem to escape this correctly:

curl command:

curl -X POST -H "Content-Type: application/json" -d '{"value1":"97","value2":"99","value3":"88"}' https://thisiswheremyapikeygoes/key/triggerkeygoeshere