Created
September 26, 2016 11:16
-
-
Save DieterKoblenz/15415aadf37dfbca2ac11759de32040c to your computer and use it in GitHub Desktop.
Tracking script for Homey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import bluetooth | |
import time | |
import urllib2 | |
print "In/Out Board" | |
while True: | |
print "Checking " + time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()) | |
result = bluetooth.lookup_name('XX:XX:XX:XX:XX:XX', timeout=5) | |
if (result != None): | |
print "Jeroen: in" | |
urllib2.urlopen("http://192.168.178.XXX/api/app/com.internet/presence/home").read() | |
else: | |
print "Jeroen: out" | |
urllib2.urlopen("http://192.168.178.XXX/api/app/com.internet/presence/away").read() | |
print "Sleeping for 10" | |
time.sleep(10) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment