Fix Raise HomeAssistantError for all Liebherr errors in actions (#184163)

This commit is contained in:
mettolen
2026-10-04 09:14:24 +02:00
committed by GitHub
parent 534202fe0a
commit 71a74f6d8a
3 changed files with 7 additions and 10 deletions
+2 -3
View File
@@ -5,8 +5,7 @@ from typing import Any
from pyliebherrhomeapi import (
DeviceControl,
LiebherrConnectionError,
LiebherrTimeoutError,
LiebherrError,
TemperatureControl,
ZonePosition,
)
@@ -61,7 +60,7 @@ class LiebherrEntity(CoordinatorEntity[LiebherrCoordinator]):
"""Send a command and optimistically apply its successful result."""
try:
await command
except (LiebherrConnectionError, LiebherrTimeoutError) as err:
except LiebherrError as err:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="communication_error",
@@ -30,9 +30,7 @@ rules:
unique-config-entry: done
# Silver
action-exceptions:
status: exempt
comment: Integration does not register custom actions.
action-exceptions: done
config-entry-unloading: done
docs-configuration-parameters:
status: exempt
+4 -4
View File
@@ -7,7 +7,7 @@ from unittest.mock import MagicMock, patch
from freezegun.api import FrozenDateTimeFactory
from pyliebherrhomeapi import Device, DeviceState, DeviceType, PresentationLightControl
from pyliebherrhomeapi.exceptions import LiebherrConnectionError
from pyliebherrhomeapi.exceptions import LiebherrServerError
import pytest
from syrupy.assertion import SnapshotAssertion
@@ -122,10 +122,10 @@ async def test_light_failure(
hass: HomeAssistant,
mock_liebherr_client: MagicMock,
) -> None:
"""Test light fails gracefully on connection error."""
"""Test light fails gracefully on a library error."""
entity_id = "light.test_fridge_presentation_light"
mock_liebherr_client.set_presentation_light.side_effect = LiebherrConnectionError(
"Connection failed"
mock_liebherr_client.set_presentation_light.side_effect = LiebherrServerError(
"Server error"
)
with pytest.raises(