Skip to content

Instantly share code, notes, and snippets.

@DieterKoblenz
Created September 26, 2016 11:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DieterKoblenz/15415aadf37dfbca2ac11759de32040c to your computer and use it in GitHub Desktop.
Save DieterKoblenz/15415aadf37dfbca2ac11759de32040c to your computer and use it in GitHub Desktop.
Tracking script for Homey
#!/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