From 43b83535669816db50945dd465018ecb9c32b426 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 29 Aug 2021 02:01:04 -0500 Subject: [PATCH] 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 --- homeassistant/components/homekit/config_flow.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/homekit/config_flow.py b/homeassistant/components/homekit/config_flow.py index fdad10f873f..03df55a9026 100644 --- a/homeassistant/components/homekit/config_flow.py +++ b/homeassistant/components/homekit/config_flow.py @@ -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]))