Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions homeassistant/components/ssdp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,22 +472,24 @@ async def _ssdp_listener_callback(
)

location = ssdp_device.location
info_desc = await self._async_get_description_dict(location) or {}
info_desc = None
combined_headers = ssdp_device.combined_headers(dst)
info_with_desc = CaseInsensitiveDict(combined_headers, **info_desc)

callbacks = self._async_get_matching_callbacks(combined_headers)
matching_domains: set[str] = set()

# If there are no changes from a search, do not trigger a config flow
if source != SsdpSource.SEARCH_ALIVE:
info_desc = await self._async_get_description_dict(location) or {}
assert isinstance(combined_headers, CaseInsensitiveDict)
matching_domains = self.integration_matchers.async_matching_domains(
info_with_desc
CaseInsensitiveDict({**combined_headers.as_dict(), **info_desc})
)

if not callbacks and not matching_domains:
return

if info_desc is None:
info_desc = await self._async_get_description_dict(location) or {}
discovery_info = discovery_info_from_headers_and_description(
combined_headers, info_desc
)
Expand Down Expand Up @@ -565,7 +567,10 @@ def discovery_info_from_headers_and_description(
"""Convert headers and description to discovery_info."""
ssdp_usn = combined_headers["usn"]
ssdp_st = combined_headers.get("st")
upnp_info = {**info_desc}
if isinstance(info_desc, CaseInsensitiveDict):
upnp_info = {**info_desc.as_dict()}
else:
upnp_info = {**info_desc}

# Increase compatibility: depending on the message type,
# either the ST (Search Target, from M-SEARCH messages)
Expand Down