mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +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)):
|
async with asyncio.timeout(host.api.timeout * (RETRY_ATTEMPTS + 2)):
|
||||||
try:
|
try:
|
||||||
return await host.api.check_new_firmware()
|
return await host.api.check_new_firmware()
|
||||||
except (ReolinkError, asyncio.exceptions.CancelledError) as err:
|
except ReolinkError as err:
|
||||||
task = asyncio.current_task()
|
|
||||||
if task is not None:
|
|
||||||
task.uncancel()
|
|
||||||
if starting:
|
if starting:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Error checking Reolink firmware update at startup "
|
"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,
|
update_interval=FIRMWARE_UPDATE_INTERVAL,
|
||||||
)
|
)
|
||||||
# Fetch initial data so we have data when entities subscribe
|
# Fetch initial data so we have data when entities subscribe
|
||||||
try:
|
results = await asyncio.gather(
|
||||||
# If camera WAN blocked, firmware check fails, do not prevent setup
|
device_coordinator.async_config_entry_first_refresh(),
|
||||||
await asyncio.gather(
|
firmware_coordinator.async_config_entry_first_refresh(),
|
||||||
device_coordinator.async_config_entry_first_refresh(),
|
return_exceptions=True,
|
||||||
firmware_coordinator.async_config_entry_first_refresh(),
|
)
|
||||||
)
|
# If camera WAN blocked, firmware check fails, do not prevent setup
|
||||||
except ConfigEntryNotReady:
|
# so don't check firmware_coordinator exceptions
|
||||||
|
if isinstance(results[0], BaseException):
|
||||||
await host.stop()
|
await host.stop()
|
||||||
raise
|
raise results[0]
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = ReolinkData(
|
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = ReolinkData(
|
||||||
host=host,
|
host=host,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user