Avoid error with ignored harmony config entries (#38367)

pull/38443/head
J. Nick Koston 2020-07-29 09:20:06 -10:00 committed by Paulus Schoutsen
parent 9819d70941
commit 0ecaab1a7d
2 changed files with 6 additions and 0 deletions

View File

@ -164,6 +164,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
def _host_already_configured(self, host):
"""See if we already have a harmony entry matching the host."""
for entry in self._async_current_entries():
if CONF_HOST not in entry.data:
continue
if entry.data[CONF_HOST] == host:
return True
return False

View File

@ -153,6 +153,9 @@ async def test_form_ssdp_aborts_before_checking_remoteid_if_host_known(hass):
)
config_entry.add_to_hass(hass)
config_entry_without_host = MockConfigEntry(domain=DOMAIN, data={"name": "other"},)
config_entry_without_host.add_to_hass(hass)
harmonyapi = _get_mock_harmonyapi(connect=True)
with patch(