mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
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:
co-authored by
Copilot Autofix powered by AI
parent
86ec1f708b
commit
78b38be7ea
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user