Ensure braviatv config flow title_placeholders items are [str, str] (#127287)

This commit is contained in:
Erik Montnemery 2024-10-02 14:20:55 +02:00 committed by GitHub
parent 689372b572
commit 81d7d2a70a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,7 +3,7 @@
from __future__ import annotations from __future__ import annotations
from collections.abc import Mapping from collections.abc import Mapping
from typing import Any from typing import Any, cast
from urllib.parse import urlparse from urllib.parse import urlparse
from aiohttp import CookieJar from aiohttp import CookieJar
@ -207,8 +207,9 @@ class BraviaTVConfigFlow(ConfigFlow, domain=DOMAIN):
self, discovery_info: ssdp.SsdpServiceInfo self, discovery_info: ssdp.SsdpServiceInfo
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle a discovered device.""" """Handle a discovered device."""
parsed_url = urlparse(discovery_info.ssdp_location) # We can cast the hostname to str because the ssdp_location is not bytes and
host = parsed_url.hostname # not a relative url
host = cast(str, urlparse(discovery_info.ssdp_location).hostname)
await self.async_set_unique_id(discovery_info.upnp[ssdp.ATTR_UPNP_UDN]) await self.async_set_unique_id(discovery_info.upnp[ssdp.ATTR_UPNP_UDN])
self._abort_if_unique_id_configured(updates={CONF_HOST: host}) self._abort_if_unique_id_configured(updates={CONF_HOST: host})