Show device_id in HomeKit when the device registry entry is missing a name (#55391)

- Reported at: https://community.home-assistant.io/t/homekit-unknown-error-occurred/333385
pull/55490/head
J. Nick Koston 2021-08-29 02:01:04 -05:00 committed by GitHub
parent 4aed0b6ccf
commit 43b8353566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -498,7 +498,10 @@ async def _async_get_supported_devices(hass):
"""Return all supported devices."""
results = await device_automation.async_get_device_automations(hass, "trigger")
dev_reg = device_registry.async_get(hass)
unsorted = {device_id: dev_reg.async_get(device_id).name for device_id in results}
unsorted = {
device_id: dev_reg.async_get(device_id).name or device_id
for device_id in results
}
return dict(sorted(unsorted.items(), key=lambda item: item[1]))