Чуть больше логирования

This commit is contained in:
ftc
2025-12-26 15:09:49 +03:00
parent ff11153b36
commit 98cad51f78
2 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -27,11 +27,13 @@ class Contour:
def check_state(self, state_value, force = False):
if self.state == state_value:
return
return False
if (self.state is None) or (time.time() - self.state_change_time > self.CHANGE_FREQ) or force:
self.state = state_value
self.state_change_time = time.time()
self.logger.info("Contour " + self.sensor_topic + " changed state to " + str(self.state))
return True
return False
def update_target(self, target_value):
self.target_value = target_value
+4 -2
View File
@@ -152,10 +152,12 @@ def check_temperatures():
target_t = c.target_value
if contour_t < target_t - hysteresis:
# should turn on contour
c.check_state(True)
if c.check_state(True):
logger.info("target: " + str(target_t) + " current: " + str(contour_t) + " hyst: " + str(hysteresis))
if contour_t > target_t + hysteresis:
# should turn off contour
c.check_state(False)
if c.check_state(False):
logger.info("target: " + str(target_t) + " current: " + str(contour_t) + " hyst: " + str(hysteresis))
if any_opened:
any_opened = False