diff --git a/custom_components/versatile_thermostat/open_window_algorithm.py b/custom_components/versatile_thermostat/open_window_algorithm.py index 267efb7..2c4c9e1 100644 --- a/custom_components/versatile_thermostat/open_window_algorithm.py +++ b/custom_components/versatile_thermostat/open_window_algorithm.py @@ -16,7 +16,7 @@ _LOGGER = logging.getLogger(__name__) MIN_DELTA_T_SEC = 0 # two temp mesure should be > 0 sec MAX_SLOPE_VALUE = 2 # slope cannot be > 2 or < -2 -> else this is an aberrant point -MAX_DURATION_SEC = 600 # a fake data point is added in the cycle if last measurement was older than 600 sec (10 min) +MAX_DURATION_MIN = 30 # a fake data point is added in the cycle if last measurement was older than 30 min MIN_NB_POINT = 4 # do not calculate slope until we have enough point @@ -46,8 +46,8 @@ class WindowOpenDetectionAlgorithm: if self._last_datetime is None: return self.add_temp_measurement(temperature, datetime_now) - delta_t_sec = float((datetime_now - self._last_datetime).total_seconds()) - if delta_t_sec >= MAX_DURATION_SEC: + delta_t_sec = float((datetime_now - self._last_datetime).total_seconds()) / 60.0 + if delta_t_sec >= MAX_DURATION_MIN: return self.add_temp_measurement(temperature, datetime_now) else: # do nothing