diff --git a/contour.py b/contour.py index 355d05a..bd0d36d 100644 --- a/contour.py +++ b/contour.py @@ -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 diff --git a/heat_control.py b/heat_control.py index 8966846..8c1a5e5 100755 --- a/heat_control.py +++ b/heat_control.py @@ -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