Address late review of Adax (#61200)

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
pull/61241/head
Daniel Hjelseth Høyer 2021-12-08 10:04:13 +01:00 committed by GitHub
parent d5aa4a9ce1
commit 9a46e802b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -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()