From 3da271b671eb692756645b21ac1897bf377dd96e Mon Sep 17 00:00:00 2001 From: John Kozyrakis Date: Sat, 20 Jan 2024 05:46:23 +0000 Subject: [PATCH] Set the last regulation timestamp only when regulation is sent to thermostats (#351) Fixes a small issue where `_last_regulation_change` is being set to `now` even though the new temperature is not sent to the thermostats (because `abs(dtemp) < self._auto_regulation_dtemp:`) --- custom_components/versatile_thermostat/thermostat_climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/versatile_thermostat/thermostat_climate.py b/custom_components/versatile_thermostat/thermostat_climate.py index b0f09bb..74dad0e 100644 --- a/custom_components/versatile_thermostat/thermostat_climate.py +++ b/custom_components/versatile_thermostat/thermostat_climate.py @@ -162,7 +162,6 @@ 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( @@ -188,6 +187,7 @@ class ThermostatOverClimate(BaseThermostat): new_regulated_temp, ) + self._last_regulation_change = now for under in self._underlyings: await under.set_temperature( self.regulated_target_temp, self._attr_max_temp, self._attr_min_temp