From 9a4d822d107dcece0802b183ee5fdba2ec20a85e Mon Sep 17 00:00:00 2001 From: Alex Wijnholds Date: Wed, 17 May 2023 01:28:47 +0200 Subject: [PATCH] Optimize the relative modulation when the boiler is basically off --- custom_components/sat/climate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/sat/climate.py b/custom_components/sat/climate.py index a463d78a..423a3324 100644 --- a/custom_components/sat/climate.py +++ b/custom_components/sat/climate.py @@ -566,10 +566,10 @@ def pulse_width_modulation_enabled(self) -> bool: @property def relative_modulation_enabled(self): """Return True if relative modulation is enabled, False otherwise.""" - if not self._coordinator.support_relative_modulation_management: + if not self._coordinator.support_relative_modulation_management or self._setpoint is None: return False - if self._coordinator.hot_water_active: + if self._coordinator.hot_water_active or self._setpoint <= MINIMUM_SETPOINT: return True return self.hvac_mode == HVACMode.HEAT and not self.pulse_width_modulation_enabled @@ -736,12 +736,12 @@ async def _async_control_heating_loop(self, _time=None) -> None: # Pulse Width Modulation await self._pwm.update(self._get_requested_setpoint(), self._coordinator.minimum_setpoint) - # Set the relative modulation value, if supported - await self._async_control_relative_modulation() - # Set the control setpoint to make sure we always stay in control await self._async_control_setpoint(self._pwm.state) + # Set the relative modulation value, if supported + await self._async_control_relative_modulation() + # Control the integral (if exceeded the time limit) self._pid.update_integral(self.max_error, self._heating_curve.value)