diff py/tempserver.py @ 565:26f20cee71be

emergency change sensor config add --nowait. make only look for 28- devices (ds18b20)
author Matt Johnston <matt@ucc.asn.au>
date Sun, 05 Jul 2015 00:44:05 +0800
parents c5f8375b12a2
children 08c3cf3d0ded
line wrap: on
line diff
--- a/py/tempserver.py	Sat Jun 13 22:49:14 2015 +0800
+++ b/py/tempserver.py	Sun Jul 05 00:44:05 2015 +0800
@@ -22,16 +22,17 @@
 
 
 class Tempserver(object):
-    def __init__(self, test_mode):
+    def __init__(self, test_mode, nowait):
         self.readings = []
         self.current = (None, None)
         self.fridge = None
         self._wakeup = asyncio.Event()
         self._test_mode = test_mode
+        self._nowait = nowait
 
     def __enter__(self):
         self.params = params.Params()
-        self.fridge = fridge.Fridge(self)
+        self.fridge = fridge.Fridge(self, self._nowait)
         self.uploader = uploader.Uploader(self)
         self.configwaiter = configwaiter.ConfigWaiter(self)
         self.params.load()
@@ -134,8 +135,8 @@
             level=level)
     #logging.getLogger("asyncio").setLevel(logging.DEBUG)
 
-def start(test_mode):
-    with Tempserver(test_mode) as server:
+def start(test_mode, nowait):
+    with Tempserver(test_mode, nowait) as server:
         server.run()
 
 def main():
@@ -145,6 +146,7 @@
     parser.add_argument('-D', '--daemon', action='store_true')
     parser.add_argument('-d', '--debug', action='store_true')
     parser.add_argument('-t', '--test', action='store_true')
+    parser.add_argument('--nowait', action='store_true')
     args = parser.parse_args()
 
     setup_logging(args.debug)
@@ -205,10 +207,10 @@
         logpath = os.path.join(os.path.dirname(__file__), 'tempserver.log')
         logf = open(logpath, 'a+')
         with daemon.DaemonContext(pidfile=pidf, stdout=logf, stderr = logf):
-            start(args.test)
+            start(args.test, args.nowait)
     else:
         with pidf:
-            start(args.test)
+            start(args.test, args.nowait)
 
 if __name__ == '__main__':
     main()