From ed104d19272e31bd323f719fbdc7f388ccafc85f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 29 Jul 2020 09:20:06 -1000 Subject: [PATCH] Avoid error with ignored harmony config entries (#38367) --- homeassistant/components/harmony/config_flow.py | 3 +++ tests/components/harmony/test_config_flow.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/homeassistant/components/harmony/config_flow.py b/homeassistant/components/harmony/config_flow.py index 9142eed2dba..6d5adabe235 100644 --- a/homeassistant/components/harmony/config_flow.py +++ b/homeassistant/components/harmony/config_flow.py @@ -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 diff --git a/tests/components/harmony/test_config_flow.py b/tests/components/harmony/test_config_flow.py index d159a0f025f..acf1ffd16f1 100644 --- a/tests/components/harmony/test_config_flow.py +++ b/tests/components/harmony/test_config_flow.py @@ -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(