Enable/disable cameras with this Python script

Learn how to turn an Android phone into an IP camera security system with Sighthound, download automation scripts & more.

Moderator: Staff

no avatar
Posts: 12
Joined: Tue Apr 22, 2014 9:55 am

Enable/disable cameras with this Python script

by mrmisi » Fri Apr 22, 2016 11:56 am

Hey there.

I've written this little Python script to enable or disable each cameras on Sighthound by command line.

If you want to use the script you must have (obiouvsly) Python installed on your computer which Sighthound is running (but you can modify the code for enable or disable remotely).

Enable remote access on Sighthound application
Code: Select all
import os
import sys
import pycurl

port = sys.argv[1]
userpsw = sys.argv[2]
method = sys.argv[3]
camera = sys.argv[4]

url = "" + port + "/xmlrpc/"

def command():
   c = pycurl.Curl()
   c.setopt(pycurl.URL, '%s' % url)
   c.setopt(pycurl.HTTPHEADER, ["Content-type: application/xml"])
   c.setopt(pycurl.VERBOSE, 0)
   c.setopt(pycurl.USERPWD, userpsw)
   c.setopt(pycurl.POST, 1)
   c.setopt(pycurl.SSL_VERIFYPEER, False)
   c.setopt(pycurl.SSL_VERIFYHOST, False)

def errormessage():
   print "Invalid Syntax.\n\nUsage: 'Sightshell port user:password arm-or-disarm camera_name'\nExample: Sightshell 8080 frank:zappa arm bedroom"

if method != 'arm' and method != 'disarm':

if method == 'arm':
   config ='<?xml version="1.0"?><methodCall><methodName>enableCamera</methodName><params><param><value><string>' + camera + '</string></value></param><param><value><boolean>1</boolean></value></param></params></methodCall>'

if method == 'disarm':
   config ='<?xml version="1.0"?><methodCall><methodName>enableCamera</methodName><params><param><value><string>' + camera + '</string></value></param><param><value><boolean>0</boolean></value></param></params></methodCall>'

To run it, launch the command:
Code: Select all port user:password (arm or disarm) Camera_name

for example:
Code: Select all 8080 bugsbunny:carrots arm Bedroom

no avatar
Posts: 7
Joined: Mon Aug 22, 2016 11:07 am

Re: Enable/disable cameras with this Python script

by whmoorejr » Mon Aug 22, 2016 1:37 pm

Have you found any other things you can adjust using python script? Turn on/off notifications/email, etc (independently without disabling the camera)... I want it to continue to record and document events without blowing up my phone as I'm unloading groceries.

I have never used python... but the home automation program I use (indigo) does. I can fire off a python script or an applescript after any event (door opens, light turns on, etc...)

Where did you put the code?

To talk to my automation server... I have little apps (written in applescript) for each camera rule. The camera executes the app and the app updates a variable within indigo. Indigo has triggers set up that watch the variables for changes and can perform a specific action based on what the variable becomes. Example: if indigo variable SighthoundRule becomes equal to "front door motion detected", then turn on front patio light... bla bla bla

To talk to sighthound from my automation server.... python?

Anyway, I don't know exactly how you are utilizing your script examples and I could be way off target.... but I thought I'd ask.


no avatar
Posts: 1
Joined: Tue Sep 29, 2015 5:36 pm

Re: Enable/disable cameras with this Python script

by ciappi » Mon Oct 10, 2016 2:37 pm

can you help me?
i have done you wrote
install pythone

in cmd - 4999 resilece:password arm Laboratorio

4999 is my remote port

return error

(12.1 KiB) Downloaded 429 times

no avatar
Posts: 1
Joined: Mon Nov 12, 2018 4:10 am

Re: Enable/disable cameras with this Python script

by Bretterl » Mon Nov 12, 2018 4:13 am

I want to learn how can i Enable/disable cameras with Python script. I went to many websites like but i can't find working script anywhere. Then one of my best friend shared your post with me and told me that here i will surely find working python script through which i can enable/disable cameras.

Return to Hacker's Corner