Баг с определением "открыт ли какой-нибудь контур в течение N времени"

This commit is contained in:
ftc
2025-12-14 15:53:02 +03:00
parent 8f35d368e6
commit 7f300ddc2c
+4 -2
View File
@@ -161,15 +161,17 @@ def check_temperatures():
mqtt_client.publish(c.out_topic, "1", retain=True) mqtt_client.publish(c.out_topic, "1", retain=True)
if any_opened: if any_opened:
for c in contours:
if not c.state:
any_opened = False any_opened = False
for c in contours:
if c.state:
any_opened = True
else: else:
for c in contours: for c in contours:
if c.state: if c.state:
any_opened = True any_opened = True
any_opened_start = time.time() any_opened_start = time.time()
logger.debug("Any opened: " + str(any_opened) + " aos " + str(any_opened_start) + " time " + str(time.time()))
if any_opened and time.time() - any_opened_start > BOILER_TURN_ON_AFTER: if any_opened and time.time() - any_opened_start > BOILER_TURN_ON_AFTER:
mqtt_client.publish(boiler_control, "1", retain=True) mqtt_client.publish(boiler_control, "1", retain=True)
mqtt_client.publish(pump_control, "1", retain=True) mqtt_client.publish(pump_control, "1", retain=True)