X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=auto%2Fburrow-auto;h=47707181ad1d0a2a85e42358c328599fac8f6870;hb=e37b5b9c468d4c3898c2ae3affbf4165f4bf95de;hp=12fd420883566b82005f6e36922679132da4fdee;hpb=b23b1e1beedde4c0a0c057222788414053d0cc55;p=home-hw.git diff --git a/auto/burrow-auto b/auto/burrow-auto index 12fd420..4770718 100755 --- a/auto/burrow-auto +++ b/auto/burrow-auto @@ -109,13 +109,18 @@ class State: avg = None self.running_averages[key] = (history, sum, count, avg) - debug("= avg {:.6} ({} samples, {} non-null)".format(avg, len(history), count)) - if avg is not None: + if avg is None: + debug("= avg NONE ({} samples, {} non-null)".format(len(history), count)) + else: + debug("= avg {:.6} ({} samples, {} non-null)".format(avg, len(history), count)) self.set("avg/" + key, "{:.6} {}".format(avg, int(self.now))) def get_sensor_avg(self, key): val = self.running_averages[key][3] - debug("< {} = avg {:.6}".format(key, val)) + if val is None: + debug("< {} = avg NONE".format(key)) + else: + debug("< {} = avg {:.6}".format(key, val)) return val st = State() @@ -154,7 +159,7 @@ def auto_loft_fan(): def auto_circ(): global st - if st.hour in range(20, 22): + if st.hour in range(7, 24): c = 1 else: c = 0; @@ -175,6 +180,11 @@ def auto_air(): else: ac_off = st.hysteresis('ac_off', tmix, tie - 5, tie - 4) + # XXX: Temporarily disabled + house_warm = -1 + house_hot = -1 + ac_off = 1 + # Do we want to bypass the heat exchanger? outside_warmer = st.hysteresis('outside_warmer', diff(toi, tii), -0.5, 0.5) if (house_warm > 0) and (outside_warmer > 0) or \ @@ -204,7 +214,7 @@ mq = mqtt.Client() mq.on_connect = on_connect mq.on_message = on_message mq.will_set("status/auto", "dead", retain=True) -mq.connect("127.0.0.1") +mq.connect("burrow-mqtt") mq.publish("status/auto", "ok", retain=True) mq.loop_start()