mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Only debug log new Sonos SSDP discoveries (#51247)
* Only debug log new SSDP discoveries * Use existing reference * Remove from known on unseen * Update homeassistant/components/sonos/speaker.py Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
319071ba39
commit
1a5d35d7bf
@ -78,6 +78,7 @@ class SonosData:
|
||||
self.alarms: dict[str, Alarm] = {}
|
||||
self.topology_condition = asyncio.Condition()
|
||||
self.hosts_heartbeat = None
|
||||
self.ssdp_known: set[str] = set()
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
@ -184,10 +185,12 @@ async def async_setup_entry( # noqa: C901
|
||||
|
||||
@callback
|
||||
def _async_discovered_player(info):
|
||||
_LOGGER.debug("Sonos Discovery: %s", info)
|
||||
uid = info.get(ssdp.ATTR_UPNP_UDN)
|
||||
if uid.startswith("uuid:"):
|
||||
uid = uid[5:]
|
||||
if uid not in data.ssdp_known:
|
||||
_LOGGER.debug("New discovery: %s", info)
|
||||
data.ssdp_known.add(uid)
|
||||
discovered_ip = urlparse(info[ssdp.ATTR_SSDP_LOCATION]).hostname
|
||||
asyncio.create_task(_async_create_discovered_player(uid, discovered_ip))
|
||||
|
||||
|
@ -460,6 +460,7 @@ class SonosSpeaker:
|
||||
await subscription.unsubscribe()
|
||||
|
||||
self._subscriptions = []
|
||||
self.hass.data[DATA_SONOS].ssdp_known.remove(self.soco.uid)
|
||||
|
||||
#
|
||||
# Alarm management
|
||||
|
Loading…
x
Reference in New Issue
Block a user