Avoid login error when appliance is disconnected on fetch in Home Connect (#188938)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Diego Rodríguez Royo
2026-11-15 20:47:07 +01:00
committed by GitHub
co-authored by Copilot Autofix powered by AI
parent 86ec1f708b
commit 78b38be7ea
2 changed files with 9 additions and 2 deletions
@@ -40,7 +40,11 @@ from homeassistant.exceptions import (
OAuth2TokenRequestReauthError,
)
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.helpers.update_coordinator import (
DataUpdateCoordinator,
UpdateFailed,
UpdateFailedUnreachable,
)
from .const import (
API_DEFAULT_RETRY_AFTER,
@@ -672,7 +676,7 @@ class HomeConnectApplianceCoordinator(DataUpdateCoordinator[HomeConnectAppliance
)
if not appliance.connected:
self.data.update(HomeConnectApplianceData.empty(appliance))
raise UpdateFailed(
raise UpdateFailedUnreachable(
translation_domain=DOMAIN,
translation_key="appliance_disconnected",
translation_placeholders={
@@ -223,6 +223,7 @@ async def test_coordinator_failure_refresh_and_stream(
async def test_coordinator_not_fetching_on_disconnected_appliance(
client: MagicMock,
config_entry: MockConfigEntry,
caplog: pytest.LogCaptureFixture,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
appliance: HomeAppliance,
) -> None:
@@ -234,6 +235,8 @@ async def test_coordinator_not_fetching_on_disconnected_appliance(
for method in INITIAL_FETCH_CLIENT_METHODS:
assert getattr(client, method).call_count == 0
assert "is unavailable" in caplog.text
assert "Error fetching" not in caplog.text
@pytest.mark.parametrize(