Skip to content

Commit

Permalink
Use _get_reauth_entry in devolo_home_network config flow (home-assist…
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Oct 3, 2024
1 parent 0eec644 commit 372a827
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions homeassistant/components/devolo_home_network/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.httpx_client import get_async_client

from . import DevoloHomeNetworkConfigEntry
from .const import DOMAIN, PRODUCT, SERIAL_NUMBER, TITLE

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -49,6 +50,7 @@ class DevoloHomeNetworkConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1

host: str
_reauth_entry: DevoloHomeNetworkConfigEntry

async def async_step_user(
self, user_input: dict[str, Any] | None = None
Expand Down Expand Up @@ -118,13 +120,13 @@ async def async_step_reauth(
self, entry_data: Mapping[str, Any]
) -> ConfigFlowResult:
"""Handle reauthentication."""
if entry := self.hass.config_entries.async_get_entry(self.context["entry_id"]):
self.host = entry_data[CONF_IP_ADDRESS]
placeholders = {
**self.context["title_placeholders"],
PRODUCT: entry.runtime_data.device.product,
}
self.context["title_placeholders"] = placeholders
self._reauth_entry = self._get_reauth_entry()
self.host = entry_data[CONF_IP_ADDRESS]
placeholders = {
**self.context["title_placeholders"],
PRODUCT: self._reauth_entry.runtime_data.device.product,
}
self.context["title_placeholders"] = placeholders
return await self.async_step_reauth_confirm()

async def async_step_reauth_confirm(
Expand All @@ -137,13 +139,8 @@ async def async_step_reauth_confirm(
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 = {
CONF_IP_ADDRESS: self.host,
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)

0 comments on commit 372a827

Please sign in to comment.