mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Use new reauth helpers in sensibo (#128738)
This commit is contained in:
parent
f97d6b552b
commit
703e51d500
@ -8,7 +8,7 @@ from typing import Any
|
|||||||
from pysensibo.exceptions import AuthenticationError
|
from pysensibo.exceptions import AuthenticationError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry, ConfigFlow, ConfigFlowResult
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_API_KEY
|
from homeassistant.const import CONF_API_KEY
|
||||||
from homeassistant.helpers.selector import TextSelector
|
from homeassistant.helpers.selector import TextSelector
|
||||||
|
|
||||||
@ -27,14 +27,10 @@ class SensiboConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
VERSION = 2
|
VERSION = 2
|
||||||
|
|
||||||
entry: ConfigEntry | None
|
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(
|
||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle re-authentication with Sensibo."""
|
"""Handle re-authentication with Sensibo."""
|
||||||
|
|
||||||
self.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(
|
||||||
@ -56,13 +52,11 @@ class SensiboConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
except NoUsernameError:
|
except NoUsernameError:
|
||||||
errors["base"] = "no_username"
|
errors["base"] = "no_username"
|
||||||
else:
|
else:
|
||||||
assert self.entry is not None
|
reauth_entry = self._get_reauth_entry()
|
||||||
|
if username == reauth_entry.unique_id:
|
||||||
if username == self.entry.unique_id:
|
|
||||||
return self.async_update_reload_and_abort(
|
return self.async_update_reload_and_abort(
|
||||||
self.entry,
|
reauth_entry,
|
||||||
data={
|
data_updates={
|
||||||
**self.entry.data,
|
|
||||||
CONF_API_KEY: api_key,
|
CONF_API_KEY: api_key,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user