From 9a46e802b7ab354778fe1cd45f86b623af7507e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Wed, 8 Dec 2021 10:04:13 +0100 Subject: [PATCH] Address late review of Adax (#61200) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Hjelseth Høyer --- homeassistant/components/adax/config_flow.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/adax/config_flow.py b/homeassistant/components/adax/config_flow.py index 2788b563678..e3921258426 100644 --- a/homeassistant/components/adax/config_flow.py +++ b/homeassistant/components/adax/config_flow.py @@ -75,12 +75,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): configurator = adax_local.AdaxConfig(wifi_ssid, wifi_pswd) try: - if not await configurator.configure_device(): - return self.async_show_form( - step_id="local", - data_schema=data_schema, - errors={"base": "cannot_connect"}, - ) + device_configured = await configurator.configure_device() except adax_local.HeaterNotAvailable: return self.async_abort(reason="heater_not_available") except adax_local.HeaterNotFound: @@ -88,6 +83,13 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): except adax_local.InvalidWifiCred: return self.async_abort(reason="invalid_auth") + if not device_configured: + return self.async_show_form( + step_id="local", + data_schema=data_schema, + errors={"base": "cannot_connect"}, + ) + unique_id = configurator.mac_id await self.async_set_unique_id(unique_id) self._abort_if_unique_id_configured()