deCONZ - Allow manual configuration to update existing configuration (#30469)

* Allow manual configuration to update existing configuration

* Harmonize tests
This commit is contained in:
Robert Svensson authored and Paulus Schoutsen committed 2020-01-04 22:55:57 +01:00
1 parent 639cdf5eef
commit 967fe89f6d
3 files changed
+322 -247

No files matched your search

+10 -1
View File
@@ -147,8 +147,17 @@ class DeconzFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self.bridge_id = await async_get_bridge_id(
session, **self.deconz_config
)
for entry in self.hass.config_entries.async_entries(DOMAIN):
if self.bridge_id == entry.unique_id:
return self._update_entry(
entry,
host=self.deconz_config[CONF_HOST],
port=self.deconz_config[CONF_PORT],
api_key=self.deconz_config[CONF_API_KEY],
)
await self.async_set_unique_id(self.bridge_id)
self._abort_if_unique_id_configured()
except asyncio.TimeoutError:
return self.async_abort(reason="no_bridges")