Catch upnp timeout error (#38794)

This commit is contained in:
Paulus Schoutsen 2020-08-13 12:11:58 +02:00 committed by GitHub
parent 1f3b9bc70c
commit 03676693ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
"""Open ports in your router for Home Assistant and provide statistics."""
import asyncio
from ipaddress import ip_address
from operator import itemgetter
@ -106,7 +107,11 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry)
# discover and construct
udn = config_entry.data.get(CONFIG_ENTRY_UDN)
st = config_entry.data.get(CONFIG_ENTRY_ST) # pylint: disable=invalid-name
device = await async_discover_and_construct(hass, udn, st)
try:
device = await async_discover_and_construct(hass, udn, st)
except asyncio.TimeoutError:
raise ConfigEntryNotReady
if not device:
_LOGGER.info("Unable to create UPnP/IGD, aborting")
raise ConfigEntryNotReady