mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Use new reauth helpers in purpleair (#128719)
This commit is contained in:
parent
088cfed794
commit
004b323fd4
@ -202,7 +202,6 @@ class PurpleAirConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
self._flow_data: dict[str, Any] = {}
|
self._flow_data: dict[str, Any] = {}
|
||||||
self._reauth_entry: ConfigEntry | None = None
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
@ -265,9 +264,6 @@ class PurpleAirConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle configuration by re-auth."""
|
"""Handle configuration by re-auth."""
|
||||||
self._reauth_entry = self.hass.config_entries.async_get_entry(
|
|
||||||
self.context["entry_id"]
|
|
||||||
)
|
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
||||||
async def async_step_reauth_confirm(
|
async def async_step_reauth_confirm(
|
||||||
@ -289,15 +285,9 @@ class PurpleAirConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
errors=validation.errors,
|
errors=validation.errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert self._reauth_entry
|
return self.async_update_reload_and_abort(
|
||||||
|
self._get_reauth_entry(), data={CONF_API_KEY: api_key}
|
||||||
self.hass.config_entries.async_update_entry(
|
|
||||||
self._reauth_entry, data={CONF_API_KEY: api_key}
|
|
||||||
)
|
)
|
||||||
self.hass.async_create_task(
|
|
||||||
self.hass.config_entries.async_reload(self._reauth_entry.entry_id)
|
|
||||||
)
|
|
||||||
return self.async_abort(reason="reauth_successful")
|
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user