mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Fix Hue config flow (#61028)
This commit is contained in:
parent
86e8034ea0
commit
3eeb855679
@ -216,16 +216,17 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
if not url.hostname:
|
if not url.hostname:
|
||||||
return self.async_abort(reason="not_hue_bridge")
|
return self.async_abort(reason="not_hue_bridge")
|
||||||
|
|
||||||
bridge = await self._get_bridge(
|
# abort if we already have exactly this bridge id/host
|
||||||
|
# reload the integration if the host got updated
|
||||||
|
bridge_id = normalize_bridge_id(discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL])
|
||||||
|
await self.async_set_unique_id(bridge_id)
|
||||||
|
self._abort_if_unique_id_configured(
|
||||||
|
updates={CONF_HOST: url.hostname}, reload_on_update=True
|
||||||
|
)
|
||||||
|
|
||||||
|
self.bridge = await self._get_bridge(
|
||||||
url.hostname, discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL]
|
url.hostname, discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL]
|
||||||
)
|
)
|
||||||
|
|
||||||
await self.async_set_unique_id(bridge.id)
|
|
||||||
self._abort_if_unique_id_configured(
|
|
||||||
updates={CONF_HOST: bridge.host}, reload_on_update=False
|
|
||||||
)
|
|
||||||
|
|
||||||
self.bridge = bridge
|
|
||||||
return await self.async_step_link()
|
return await self.async_step_link()
|
||||||
|
|
||||||
async def async_step_zeroconf(
|
async def async_step_zeroconf(
|
||||||
@ -236,17 +237,18 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
This flow is triggered by the Zeroconf component. It will check if the
|
This flow is triggered by the Zeroconf component. It will check if the
|
||||||
host is already configured and delegate to the import step if not.
|
host is already configured and delegate to the import step if not.
|
||||||
"""
|
"""
|
||||||
bridge = await self._get_bridge(
|
# abort if we already have exactly this bridge id/host
|
||||||
discovery_info.host,
|
# reload the integration if the host got updated
|
||||||
discovery_info.properties["bridgeid"],
|
bridge_id = normalize_bridge_id(discovery_info.properties["bridgeid"])
|
||||||
)
|
await self.async_set_unique_id(bridge_id)
|
||||||
|
|
||||||
await self.async_set_unique_id(bridge.id)
|
|
||||||
self._abort_if_unique_id_configured(
|
self._abort_if_unique_id_configured(
|
||||||
updates={CONF_HOST: bridge.host}, reload_on_update=False
|
updates={CONF_HOST: discovery_info.host}, reload_on_update=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.bridge = bridge
|
# we need to query the other capabilities too
|
||||||
|
self.bridge = await self._get_bridge(
|
||||||
|
discovery_info.host, discovery_info.properties["bridgeid"]
|
||||||
|
)
|
||||||
return await self.async_step_link()
|
return await self.async_step_link()
|
||||||
|
|
||||||
async def async_step_homekit(
|
async def async_step_homekit(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user