Exemplo n.º 1
0
def takePicture():
	cur, con = initConn()
	id = getIdFromLastPicture(cur, con)
	idFromNextPicture = int(id) + 1
	imageName = "image" + str(idFromNextPicture) + ".jpg"
	imagePath = "/etc/scripts/img/" + imageName
	os.system('raspistill -o "%s" -w 200 -h 150' % (imagePath) )
	remotehost = '193.191.187.55'
	remotefile = '/var/www/img/'+ imageName
	os.system('scp "%s" "%s:%s"' % (imagePath, remotehost, remotefile) )
	cur, con = initConn()
	logPhoto(cur, con, idFromNextPicture)
Exemplo n.º 2
0
def takePicture():
	cur, con = initConn()
	id = getIdFromLastPicture(cur, con)
	idFromNextPicture = int(id) + 1
	imageName = "image" + str(idFromNextPicture) + ".jpg"
	imagePath = "./img/" + imageName
	GPIO.output(camera_led_pin, True)
	sleep(5)        
	#os.system('raspistill -o "%s" -w 200 -h 150' % (imagePath) )
	GPIO.output(camera_led_pin, False)
	remotehost = '193.191.187.55'
	remotefile = '/var/www/img/'+ imageName
	os.system('scp "%s" "%s:%s"' % (imagePath, remotehost, remotefile) )
	cur, con = initConn()
	logPhoto(cur, con, idFromNextPicture)
Exemplo n.º 3
0
def safeSequence():
	cur, conn = initConn()
	print("Someone opened the safe, logging to db, sending notification... \n")
	logAlarm(cur, conn, "The safe just opened!")
	notify("Someone opened the safe", "2")
	playAlarm()
	GPIO.output(motor_pin, True)
	sleep(2)
	GPIO.output(motor_pin, False)
Exemplo n.º 4
0
def doorSequence():
	cur, conn = initConn()
	logAlarm(cur, conn, 'Door opened while alarm is active')	
	print("Intruder detected, door opened")
	playAlarm()
Exemplo n.º 5
0
def pressurePlateSequence():
	cur, conn = initConn()
	print("Someone on pressure plate, logging to db, photo uploading... \n")
	logAlarm(cur, conn, "Someone on pressure plate, photo uploading...")
	takePicture()
Exemplo n.º 6
0
from logToDb import initConn as initConn
from logToDb import logAlarm as logAlarm

cur, conn = initConn()
logAlarm(cur, conn, 'door opened')
cur, conn = initConn()
logAlarm(cur, conn, 'safe opened')
cur, conn = initConn()
logAlarm(cur, conn, 'pressure plate triggered')