Log source of discovery in Sonos (#53101)

This commit is contained in:
jjlawren 2021-07-16 16:12:01 -05:00 committed by GitHub
parent 4fceac00b1
commit 0277a645f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -261,11 +261,13 @@ class SonosDiscoveryManager:
if uid.startswith("uuid:"):
uid = uid[5:]
self.async_discovered_player(
info, discovered_ip, uid, boot_seqnum, info.get("modelName")
"SSDP", info, discovered_ip, uid, boot_seqnum, info.get("modelName")
)
@callback
def async_discovered_player(self, info, discovered_ip, uid, boot_seqnum, model):
def async_discovered_player(
self, source, info, discovered_ip, uid, boot_seqnum, model
):
"""Handle discovery via ssdp or zeroconf."""
if model in DISCOVERY_IGNORED_MODELS:
_LOGGER.debug("Ignoring device: %s", info)
@ -274,7 +276,7 @@ class SonosDiscoveryManager:
boot_seqnum = int(boot_seqnum)
self.data.boot_counts.setdefault(uid, boot_seqnum)
if uid not in self.data.discovery_known:
_LOGGER.debug("New discovery uid=%s: %s", uid, info)
_LOGGER.debug("New %s discovery uid=%s: %s", source, uid, info)
self.data.discovery_known.add(uid)
asyncio.create_task(
self._async_create_discovered_player(uid, discovered_ip, boot_seqnum)

View file

@ -50,7 +50,7 @@ class SonosDiscoveryFlowHandler(DiscoveryFlowHandler):
)
if discovery_manager := self.hass.data.get(DATA_SONOS_DISCOVERY_MANAGER):
discovery_manager.async_discovered_player(
properties, host, uid, boot_seqnum, model
"Zeroconf", properties, host, uid, boot_seqnum, model
)
return await self.async_step_discovery(discovery_info)