Ignore Sonos Boost devices during discovery (#52845)

This commit is contained in:
jjlawren 2021-07-12 10:09:45 -05:00 committed by GitHub
parent 9308fa28e7
commit 2b6a3716e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -46,6 +46,7 @@ _LOGGER = logging.getLogger(__name__)
CONF_ADVERTISE_ADDR = "advertise_addr" CONF_ADVERTISE_ADDR = "advertise_addr"
CONF_INTERFACE_ADDR = "interface_addr" CONF_INTERFACE_ADDR = "interface_addr"
DISCOVERY_IGNORED_MODELS = ["Sonos Boost"]
CONFIG_SCHEMA = vol.Schema( CONFIG_SCHEMA = vol.Schema(
@ -233,6 +234,9 @@ async def async_setup_entry( # noqa: C901
@callback @callback
def _async_discovered_player(info): 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) uid = info.get(ssdp.ATTR_UPNP_UDN)
if uid.startswith("uuid:"): if uid.startswith("uuid:"):
uid = uid[5:] uid = uid[5:]

View File

@ -511,7 +511,7 @@ class SonosSpeaker:
await self.async_unsubscribe() await self.async_unsubscribe()
if not will_reconnect: 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() self.async_write_entity_states()
async def async_rebooted(self, soco: SoCo) -> None: async def async_rebooted(self, soco: SoCo) -> None: