Ignore non-Sonos SSDP devices with Sonos-like identifiers (#59809)

This commit is contained in:
jjlawren 2021-11-19 10:14:12 -06:00 committed by GitHub
parent 9aa41be8b7
commit 81e02a39df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -267,11 +267,13 @@ class SonosDiscoveryManager:
if change == ssdp.SsdpChange.BYEBYE:
return
uid = info.get(ssdp.ATTR_UPNP_UDN)
if not uid.startswith("uuid:RINCON_"):
return
uid = uid[5:]
discovered_ip = urlparse(info[ssdp.ATTR_SSDP_LOCATION]).hostname
boot_seqnum = info.get("X-RINCON-BOOTSEQ")
uid = info.get(ssdp.ATTR_UPNP_UDN)
if uid.startswith("uuid:"):
uid = uid[5:]
self.async_discovered_player(
"SSDP", info, discovered_ip, uid, boot_seqnum, info.get("modelName"), None
)

View File

@ -93,7 +93,7 @@ def discover_fixture(soco):
async def do_callback(hass, callback, *args, **kwargs):
await callback(
{
ssdp.ATTR_UPNP_UDN: soco.uid,
ssdp.ATTR_UPNP_UDN: f"uuid:{soco.uid}",
ssdp.ATTR_SSDP_LOCATION: f"http://{soco.ip_address}/",
},
ssdp.SsdpChange.ALIVE,