# HG changeset patch # User Matt Johnston # Date 1361201492 -28800 # Node ID 5d5424acfed016fefa3339b31a10f9b248e0550d # Parent bf2a17873ba13086c1224d1ab012803e611a4f37 - use the fridge temperature for control too, keep it in a 6deg band - ignore params beginning with _ diff -r bf2a17873ba1 -r 5d5424acfed0 py/fridge.py --- a/py/fridge.py Sat Jan 12 21:54:55 2013 +0800 +++ b/py/fridge.py Mon Feb 18 23:31:32 2013 +0800 @@ -6,8 +6,8 @@ class Fridge(gevent.Greenlet): OVERSHOOT_MAX_DIV = 1800.0 # 30 mins - FRIDGE_AIR_MIN_RANGE = 4 # ºC - FRIDGE_AIR_MAX_RANGE = 4 + FRIDGE_AIR_MIN_RANGE = 3 # ºC + FRIDGE_AIR_MAX_RANGE = 3 def __init__(self, server): gevent.Greenlet.__init__(self) @@ -65,6 +65,7 @@ fridge_min = params.fridge_setpoint - self.FRIDGE_AIR_MIN_RANGE fridge_max = params.fridge_setpoint + self.FRIDGE_AIR_MAX_RANGE + wort_min = params.fridge_setpoint wort_max = params.fridge_setpoint + params.fridge_difference off_time = self.server.now() - self.fridge_off_clock @@ -103,14 +104,11 @@ / self.OVERSHOOT_MAX_DIV D("on_time %(on_time)f, overshoot %(overshoot)f" % locals()) - if wort is not None: - if (wort - overshoot) < params.fridge_setpoint: - L("wort has cooled enough") + if wort is not None and (wort - overshoot) < params.fridge_setpoint: + L("wort has cooled enough, %(wort)f" % locals() ) turn_off = True - else: - # wort sensor is broken - if fridge is not None and fridge < fridge_min: - W("fridge off fallback") + elif fridge is not None and fridge < fridge_min: + W("fridge off fallback, fridge %(fridge)f, min %(fridge_min)f" % locals()) turn_off = True if turn_off: @@ -121,14 +119,11 @@ else: # fridge is off turn_on = False - if wort is not None: - if wort >= wort_max: + if wort is not None and wort >= wort_max: L("Wort is too hot %f, max %f" % (wort, wort_max)) turn_on = True - else: - # wort sensor is broken - if fridge is not None and fridge >= fridge_max: - W("frdge on fallback") + elif fridge is not None and fridge >= fridge_max: + W("frdge on fallback, fridge %(fridge)f, max %(fridge_max)f" % locals()) turn_on = True if turn_on: diff -r bf2a17873ba1 -r 5d5424acfed0 py/params.py --- a/py/params.py Sat Jan 12 21:54:55 2013 +0800 +++ b/py/params.py Mon Feb 18 23:31:32 2013 +0800 @@ -46,6 +46,8 @@ raise self.Error(e) for k in u: + if k.startswith('_'): + continue if k not in self: raise self.Error("Unknown parameter %s=%s in file '%s'" % (str(k), str(u[k]), getattr(f, 'name', '???'))) self.update(u)