Fix humidifier status code and adjust rate to 2SPS from 5SPS
This commit is contained in:
parent
85a85f6588
commit
e0cc31794b
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue