.NET Work Blog

Project maintained by Guacam-Ole Hosted on GitHub Pages — Theme by mattgraham » en » 2016 » 1 » Switching the LED of a surveillance cam on and off using Linux

Switching the LED of a surveillance cam on and off using Linux

Published: 15.01.2016 00:00:00

Categories: linux-en - operating-systems

Tags: raspberry-pi - synology

I already wrote a script on my Raspberry that starts and stops the surveillance mode of my camera using the “Surveillance Station” on the Synology DiskStation. Now I wanted to extend that tool and light the LEDs of the cam when it is recording and turning them off if it isn’t.

This has two reasons: First: I do not want to use the cam for “secret recordings”, damaging the private spheres of my visitors. Second: I can easily see if the cam is working as expected. Now my cam has the option to activate the LEDs or deactivate from a web interface, but it is all-or-nothing. It does not depend if it is recording or not. Which isn’t a surprise as the camera does not trigger the recordings itself but this is done by the Surveillance Station.

I own (and use) the “Robocam 4”, sold by 7Links. But this hardware is quite common and used under different names, too.

Finding out the right commands is quite straight-forward: Open the webinterface and listen what happens there using the developer console in Chrome:


The “Request URL” and “Form Data” are the most interesting informations here. Before entering that stuff into the Linux-shell let’s test this with a more “comfortable” interface. The chrome extension “Postman” offers a nice way to play around with POST-Requests. The setting should be “x-www-form-urlencoded” here:



If everything works as desired it is time to put that command to Linux using shell commands. Especially easy if the come does not only accept POST-requests, but GET-requests, too.

worked like a charm in my case.

The only thing that’s left is the authentifivcation. If you receive a classic login-screen like from a .htaccess password-protection it can be easily added to the url. So

wget http://username:password@

turns on the LEDs

wget http://username:password@

turns them off

(0=off, 1=on, 2=blinking)


Just add these lines to your existing script and the LEDs should be work just like needed :)