From 71a74f6d8a1406837acc261e02119060c256b3d9 Mon Sep 17 00:00:00 2001 From: mettolen <1007649+mettolen@users.noreply.github.com> Date: Sun, 4 Oct 2026 10:14:24 +0300 Subject: [PATCH] Fix Raise HomeAssistantError for all Liebherr errors in actions (#184163) --- homeassistant/components/liebherr/entity.py | 5 ++--- homeassistant/components/liebherr/quality_scale.yaml | 4 +--- tests/components/liebherr/test_light.py | 8 ++++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/liebherr/entity.py b/homeassistant/components/liebherr/entity.py index 47bff5c42c30..88f58a7fd972 100644 --- a/homeassistant/components/liebherr/entity.py +++ b/homeassistant/components/liebherr/entity.py @@ -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", diff --git a/homeassistant/components/liebherr/quality_scale.yaml b/homeassistant/components/liebherr/quality_scale.yaml index be0f54f46849..e29fa01a2074 100644 --- a/homeassistant/components/liebherr/quality_scale.yaml +++ b/homeassistant/components/liebherr/quality_scale.yaml @@ -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 diff --git a/tests/components/liebherr/test_light.py b/tests/components/liebherr/test_light.py index b29dcec1351f..2a4b28b649f9 100644 --- a/tests/components/liebherr/test_light.py +++ b/tests/components/liebherr/test_light.py @@ -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(