File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
homeassistant/components/huawei_lte Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1414from homeassistant .config_entries import ConfigEntry
1515from homeassistant .const import EntityCategory
1616from homeassistant .core import HomeAssistant
17+ from homeassistant .exceptions import ServiceValidationError
1718from homeassistant .helpers import entity_platform
1819
1920from .const import DOMAIN
@@ -50,10 +51,7 @@ async def async_update(self) -> None:
5051 def press (self ) -> None :
5152 """Press button."""
5253 if self .router .suspended :
53- _LOGGER .debug (
54- "%s: ignored, integration suspended" , self .entity_description .key
55- )
56- return
54+ raise ServiceValidationError ("Integration is suspended" )
5755 result = self ._press ()
5856 _LOGGER .debug ("%s: %s" , self .entity_description .key , result )
5957
Original file line number Diff line number Diff line change 1717from homeassistant .config_entries import ConfigEntry
1818from homeassistant .const import EntityCategory
1919from homeassistant .core import HomeAssistant
20+ from homeassistant .exceptions import ServiceValidationError
2021from homeassistant .helpers .entity import Entity
2122from homeassistant .helpers .entity_platform import AddConfigEntryEntitiesCallback
2223
@@ -95,6 +96,8 @@ def __init__(
9596
9697 def select_option (self , option : str ) -> None :
9798 """Change the selected option."""
99+ if self .router .suspended :
100+ raise ServiceValidationError ("Integration is suspended" )
98101 self .entity_description .setter_fn (option )
99102
100103 @property
Original file line number Diff line number Diff line change 1212)
1313from homeassistant .config_entries import ConfigEntry
1414from homeassistant .core import HomeAssistant
15+ from homeassistant .exceptions import ServiceValidationError
1516from homeassistant .helpers .entity import Entity
1617from homeassistant .helpers .entity_platform import AddConfigEntryEntitiesCallback
1718
@@ -57,10 +58,14 @@ def _turn(self, state: bool) -> None:
5758
5859 def turn_on (self , ** kwargs : Any ) -> None :
5960 """Turn switch on."""
61+ if self .router .suspended :
62+ raise ServiceValidationError ("Integration is suspended" )
6063 self ._turn (state = True )
6164
6265 def turn_off (self , ** kwargs : Any ) -> None :
6366 """Turn switch off."""
67+ if self .router .suspended :
68+ raise ServiceValidationError ("Integration is suspended" )
6469 self ._turn (state = False )
6570
6671 async def async_added_to_hass (self ) -> None :
You can’t perform that action at this time.
0 commit comments