mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Reolink continue setup when internet blocked (#110888)
This commit is contained in:
parent
3e5329d463
commit
aa9f0f5734
@ -100,10 +100,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
||||
async with asyncio.timeout(host.api.timeout * (RETRY_ATTEMPTS + 2)):
|
||||
try:
|
||||
return await host.api.check_new_firmware()
|
||||
except (ReolinkError, asyncio.exceptions.CancelledError) as err:
|
||||
task = asyncio.current_task()
|
||||
if task is not None:
|
||||
task.uncancel()
|
||||
except ReolinkError as err:
|
||||
if starting:
|
||||
_LOGGER.debug(
|
||||
"Error checking Reolink firmware update at startup "
|
||||
@ -133,15 +130,16 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
||||
update_interval=FIRMWARE_UPDATE_INTERVAL,
|
||||
)
|
||||
# Fetch initial data so we have data when entities subscribe
|
||||
try:
|
||||
# If camera WAN blocked, firmware check fails, do not prevent setup
|
||||
await asyncio.gather(
|
||||
device_coordinator.async_config_entry_first_refresh(),
|
||||
firmware_coordinator.async_config_entry_first_refresh(),
|
||||
)
|
||||
except ConfigEntryNotReady:
|
||||
results = await asyncio.gather(
|
||||
device_coordinator.async_config_entry_first_refresh(),
|
||||
firmware_coordinator.async_config_entry_first_refresh(),
|
||||
return_exceptions=True,
|
||||
)
|
||||
# If camera WAN blocked, firmware check fails, do not prevent setup
|
||||
# so don't check firmware_coordinator exceptions
|
||||
if isinstance(results[0], BaseException):
|
||||
await host.stop()
|
||||
raise
|
||||
raise results[0]
|
||||
|
||||
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = ReolinkData(
|
||||
host=host,
|
||||
|
Loading…
x
Reference in New Issue
Block a user