Abort flux_led discovery if another device gets the ip (#61074)

- If the dhcp reservation expired for the device that
  was at the ip and a new flux_led device appears we
  would discover it because the unique_id did not match
This commit is contained in:
J. Nick Koston 2021-12-05 18:41:09 -10:00 committed by GitHub
parent 40b99135e5
commit 52d6b83da8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 2 deletions

View file

@ -115,8 +115,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id(mac)
self._abort_if_unique_id_configured(updates={CONF_HOST: host})
for entry in self._async_current_entries(include_ignore=False):
if entry.data[CONF_HOST] == host and not entry.unique_id:
async_update_entry_from_discovery(self.hass, entry, device)
if entry.data[CONF_HOST] == host:
if not entry.unique_id:
async_update_entry_from_discovery(self.hass, entry, device)
return self.async_abort(reason="already_configured")
self.context[CONF_HOST] = host
for progress in self._async_in_progress():