mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Add missing raise for exceptions (#86155)
This commit is contained in:
parent
9cdf7a09ed
commit
a44e44b7d0
@ -84,12 +84,12 @@ class ISYSwitchEntity(ISYNodeEntity, SwitchEntity):
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Send the turn off command to the ISY switch."""
|
||||
if not await self._node.turn_off():
|
||||
HomeAssistantError(f"Unable to turn off switch {self._node.address}")
|
||||
raise HomeAssistantError(f"Unable to turn off switch {self._node.address}")
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Send the turn on command to the ISY switch."""
|
||||
if not await self._node.turn_on():
|
||||
HomeAssistantError(f"Unable to turn on switch {self._node.address}")
|
||||
raise HomeAssistantError(f"Unable to turn on switch {self._node.address}")
|
||||
|
||||
@property
|
||||
def icon(self) -> str | None:
|
||||
@ -110,14 +110,14 @@ class ISYSwitchProgramEntity(ISYProgramEntity, SwitchEntity):
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Send the turn on command to the ISY switch program."""
|
||||
if not await self._actions.run_then():
|
||||
HomeAssistantError(
|
||||
raise HomeAssistantError(
|
||||
f"Unable to run 'then' clause on program switch {self._actions.address}"
|
||||
)
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Send the turn off command to the ISY switch program."""
|
||||
if not await self._actions.run_else():
|
||||
HomeAssistantError(
|
||||
raise HomeAssistantError(
|
||||
f"Unable to run 'else' clause on program switch {self._actions.address}"
|
||||
)
|
||||
|
||||
|
@ -124,7 +124,7 @@ class Alpha2BaseCoordinator(DataUpdateCoordinator[dict[str, dict]]):
|
||||
"""Set the mode of the given heat area."""
|
||||
# HEATAREA_MODE: 0=Auto, 1=Tag, 2=Nacht
|
||||
if heat_area_mode not in (0, 1, 2):
|
||||
ValueError(f"Invalid heat area mode: {heat_area_mode}")
|
||||
raise ValueError(f"Invalid heat area mode: {heat_area_mode}")
|
||||
_LOGGER.debug(
|
||||
"Setting mode of heat area %s to %d",
|
||||
heat_area_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user