Suppress errors for legacy nest api when using media source (#61629)

This commit is contained in:
Allen Porter
2021-12-13 08:41:45 -08:00
committed by GitHub
parent 3cfc349e99
commit efbec55818
2 changed files with 35 additions and 0 deletions

View File

@@ -64,6 +64,9 @@ async def async_get_media_source(hass: HomeAssistant) -> MediaSource:
async def get_media_source_devices(hass: HomeAssistant) -> Mapping[str, Device]:
"""Return a mapping of device id to eligible Nest event media devices."""
if DATA_SUBSCRIBER not in hass.data[DOMAIN]:
# Integration unloaded, or is legacy nest integration
return {}
subscriber = hass.data[DOMAIN][DATA_SUBSCRIBER]
device_manager = await subscriber.async_get_device_manager()
device_registry = await hass.helpers.device_registry.async_get_registry()