Fabrizio Guglielmino
Published

VoCore as smart sensor

A simple intrusion detection system based on VoCore

Full instructions provided14,012
VoCore as smart sensor

Things used in this project

Hardware components

VoCore v1.0
VoCore v1.0
×1
1K Ohm Resitor
×1

Story

Read more

Code

file_9316.txt

SH
1
0
0
0
0
0
0
1
1
1
0
0
1

code.txt

Python
pin = DigitalIO.get_input(GPIO0)

while True:

    read = pin.state()

    print "GPIO0 state = " + str(read)

    time.sleep(0.5)

code.txt

Python
def sendNotification(token, channel, message):

	data = {

		"body" : message,

		"message_type" : "text/plain"

	}



	req = urllib2.Request('http://api.pushetta.com/api/pushes/{0}/'.format(channel))

	req.add_header('Content-Type', 'application/json')

	req.add_header('Authorization', 'Token {0}'.format(token))



	response = urllib2.urlopen(req, json.dumps(data))

code.txt

Python
pin = DigitalIO.get_input(GPIO0)

while True:

    read = pin.state()

    if read == 0:

       print "Something move"

       # NOTE: API_KEY and MYCHANNEL name must be updated with values

       #       created in pushetta web site in the previous steps

       sendNotification("API_KEY", "MYCHANNEL", "ALARM!!! Something move")

    else:

       print "No motion" 

    time.sleep(0.5)

Github

https://github.com/guglielmino/vocore-smartsensor-pushetta

Credits

Fabrizio Guglielmino

Fabrizio Guglielmino

2 projects • 11 followers
Coder, Hacker and Maker. Author of Pushetta and many other thinks.

Comments