Skip to content

Commit

Permalink
Retry onvif setup when it is unexpectedly cancelled
Browse files Browse the repository at this point in the history
fixes #92308
  • Loading branch information
bdraco committed Apr 30, 2023
1 parent c0d0c89 commit 1a92568
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions homeassistant/components/onvif/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The ONVIF integration."""
import asyncio
import logging

from httpx import RequestError
Expand Down Expand Up @@ -57,6 +58,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
raise ConfigEntryNotReady(
f"Could not setup camera {device.device.host}:{device.device.port}: {err}"
) from err
except asyncio.CancelledError as err:
await device.device.close()
raise ConfigEntryNotReady(f"Setup was unexpectedly canceled: {err}") from err

if not device.available:
raise ConfigEntryNotReady()
Expand Down

0 comments on commit 1a92568

Please sign in to comment.