Tuesday, May 14, 2013

Remotely Disable/Enable IR on FOSCAM MJPEG Cameras

FOSCAM cameras are generally a good value. You get a decent set of features and performance for the price. The one important feature they lack, however, is a permanent or default setting to disable the IR lights. This is useful when you're mounting the camera behind a window pane, for example, and don't want the IR reflection from the glass.

Fortunately, the camera allows you to pass commands to it via HTTP. The two we're interested in are:
http://<Camera IP or URL>/decoder_control.cgi?command=94 to disable IR and
http://<Camera IP or URL>/decoder_control.cgi?command=95 to enable IR.

This comes in handy because this means we can set up a task in Task Scheduler (on a machine running Windows) to periodically send a command to the camera to disable its IR lights (in case the camera has rebooted).

One way to send an HTTP request in Task Scheduler is to use PowerShell:
powershell -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadString(\"http://<Camera IP>/decoder_control.cgi?command=94"&"user=admin"&"pwd=\")"

The above assumes that your camera uses the default "admin" account with a blank password. Of course, you should replace <Camera IP> with your camera's actual IP address.