diff py/fridge.py @ 145:6517ddee3187

few more bits
author Matt Johnston <matt@ucc.asn.au>
date Thu, 29 Nov 2012 23:50:40 +0800
parents 482d7852b511
children b32e5a11a4cb
line wrap: on
line diff
--- a/py/fridge.py	Mon Nov 26 23:21:03 2012 +0800
+++ b/py/fridge.py	Thu Nov 29 23:50:40 2012 +0800
@@ -19,7 +19,7 @@
 
     def setup_gpio(self):
         dir_fn = '%s/direction' % config.FRIDGE_GPIO
-        with f = open(dir_fn, 'w'):
+        with open(dir_fn, 'w') as f:
             f.write('low')
         val_fn = '%s/value' % config.FRIDGE_GPIO
         self.value_file = f.open(val_fn, 'r+')
@@ -54,10 +54,12 @@
             self.do()
             gevent.sleep(config.FRIDGE_SLEEP)
 
-    def do(self)
+    def do(self):
         """ this is the main fridge control logic """
         wort, fridge = self.server.current_temps()
 
+        params = self.server.params
+
         fridge_min = params.fridge_setpoint - self.FRIDGE_AIR_MIN_RANGE
         fridge_max = params.fridge_setpoint + self.FRIDGE_AIR_MAX_RANGE