diff py/fridge.py @ 162:d73077e8cd67

Add daemon mode with locking, add "disabled" parameter
author Matt Johnston <matt@ucc.asn.au>
date Fri, 11 Jan 2013 23:41:56 +0800
parents a6612745b4a3
children bf2a17873ba1
line wrap: on
line diff
--- a/py/fridge.py	Thu Jan 10 19:46:32 2013 +0800
+++ b/py/fridge.py	Fri Jan 11 23:41:56 2013 +0800
@@ -50,6 +50,8 @@
 
     # greenlet subclassed
     def _run(self):
+        if self.server.params.disabled:
+            L("Fridge is disabled")
         while True:
             self.do()
             gevent.sleep(config.FRIDGE_SLEEP)
@@ -71,6 +73,12 @@
             L("fridge skipping, too early")
             return
 
+        if params.disabled:
+            if self.is_on():
+                L("Disabled, turning fridge off")
+                self.off()
+            return
+
         # handle broken wort sensor
         if wort is not None:
             self.wort_valid_clock = self.server.now()