help strings for commands
[saartuer.git] / tuerd
1 #!/usr/bin/python3
2 import RPi.GPIO as GPIO
3 import statemachine, actor, pins, tysock, waker
4 from libtuer import logger
5 import argparse
6 # TODO: implement some arguments, e.g. --debug which does not send e-mails and prints debug stuff
7
8 # initialize GPIO stuff
9 GPIO.setmode(GPIO.BOARD)
10
11 # bring 'em all up
12 the_actor = actor.Actor()
13 the_machine = statemachine.StateMachine(the_actor)
14 the_socket = tysock.TySocket(the_machine)
15 the_pins = pins.PinsWatcher(the_machine)
16 the_waker = waker.Waker(the_machine)
17
18 # we do the socket accept thing in the main thread
19 try:
20         the_socket.accept()
21 except KeyboardInterrupt:
22         # this is what we waited for!
23         logger.info("Got SIGINT, terminating...")
24         pass
25
26 # bring 'em all down
27 the_waker.stop()
28 the_pins.stop()
29 the_machine.stop()
30 the_actor.stop()
31
32 # shutdown GPIO stuff
33 GPIO.cleanup()