Adjust diagnostic return type in Sonos (#85585)

This commit is contained in:
epenet 2023-01-10 12:07:14 +01:00 committed by GitHub
parent b64d14004a
commit fa7d7415d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,17 +65,17 @@ async def async_get_config_entry_diagnostics(
async def async_get_device_diagnostics(
hass: HomeAssistant, config_entry: ConfigEntry, device: DeviceEntry
) -> dict[str, Any] | None:
) -> dict[str, Any]:
"""Return diagnostics for a device."""
uid = next(
(identifier[1] for identifier in device.identifiers if identifier[0] == DOMAIN),
None,
)
if uid is None:
return None
return {}
if (speaker := hass.data[DATA_SONOS].discovered.get(uid)) is None:
return None
return {}
return await async_generate_speaker_info(hass, speaker)