diff --git a/homeassistant/components/huawei_lte/button.py b/homeassistant/components/huawei_lte/button.py index 1d9507a2865..e981ee2fc9c 100644 --- a/homeassistant/components/huawei_lte/button.py +++ b/homeassistant/components/huawei_lte/button.py @@ -14,6 +14,7 @@ from homeassistant.components.button import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import EntityCategory from homeassistant.core import HomeAssistant +from homeassistant.exceptions import ServiceValidationError from homeassistant.helpers import entity_platform from .const import DOMAIN @@ -50,10 +51,7 @@ class BaseButton(HuaweiLteBaseInteractiveEntity, ButtonEntity): def press(self) -> None: """Press button.""" if self.router.suspended: - _LOGGER.debug( - "%s: ignored, integration suspended", self.entity_description.key - ) - return + raise ServiceValidationError("Integration is suspended") result = self._press() _LOGGER.debug("%s: %s", self.entity_description.key, result) diff --git a/homeassistant/components/huawei_lte/select.py b/homeassistant/components/huawei_lte/select.py index cacbb5c88a2..11e82a8e3d3 100644 --- a/homeassistant/components/huawei_lte/select.py +++ b/homeassistant/components/huawei_lte/select.py @@ -17,6 +17,7 @@ from homeassistant.components.select import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import EntityCategory from homeassistant.core import HomeAssistant +from homeassistant.exceptions import ServiceValidationError from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.typing import UNDEFINED @@ -102,6 +103,8 @@ class HuaweiLteSelectEntity(HuaweiLteBaseInteractiveEntity, SelectEntity): def select_option(self, option: str) -> None: """Change the selected option.""" + if self.router.suspended: + raise ServiceValidationError("Integration is suspended") self.entity_description.setter_fn(option) @property diff --git a/homeassistant/components/huawei_lte/switch.py b/homeassistant/components/huawei_lte/switch.py index 944cf63eb05..80c2ab80439 100644 --- a/homeassistant/components/huawei_lte/switch.py +++ b/homeassistant/components/huawei_lte/switch.py @@ -12,6 +12,7 @@ from homeassistant.components.switch import ( ) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant +from homeassistant.exceptions import ServiceValidationError from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -57,10 +58,14 @@ class HuaweiLteBaseSwitch(HuaweiLteBaseInteractiveEntity, SwitchEntity): def turn_on(self, **kwargs: Any) -> None: """Turn switch on.""" + if self.router.suspended: + raise ServiceValidationError("Integration is suspended") self._turn(state=True) def turn_off(self, **kwargs: Any) -> None: """Turn switch off.""" + if self.router.suspended: + raise ServiceValidationError("Integration is suspended") self._turn(state=False) async def async_added_to_hass(self) -> None: