Created
April 15, 2018 00:45
-
-
Save Katharine/cacd11abcf0e540848384299859993d7 to your computer and use it in GitHub Desktop.
A terrible, terrible script for controlling BLE switches when your BLE stack is flaky
This file contains 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/env python | |
import subprocess | |
import sys | |
import time | |
for i in xrange(5): | |
print "Attempt", i | |
try: | |
subprocess.call(["service", "bluetooth", "restart"]) | |
subprocess.check_call(["/home/pi/switchmate/switchmate.py", sys.argv[1], "none", "switch", sys.argv[2]]) | |
except: | |
time.sleep(0.1) | |
else: | |
break | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment