diff --git a/homeassistant/components/hue/config_flow.py b/homeassistant/components/hue/config_flow.py index 2c3a90318b7..95e4a1ad7f2 100644 --- a/homeassistant/components/hue/config_flow.py +++ b/homeassistant/components/hue/config_flow.py @@ -210,6 +210,17 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): self.bridge = bridge return await self.async_step_link() + async def async_step_homekit(self, discovery_info): + """Handle a discovered Hue bridge on HomeKit. + + The bridge ID communicated over HomeKit differs, so we cannot use that + as the unique identifier. Therefore, this method uses discovery without + a unique ID. + """ + self.bridge = self._async_get_bridge(discovery_info[CONF_HOST]) + await self._async_handle_discovery_without_unique_id() + return await self.async_step_link() + async def async_step_import(self, import_info): """Import a new bridge as a config entry. diff --git a/tests/components/hue/test_config_flow.py b/tests/components/hue/test_config_flow.py index 9ba34f23bf4..12a360cdf94 100644 --- a/tests/components/hue/test_config_flow.py +++ b/tests/components/hue/test_config_flow.py @@ -571,7 +571,14 @@ async def test_bridge_homekit(hass, aioclient_mock): ) assert result["type"] == "form" - assert result["step_id"] == "init" + assert result["step_id"] == "link" + + flow = next( + flow + for flow in hass.config_entries.flow.async_progress() + if flow["flow_id"] == result["flow_id"] + ) + assert flow["context"]["unique_id"] == config_entries.DEFAULT_DISCOVERY_UNIQUE_ID async def test_bridge_import_already_configured(hass):