2 import RPi.GPIO as GPIO
3 import statemachine, actor, pins, tysock, waker
4 from libtuer import logger
8 parser = argparse.ArgumentParser(description='Run a door')
9 parser.add_argument("-d", "--debug",
10 action="store_true", dest="debug",
11 help="Don't send emails")
12 parser.add_argument("-f", "--fallback",
13 action="store_true", dest="fallback",
14 help="Fallback mode for unfunctional hardware: Depend on less sensor input")
15 args = parser.parse_args()
18 libtuer.mailAddress = []
20 logger.info("Starting in fallback mode")
22 # to avoid exceptions or getting None
25 # initialize GPIO stuff
26 GPIO.setmode(GPIO.BOARD)
29 the_actor = actor.Actor()
30 the_machine = statemachine.StateMachine(the_actor, args.fallback)
31 the_socket = tysock.TySocket(the_machine)
32 the_pins = pins.PinsWatcher(the_machine)
33 the_waker = waker.Waker(the_machine)
35 # we do the socket accept thing in the main thread
38 except KeyboardInterrupt:
39 # this is what we waited for!
40 logger.info("Got SIGINT, terminating...")