ConfigFlow default discovery without unique ID (#36754)

This commit is contained in:
Franck Nijhof 2020-06-15 13:38:38 +02:00 committed by GitHub
parent dfac9c5e03
commit 3cc94f7d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 408 additions and 170 deletions

View file

@ -205,25 +205,25 @@ class DeconzFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return await self.async_step_link()
async def async_step_hassio(self, user_input=None):
async def async_step_hassio(self, discovery_info):
"""Prepare configuration for a Hass.io deCONZ bridge.
This flow is triggered by the discovery component.
"""
LOGGER.debug("deCONZ HASSIO discovery %s", pformat(user_input))
LOGGER.debug("deCONZ HASSIO discovery %s", pformat(discovery_info))
self.bridge_id = normalize_bridge_id(user_input[CONF_SERIAL])
self.bridge_id = normalize_bridge_id(discovery_info[CONF_SERIAL])
await self.async_set_unique_id(self.bridge_id)
self._abort_if_unique_id_configured(
updates={
CONF_HOST: user_input[CONF_HOST],
CONF_PORT: user_input[CONF_PORT],
CONF_API_KEY: user_input[CONF_API_KEY],
CONF_HOST: discovery_info[CONF_HOST],
CONF_PORT: discovery_info[CONF_PORT],
CONF_API_KEY: discovery_info[CONF_API_KEY],
}
)
self._hassio_discovery = user_input
self._hassio_discovery = discovery_info
return await self.async_step_hassio_confirm()