From 2b6a3716e81598bb97d11413e5af14a98b3567a8 Mon Sep 17 00:00:00 2001 From: jjlawren Date: Mon, 12 Jul 2021 10:09:45 -0500 Subject: [PATCH] Ignore Sonos Boost devices during discovery (#52845) --- homeassistant/components/sonos/__init__.py | 4 ++++ homeassistant/components/sonos/speaker.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/sonos/__init__.py b/homeassistant/components/sonos/__init__.py index ec16ec5bd87..040ee321206 100644 --- a/homeassistant/components/sonos/__init__.py +++ b/homeassistant/components/sonos/__init__.py @@ -46,6 +46,7 @@ _LOGGER = logging.getLogger(__name__) CONF_ADVERTISE_ADDR = "advertise_addr" CONF_INTERFACE_ADDR = "interface_addr" +DISCOVERY_IGNORED_MODELS = ["Sonos Boost"] CONFIG_SCHEMA = vol.Schema( @@ -233,6 +234,9 @@ async def async_setup_entry( # noqa: C901 @callback def _async_discovered_player(info): + if info.get("modelName") in DISCOVERY_IGNORED_MODELS: + _LOGGER.debug("Ignoring device: %s", info.get("friendlyName")) + return uid = info.get(ssdp.ATTR_UPNP_UDN) if uid.startswith("uuid:"): uid = uid[5:] diff --git a/homeassistant/components/sonos/speaker.py b/homeassistant/components/sonos/speaker.py index 14adbc337fb..b1483c0f5d3 100644 --- a/homeassistant/components/sonos/speaker.py +++ b/homeassistant/components/sonos/speaker.py @@ -511,7 +511,7 @@ class SonosSpeaker: await self.async_unsubscribe() if not will_reconnect: - self.hass.data[DATA_SONOS].ssdp_known.remove(self.soco.uid) + self.hass.data[DATA_SONOS].ssdp_known.discard(self.soco.uid) self.async_write_entity_states() async def async_rebooted(self, soco: SoCo) -> None: