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
26 logger.info("Starting up...")
28 # initialize GPIO stuff
29 GPIO.setmode(GPIO.BOARD)
32 the_actor = actor.Actor()
33 the_machine = statemachine.StateMachine(the_actor, args.fallback)
34 the_socket = tysock.TySocket(the_machine)
35 the_pins = pins.PinsWatcher(the_machine)
36 the_waker = waker.Waker(the_machine)
38 # we do the socket accept thing in the main thread
41 except KeyboardInterrupt:
42 # this is what we waited for!
43 logger.info("Got SIGINT, terminating...")