Skip to content

Commit 87c9c0c

Browse files
authored
Use new reauth helpers in whirlpool (#128825)
1 parent 0ede15d commit 87c9c0c

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

homeassistant/components/whirlpool/config_flow.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from whirlpool.auth import Auth
1313
from whirlpool.backendselector import BackendSelector
1414

15-
from homeassistant.config_entries import ConfigEntry, ConfigFlow, ConfigFlowResult
15+
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
1616
from homeassistant.const import CONF_PASSWORD, CONF_REGION, CONF_USERNAME
1717
from homeassistant.core import HomeAssistant
1818
from homeassistant.exceptions import HomeAssistantError
@@ -71,14 +71,11 @@ class WhirlpoolConfigFlow(ConfigFlow, domain=DOMAIN):
7171
"""Handle a config flow for Whirlpool Sixth Sense."""
7272

7373
VERSION = 1
74-
entry: ConfigEntry | None
7574

7675
async def async_step_reauth(
7776
self, entry_data: Mapping[str, Any]
7877
) -> ConfigFlowResult:
7978
"""Handle re-authentication with Whirlpool Sixth Sense."""
80-
81-
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
8279
return await self.async_step_reauth_confirm()
8380

8481
async def async_step_reauth_confirm(
@@ -88,10 +85,10 @@ async def async_step_reauth_confirm(
8885
errors: dict[str, str] = {}
8986

9087
if user_input:
91-
assert self.entry is not None
88+
reauth_entry = self._get_reauth_entry()
9289
password = user_input[CONF_PASSWORD]
9390
brand = user_input[CONF_BRAND]
94-
data = {**self.entry.data, CONF_PASSWORD: password, CONF_BRAND: brand}
91+
data = {**reauth_entry.data, CONF_PASSWORD: password, CONF_BRAND: brand}
9592

9693
try:
9794
await validate_input(self.hass, data)
@@ -100,9 +97,7 @@ async def async_step_reauth_confirm(
10097
except (CannotConnect, TimeoutError):
10198
errors["base"] = "cannot_connect"
10299
else:
103-
self.hass.config_entries.async_update_entry(self.entry, data=data)
104-
await self.hass.config_entries.async_reload(self.entry.entry_id)
105-
return self.async_abort(reason="reauth_successful")
100+
return self.async_update_reload_and_abort(reauth_entry, data=data)
106101

107102
return self.async_show_form(
108103
step_id="reauth_confirm",

0 commit comments

Comments
 (0)