Change open_window_detection fake datapoint threshold

This commit is contained in:
Jean-Marc Collin
2023-11-28 06:20:14 +00:00
parent 6a44d0dc4a
commit 18a72bd907

View File

@@ -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