mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Allow removing Sonos devices (#73567)
This commit is contained in:
parent
b4359c7721
commit
90e402eca5
@ -21,7 +21,7 @@ from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOSTS, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers import config_validation as cv, device_registry as dr
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send, dispatcher_send
|
||||
from homeassistant.helpers.event import async_track_time_interval, call_later
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
@ -396,3 +396,17 @@ class SonosDiscoveryManager:
|
||||
AVAILABILITY_CHECK_INTERVAL,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
async def async_remove_config_entry_device(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: dr.DeviceEntry
|
||||
) -> bool:
|
||||
"""Remove Sonos config entry from a device."""
|
||||
known_devices = hass.data[DATA_SONOS].discovered.keys()
|
||||
for identifier in device_entry.identifiers:
|
||||
if identifier[0] != DOMAIN:
|
||||
continue
|
||||
uid = identifier[1]
|
||||
if uid not in known_devices:
|
||||
return True
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user