Fix overpowering is set even if other heater have on_percent = 0
This commit is contained in:
@@ -1971,3 +1971,8 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
||||
"""Get now. The local datetime or the overloaded _set_now date
|
||||
This method should be replaced by the vthermAPI equivalent"""
|
||||
return VersatileThermostatAPI.get_vtherm_api(self._hass).now
|
||||
|
||||
@property
|
||||
def power_percent(self) -> float | None:
|
||||
"""Get the current on_percent value. valid only for Vtherm with a TPI algo"""
|
||||
return None
|
||||
|
||||
@@ -182,16 +182,20 @@ class CentralFeaturePowerManager(BaseFeatureManager):
|
||||
|
||||
for vtherm in vtherms_sorted:
|
||||
device_power = vtherm.power_manager.device_power
|
||||
# calculate the power_consumption_max
|
||||
if vtherm.is_device_active:
|
||||
power_consumption_max = 0
|
||||
else:
|
||||
if vtherm.is_over_climate:
|
||||
power_consumption_max = device_power
|
||||
else:
|
||||
power_consumption_max = max(
|
||||
device_power / vtherm.nb_underlying_entities,
|
||||
device_power * vtherm.proportional_algorithm.on_percent,
|
||||
)
|
||||
if vtherm.proportional_algorithm.on_percent > 0:
|
||||
power_consumption_max = max(
|
||||
device_power / vtherm.nb_underlying_entities,
|
||||
device_power * vtherm.proportional_algorithm.on_percent,
|
||||
)
|
||||
else:
|
||||
power_consumption_max = 0
|
||||
|
||||
_LOGGER.debug("vtherm %s power_consumption_max is %s (device_power=%s, overclimate=%s)", vtherm.name, power_consumption_max, device_power, vtherm.is_over_climate)
|
||||
if force_overpowering or (total_affected_power + power_consumption_max >= available_power):
|
||||
|
||||
@@ -263,6 +263,7 @@ class ThermostatOverClimateValve(ThermostatOverClimate):
|
||||
"""True if the Thermostat is regulated by valve"""
|
||||
return True
|
||||
|
||||
@overrides
|
||||
@property
|
||||
def power_percent(self) -> float | None:
|
||||
"""Get the current on_percent value"""
|
||||
|
||||
@@ -61,6 +61,7 @@ class ThermostatOverSwitch(BaseThermostat[UnderlyingSwitch]):
|
||||
"""True if the switch is inversed (for pilot wire and diode)"""
|
||||
return self._is_inversed is True
|
||||
|
||||
@overrides
|
||||
@property
|
||||
def power_percent(self) -> float | None:
|
||||
"""Get the current on_percent value"""
|
||||
|
||||
Reference in New Issue
Block a user