Add missing raise for exceptions (#86155)

This commit is contained in:
Marc Mueller 2023-01-18 12:48:30 +01:00 committed by GitHub
parent 9cdf7a09ed
commit a44e44b7d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -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}"
)

View File

@ -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,