diff --git a/custom_components/nuki_ng/config_flow.py b/custom_components/nuki_ng/config_flow.py index 813085e..e0e1d74 100644 --- a/custom_components/nuki_ng/config_flow.py +++ b/custom_components/nuki_ng/config_flow.py @@ -35,7 +35,10 @@ async def find_nuki_devices(self, config: dict): use_hashed_token = info.get("bridgeType") == 1 response = await nuki.bridge_list() _LOGGER.debug(f"bridge devices: {response}") - title = response[0]["name"] + first_device = next(iter(response.values()), {}) + title = first_device.get("name") + if not title: + return title, "invalid_bridge_token", None except Exception as err: _LOGGER.exception( f"Failed to get list of devices from bridge: {err}")