Fix exception when a unifi config entry is ignored (#45735)

* Fix exception when a unifi config entry is ignored

* Fix existing test
This commit is contained in:
J. Nick Koston 2021-01-30 09:45:46 -06:00 committed by GitHub
parent 1fd3a86239
commit 88c4031e57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -244,7 +244,7 @@ class UnifiFlowHandler(config_entries.ConfigFlow, domain=UNIFI_DOMAIN):
def _host_already_configured(self, host):
"""See if we already have a unifi entry matching the host."""
for entry in self._async_current_entries():
if not entry.data:
if not entry.data or CONF_CONTROLLER not in entry.data:
continue
if entry.data[CONF_CONTROLLER][CONF_HOST] == host:
return True