diff --git a/shroom_controller.py b/shroom_controller.py index a522934..0599e6f 100644 --- a/shroom_controller.py +++ b/shroom_controller.py @@ -10,7 +10,7 @@ import time SERIAL_PATH = "/dev/ttyACM0" SERIAL_BAUD = 115200 -SAMPLE_PERIOD = 0.2 +SAMPLE_PERIOD = 0.5 DECIMATION_RATE = 1 try: @@ -137,7 +137,7 @@ class Humidifier: # the wiring's a little different so the thresholds for detecting on/off are inverted but hopefully a lot more reliable than the original class HumidifierV2: - def __init__(self, toggle_cmd=b"i"): + def __init__(self, toggle_cmd=b"i", humidifier_id="humdifier2"): self.on_threshold = 1.5 self.off_threshold = 2.5 self.toggle_cooldown = 7 @@ -159,7 +159,7 @@ class HumidifierV2: print("send hum 2 on") else: print("send hum 2 off") - send_update({"status": {"humidifier2": nv}}) + send_update({"status": {humdifier_id: nv}}) @property def off(self): @@ -253,7 +253,7 @@ class Controller: if humidifier2.on: self.toggle_checked(humidifier2, s) -humidifier = HumidifierV2(b"h") +humidifier = HumidifierV2(b"h", "humdifier") humidifier2 = HumidifierV2() controller = Controller()