chickenhouse/gate_guard/__init__.py

25 lines
435 B
Python
Raw Normal View History

2016-12-20 21:09:01 +00:00
'''
Created on Dec 19, 2016
2016-12-19 15:38:30 +00:00
2016-12-20 21:09:01 +00:00
@author: klaehn
'''
2016-12-19 15:38:30 +00:00
import time
import gate
import sys
import logging
2016-12-19 15:38:30 +00:00
2016-12-20 21:09:01 +00:00
def main():
logging.basicConfig(filename='/var/log/gate_guard.log', level=logging.DEBUG)
gate_state = gate.Gate()
2016-12-20 21:09:01 +00:00
try:
while True:
gate_state.poll()
time.sleep(0.1)
2016-12-19 15:38:30 +00:00
2016-12-20 21:09:01 +00:00
except KeyboardInterrupt:
print "key exit"
return None
2016-12-19 15:38:30 +00:00
if __name__ == "__main__":
2016-12-20 21:09:01 +00:00
sys.exit(main())