From 96076bf7c288a2e47a7fe47755f78f09229787d4 Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Sun, 12 Nov 2023 17:44:02 +0000 Subject: [PATCH] Change the auto-regulation last calculation Change auto-window detection to 30 sec of delay --- custom_components/versatile_thermostat/open_window_algorithm.py | 2 +- custom_components/versatile_thermostat/thermostat_climate.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/versatile_thermostat/open_window_algorithm.py b/custom_components/versatile_thermostat/open_window_algorithm.py index 27bc635..1e61f20 100644 --- a/custom_components/versatile_thermostat/open_window_algorithm.py +++ b/custom_components/versatile_thermostat/open_window_algorithm.py @@ -12,7 +12,7 @@ from datetime import datetime _LOGGER = logging.getLogger(__name__) # To filter bad values -MIN_DELTA_T_SEC = 10 # two temp mesure should be > 10 sec +MIN_DELTA_T_SEC = 30 # two temp mesure should be > 10 sec MAX_SLOPE_VALUE = 2 # slope cannot be > 2 or < -2 -> else this is an aberrant point diff --git a/custom_components/versatile_thermostat/thermostat_climate.py b/custom_components/versatile_thermostat/thermostat_climate.py index 9a52bb3..a8dcc68 100644 --- a/custom_components/versatile_thermostat/thermostat_climate.py +++ b/custom_components/versatile_thermostat/thermostat_climate.py @@ -130,6 +130,7 @@ class ThermostatOverClimate(BaseThermostat): self._regulated_target_temp = self.target_temperature _LOGGER.info("%s - regulation calculation will be done", self) + self._last_regulation_change = now new_regulated_temp = round_to_nearest( self._regulation_algo.calculate_regulated_temperature( @@ -154,7 +155,6 @@ class ThermostatOverClimate(BaseThermostat): self, new_regulated_temp, ) - self._last_regulation_change = now for under in self._underlyings: await under.set_temperature(