mirror of
https://github.com/home-assistant/core.git
synced 2025-05-04 14:09:16 +00:00
Use async_start_reauth in xiaomi_miio (#129282)
* Use async_start_reauth in xiaomi_miio * Apply suggestions from code review Co-authored-by: Teemu R. <tpr@iki.fi> --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
parent
87f2a4242e
commit
320aa34d39
@ -13,7 +13,6 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components import zeroconf
|
from homeassistant.components import zeroconf
|
||||||
from homeassistant.config_entries import (
|
from homeassistant.config_entries import (
|
||||||
SOURCE_REAUTH,
|
|
||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
@ -83,14 +82,7 @@ class OptionsFlowHandler(OptionsFlow):
|
|||||||
not cloud_username or not cloud_password or not cloud_country
|
not cloud_username or not cloud_password or not cloud_country
|
||||||
):
|
):
|
||||||
errors["base"] = "cloud_credentials_incomplete"
|
errors["base"] = "cloud_credentials_incomplete"
|
||||||
# trigger re-auth flow
|
self.config_entry.async_start_reauth(self.hass)
|
||||||
self.hass.async_create_task(
|
|
||||||
self.hass.config_entries.flow.async_init(
|
|
||||||
DOMAIN,
|
|
||||||
context={"source": SOURCE_REAUTH},
|
|
||||||
data=self.config_entry.data,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if not errors:
|
if not errors:
|
||||||
return self.async_create_entry(title="", data=user_input)
|
return self.async_create_entry(title="", data=user_input)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user