mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Raise ConfigEntryNotReady
when fetching Whirlpool appliances fails (#143601)
This commit is contained in:
parent
987bf4d850
commit
6457d46107
@ -47,8 +47,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: WhirlpoolConfigEntry) ->
|
||||
|
||||
appliances_manager = AppliancesManager(backend_selector, auth, session)
|
||||
if not await appliances_manager.fetch_appliances():
|
||||
_LOGGER.error("Cannot fetch appliances")
|
||||
return False
|
||||
raise ConfigEntryNotReady(
|
||||
translation_domain=DOMAIN, translation_key="appliances_fetch_failed"
|
||||
)
|
||||
await appliances_manager.connect()
|
||||
|
||||
entry.runtime_data = appliances_manager
|
||||
|
@ -128,6 +128,9 @@
|
||||
"exceptions": {
|
||||
"account_locked": {
|
||||
"message": "[%key:component::whirlpool::common::account_locked_error%]"
|
||||
},
|
||||
"appliances_fetch_failed": {
|
||||
"message": "Failed to fetch appliances"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ async def test_setup_fetch_appliances_failed(
|
||||
mock_appliances_manager_api.return_value.fetch_appliances.return_value = False
|
||||
entry = await init_integration(hass)
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
|
||||
assert entry.state is ConfigEntryState.SETUP_ERROR
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
|
||||
async def test_unload_entry(hass: HomeAssistant) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user