mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Use _get_reauth_entry in devolo_home_network config flow (#127389)
This commit is contained in:
parent
0eec6447e4
commit
372a827ecd
@ -16,6 +16,7 @@ from homeassistant.const import CONF_IP_ADDRESS, CONF_NAME, CONF_PASSWORD
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
|
|
||||||
|
from . import DevoloHomeNetworkConfigEntry
|
||||||
from .const import DOMAIN, PRODUCT, SERIAL_NUMBER, TITLE
|
from .const import DOMAIN, PRODUCT, SERIAL_NUMBER, TITLE
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -49,6 +50,7 @@ class DevoloHomeNetworkConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
host: str
|
host: str
|
||||||
|
_reauth_entry: DevoloHomeNetworkConfigEntry
|
||||||
|
|
||||||
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
|
||||||
@ -118,11 +120,11 @@ class DevoloHomeNetworkConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle reauthentication."""
|
"""Handle reauthentication."""
|
||||||
if entry := self.hass.config_entries.async_get_entry(self.context["entry_id"]):
|
self._reauth_entry = self._get_reauth_entry()
|
||||||
self.host = entry_data[CONF_IP_ADDRESS]
|
self.host = entry_data[CONF_IP_ADDRESS]
|
||||||
placeholders = {
|
placeholders = {
|
||||||
**self.context["title_placeholders"],
|
**self.context["title_placeholders"],
|
||||||
PRODUCT: entry.runtime_data.device.product,
|
PRODUCT: self._reauth_entry.runtime_data.device.product,
|
||||||
}
|
}
|
||||||
self.context["title_placeholders"] = placeholders
|
self.context["title_placeholders"] = placeholders
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
@ -137,13 +139,8 @@ class DevoloHomeNetworkConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
data_schema=STEP_REAUTH_DATA_SCHEMA,
|
data_schema=STEP_REAUTH_DATA_SCHEMA,
|
||||||
)
|
)
|
||||||
|
|
||||||
reauth_entry = self.hass.config_entries.async_get_entry(
|
|
||||||
self.context["entry_id"]
|
|
||||||
)
|
|
||||||
assert reauth_entry is not None
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
CONF_IP_ADDRESS: self.host,
|
CONF_IP_ADDRESS: self.host,
|
||||||
CONF_PASSWORD: user_input[CONF_PASSWORD],
|
CONF_PASSWORD: user_input[CONF_PASSWORD],
|
||||||
}
|
}
|
||||||
return self.async_update_reload_and_abort(reauth_entry, data=data)
|
return self.async_update_reload_and_abort(self._reauth_entry, data=data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user