]> mj.ucw.cz Git - home-hw.git/blobdiff - auto/burrow-auto
Merge branch 'master' of ssh://git.ucw.cz/home/mj/GIT/home-hw
[home-hw.git] / auto / burrow-auto
index 12fd420883566b82005f6e36922679132da4fdee..47707181ad1d0a2a85e42358c328599fac8f6870 100755 (executable)
@@ -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()