mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use _get_reauth_entry in blue_current config flow (#127328)
This commit is contained in:
parent
da0ebbe57c
commit
74441d2771
@ -14,7 +14,12 @@ from bluecurrent_api.exceptions import (
|
||||
)
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigFlow, ConfigFlowResult
|
||||
from homeassistant.config_entries import (
|
||||
SOURCE_REAUTH,
|
||||
ConfigEntry,
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
)
|
||||
from homeassistant.const import CONF_API_TOKEN
|
||||
|
||||
from .const import DOMAIN, LOGGER
|
||||
@ -26,7 +31,7 @@ class BlueCurrentConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle the config flow for Blue Current."""
|
||||
|
||||
VERSION = 1
|
||||
_reauth_entry: ConfigEntry | None = None
|
||||
_reauth_entry: ConfigEntry
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
@ -53,7 +58,7 @@ class BlueCurrentConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors["base"] = "unknown"
|
||||
|
||||
else:
|
||||
if not self._reauth_entry:
|
||||
if self.source != SOURCE_REAUTH:
|
||||
await self.async_set_unique_id(customer_id)
|
||||
self._abort_if_unique_id_configured()
|
||||
return self.async_create_entry(title=email, data=user_input)
|
||||
@ -79,7 +84,5 @@ class BlueCurrentConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
self, entry_data: Mapping[str, Any]
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle a reauthorization flow request."""
|
||||
self._reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
self.context["entry_id"]
|
||||
)
|
||||
self._reauth_entry = self._get_reauth_entry()
|
||||
return await self.async_step_user()
|
||||
|
Loading…
x
Reference in New Issue
Block a user