# Mail logging handler
def sendeMail(subject, text, receivers, sender='sphinx@hacksaar.de', replyTo=None):
- if not isinstance(type(receivers), list): receivers = [receivers]
+ assert isinstance(receivers, list)
+ if not len(receivers): return # nothing to do
# construct content
msg = email.mime.text.MIMEText(text.encode('UTF-8'), 'plain', 'UTF-8')
msg['Subject'] = subject
import statemachine, actor, pins, tysock, waker
from libtuer import logger
import argparse
-# TODO: implement some arguments, e.g. --debug which does not send e-mails and prints debug stuff
+
+# Parse arguments
+parser = argparse.ArgumentParser(description='Run a door')
+parser.add_argument("-d", "--debug",
+ action="store_true", dest="debug",
+ help="Don't send emails")
+args = parser.parse_args()
+if args.debug:
+ import libtuer
+ libtuer.mailAddress = []
# initialize GPIO stuff
GPIO.setmode(GPIO.BOARD)