Mercurial > code > home > repos > homeauto
comparison service/frontDoorMessage/frontDoorMessage.py @ 6:1444da5242d8
logging
Ignore-this: dd7196722e79b696b606f7b6d9930990
author | drewp@bigasterisk.com |
---|---|
date | Sun, 14 Aug 2011 22:41:14 -0700 |
parents | 6fd208b97616 |
children | 875c973febe9 |
comparison
equal
deleted
inserted
replaced
5:4c44c80a6a72 | 6:1444da5242d8 |
---|---|
1 """ | 1 """ |
2 holds the current message on the front door lcd | 2 holds the current message on the front door lcd |
3 """ | 3 """ |
4 import cyclone.web, sys | 4 import cyclone.web, sys |
5 import restkit | 5 import restkit |
6 from twisted.python import log | |
7 from twisted.internet import reactor | 6 from twisted.internet import reactor |
8 from twisted.internet.defer import inlineCallbacks | 7 from twisted.internet.defer import inlineCallbacks |
9 sys.path.append("/my/proj/homeauto/lib") | 8 sys.path.append("/my/proj/homeauto/lib") |
10 from cycloneerr import PrettyErrorHandler | 9 from cycloneerr import PrettyErrorHandler |
10 from logsetup import log | |
11 | 11 |
12 class LcdParts(object): | 12 class LcdParts(object): |
13 def __init__(self, putUrl): | 13 def __init__(self, putUrl): |
14 self.putUrl = putUrl | 14 self.putUrl = putUrl |
15 log.info("restarting- message is now empty") | |
15 self.message = "" | 16 self.message = "" |
16 self.lastLine = "" | 17 self.lastLine = "" |
17 | 18 |
18 def updateLcd(self): | 19 def updateLcd(self): |
19 whole = "%-147s%-21s" % (self.message, self.lastLine) | 20 whole = "%-147s%-21s" % (self.message, self.lastLine) |
73 'servePort' : 9081, | 74 'servePort' : 9081, |
74 } | 75 } |
75 | 76 |
76 lcdParts = LcdParts(config['frontDoorArduino'] + 'lcd') | 77 lcdParts = LcdParts(config['frontDoorArduino'] + 'lcd') |
77 | 78 |
78 log.startLogging(sys.stdout) | |
79 reactor.listenTCP(config['servePort'], Application(lcdParts)) | 79 reactor.listenTCP(config['servePort'], Application(lcdParts)) |
80 reactor.run() | 80 reactor.run() |