]> 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 4dba420893cf3d4c081d5c86f0afb616fb50d441..2adea5ae1bd0b2dca1e75cf3c85db390a3709ee4 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()