mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Guard upnp create device (#57156)
This commit is contained in:
parent
205b40cf16
commit
222a0c26e0
@ -8,6 +8,7 @@ from datetime import timedelta
|
|||||||
from ipaddress import ip_address
|
from ipaddress import ip_address
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from async_upnp_client.exceptions import UpnpConnectionError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
@ -122,7 +123,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
location = discovery_info[ # pylint: disable=unsubscriptable-object
|
location = discovery_info[ # pylint: disable=unsubscriptable-object
|
||||||
ssdp.ATTR_SSDP_LOCATION
|
ssdp.ATTR_SSDP_LOCATION
|
||||||
]
|
]
|
||||||
device = await Device.async_create_device(hass, location)
|
try:
|
||||||
|
device = await Device.async_create_device(hass, location)
|
||||||
|
except UpnpConnectionError as err:
|
||||||
|
LOGGER.debug("Error connecting to device %s", location)
|
||||||
|
raise ConfigEntryNotReady from err
|
||||||
|
|
||||||
# Ensure entry has a unique_id.
|
# Ensure entry has a unique_id.
|
||||||
if not entry.unique_id:
|
if not entry.unique_id:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user