how to set a GET CGI command to Foscam Camera

Posted on
Thu Mar 16, 2023 10:41 am
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

how to set a GET CGI command to Foscam Camera

I am looking for a way to sent the following command to a Foscam Camera.
Based on triggers I want to activate recording and also stop recording.

The command which makes it possible is as follows (it is GET command)

Code: Select all
http://IP address port/cgi-bin/CGIProxy.fcgi?cmd=setScheduleRecordConfig&isEnable=1&recordLevel=0&spaceFullMode=0&isEnableAudio=0&schedule0=1023&schedule1=1023&
schedule2=1023&schedule3=1023&schedule4=1023&schedule5=1023&schedule6=1023&usr=xxx&pwd=xxx


How can I sent this command from out Indigodomo to the camera?

Looking forward to a reply

Posted on
Fri Mar 17, 2023 3:41 am
neilk offline
Posts: 715
Joined: Jul 13, 2015
Location: Reading, UK

Re: how to set a GET CGI command to Foscam Camera

I don't use that command, but I use what I think is the same API to move a PTZ camera to "home" and "away" presets. Create a script

Code: Select all
#!/usr/bin/env sh
curl  "http://IP address port/cgi-bin/CGIProxy.fcgi?cmd=setScheduleRecordConfig&isEnable=1&recordLevel=0&spaceFullMode=0&isEnableAudio=0&schedule0=1023&schedule1=1023&
schedule2=1023&schedule3=1023&schedule4=1023&schedule5=1023&schedule6=1023&usr=xxx&pwd=xxx"


I have a folder in the account home directory for the account that runs Indigo to add such scripts. You will also need to make the script executable, take a look at https://support.apple.com/en-gb/guide/terminal/apdd100908f-06b3-4e63-8a87-32e71241bab4/mac if that is confusing (and also try running it and make sure it works as in the example).

Once created and tested it can be run (in this case in an action group)

Screenshot 2023-03-17 at 09.33.59.png
Screenshot 2023-03-17 at 09.33.59.png (52.36 KiB) Viewed 1028 times

Posted on
Fri Mar 17, 2023 9:14 am
jay (support) offline
Site Admin
User avatar
Posts: 18223
Joined: Mar 19, 2008
Location: Austin, Texas

Re: how to set a GET CGI command to Foscam Camera

Another option is the Execute Script command. Use the following Python script:

Code: Select all
query_args = {
    "cmd": "setScheduleRecordConfig",
    "isEnable": 1,
    "recordLevel": 0,
    "spaceFullMode": 0,
    "isEnableAudio": 0,
    "schedule0": 1023,
    "schedule1": 1023,
    "schedule2": 1023,
    "schedule3": 1023,
    "schedule4": 1023,
    "schedule5": 1023,
    "schedule6": 1023,
    "user": "XXX",
    "pwd": "XXX"
}
url = "http://IP_address:port/cgi-bin/CGIProxy.fcgi"
requests.get(url, params=query_args, timeout=5)


Note that you can add/remove/change query args from the dictionary as necessary. Since this is an Indigo script, you can also get values from a variable or a device and pass those in the query args as well. You definitely want to put a short timeout (like the 5 second one above) in since this is running as an embedded script. If your script needs to wait longer than 10 seconds, then you'll need to make it an external script (Indigo kills embedded scripts that run longer than 10 seconds).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Mar 20, 2023 3:30 am
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

Re: how to set a GET CGI command to Foscam Camera

Perfect thx

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 7 guests