diff --git a/custom_components/eldom/eldom_boiler.py b/custom_components/eldom/eldom_boiler.py index d04a975..2156d76 100644 --- a/custom_components/eldom/eldom_boiler.py +++ b/custom_components/eldom/eldom_boiler.py @@ -250,6 +250,16 @@ async def set_temperature(self, temperature: float) -> None: async def enable_powerful_mode(self) -> None: """Enable the boiler's powerful mode.""" + required_mode_enabled = self.current_operation in ( + OPERATION_MODES[1], + OPERATION_MODES[2], + ) + if not required_mode_enabled: + _LOGGER.warning( + "Powerful mode can only be turned on when in Eco or Electric mode" + ) + return + self._flat_boiler_details.HasBoost = True await self._eldom_client.set_flat_boiler_powerful_mode_on(self.device_id) @@ -385,6 +395,11 @@ async def set_temperature(self, temperature: float) -> None: async def enable_powerful_mode(self) -> None: """Enable the boiler's powerful mode.""" + required_mode_enabled = self.current_operation in (OPERATION_MODES[2],) + if not required_mode_enabled: + _LOGGER.warning("Powerful mode can only be turned on when in Eco mode") + return + self._smart_boiler_details.BoostHeating = True await self._eldom_client.set_smart_boiler_powerful_mode_on(self.device_id) diff --git a/custom_components/eldom/manifest.json b/custom_components/eldom/manifest.json index 6c1465a..a0b0296 100644 --- a/custom_components/eldom/manifest.json +++ b/custom_components/eldom/manifest.json @@ -11,5 +11,5 @@ "requirements": ["pyeldom==0.4.1"], "ssdp": [], "zeroconf": [], - "version": "3.0.1" + "version": "3.1.0" } diff --git a/custom_components/eldom/switch.py b/custom_components/eldom/switch.py index c7b7339..c7f8647 100644 --- a/custom_components/eldom/switch.py +++ b/custom_components/eldom/switch.py @@ -12,10 +12,9 @@ from .const import DEVICE_TYPE_FLAT_BOILER, DEVICE_TYPE_SMART_BOILER, DOMAIN from .coordinator import EldomCoordinator -from .eldom_boiler import OPERATION_MODES, EldomBoiler +from .eldom_boiler import EldomBoiler from .models import EldomData -REQUIRED_OPERATION_MODE_FOR_BOOST = OPERATION_MODES[2] SWITCH_NAME = "Powerful" _LOGGER = logging.getLogger(__name__) @@ -91,14 +90,7 @@ def is_on(self) -> bool: return self._eldom_boiler.powerful_enabled async def async_turn_on(self, **kwargs: Any) -> None: - """Turn powerful on.""" - eco_mode_enabled = ( - self._eldom_boiler.current_operation == REQUIRED_OPERATION_MODE_FOR_BOOST - ) - if not eco_mode_enabled: - _LOGGER.warning("Powerful mode can only be turned on when in ECO mode") - return - + """Turn powerful mode on.""" await self._eldom_boiler.enable_powerful_mode() self.schedule_update_ha_state()