import logging, logging.handlers, os, time, queue, threading, subprocess
import traceback, smtplib
-from email.mime.text import MIMEText
+import email.mime.text, email.util
# Logging configuration
syslogLevel = logging.INFO
def sendeMail(subject, text, receivers, sender='sphinx@hacksaar.de', replyTo=None):
if not isinstance(type(receivers), list): receivers = [receivers]
# construct content
- msg = MIMEText(text.encode('UTF-8'), 'plain', 'UTF-8')
+ msg = email.mime.text.MIMEText(text.encode('UTF-8'), 'plain', 'UTF-8')
msg['Subject'] = subject
+ msg['Date'] = email.utils.formatdate(localtime=True)
msg['From'] = sender
msg['To'] = ', '.join(receivers)
if replyTo is not None:
if pins.door_locked:
return StateMachine.StateZu(self.state_machine)
def handle_cmd_unlock_event(self,callback):
- callback("409 conflict: The server is currently trying to lock the door. Try again later.")
+ callback("409 conflict: The sphinx is currently trying to lock the door. Try again later.")
def could_not_close(self):
logger.critical("StateMachine: Couldn't close door after %d tries. Going back to StateAboutToOpen." % CLOSE_REPEAT_NUMBER)
return StateMachine.StateAboutToOpen(self.state_machine)