Improve HomeKit discovered Hue config flow (#47729)
This commit is contained in:
parent
3ad4c26f98
commit
10535018cc
2 changed files with 19 additions and 1 deletions
|
@ -210,6 +210,17 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
self.bridge = bridge
|
self.bridge = bridge
|
||||||
return await self.async_step_link()
|
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):
|
async def async_step_import(self, import_info):
|
||||||
"""Import a new bridge as a config entry.
|
"""Import a new bridge as a config entry.
|
||||||
|
|
||||||
|
|
|
@ -571,7 +571,14 @@ async def test_bridge_homekit(hass, aioclient_mock):
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == "form"
|
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):
|
async def test_bridge_import_already_configured(hass):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue