diff --git a/homeassistant/components/elkm1/__init__.py b/homeassistant/components/elkm1/__init__.py index 2f08b046d9c..183897d306e 100644 --- a/homeassistant/components/elkm1/__init__.py +++ b/homeassistant/components/elkm1/__init__.py @@ -149,6 +149,11 @@ async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool: for index, conf in enumerate(hass_config[DOMAIN]): _LOGGER.debug("Importing elkm1 #%d - %s", index, conf[CONF_HOST]) + + # The update of the config entry is done in async_setup + # to ensure the entry if updated before async_setup_entry + # is called to avoid a situation where the user has to restart + # twice for the changes to take effect current_config_entry = _async_find_matching_config_entry( hass, conf[CONF_PREFIX] ) diff --git a/tests/components/elkm1/test_config_flow.py b/tests/components/elkm1/test_config_flow.py index 466005f3d43..02e3fd7fce9 100644 --- a/tests/components/elkm1/test_config_flow.py +++ b/tests/components/elkm1/test_config_flow.py @@ -176,7 +176,7 @@ async def test_form_cannot_connect(hass): async def test_form_invalid_auth(hass): - """Test we handle cannot connect error.""" + """Test we handle invalid auth error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} )