From 5a1b0edd9655d9e1700c0ed51d8ddac6cde6111e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 28 Mar 2020 11:23:39 -0500 Subject: [PATCH] =?UTF-8?q?Add=20inline=20comments=20to=20elkm1=20about=20?= =?UTF-8?q?how=20config=20is=20updated=20from=E2=80=A6=20(#33361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homeassistant/components/elkm1/__init__.py | 5 +++++ tests/components/elkm1/test_config_flow.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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} )