mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Use _get_reconfigure_entry in brother (#127279)
This commit is contained in:
parent
88ad7e98e0
commit
ddea61148f
@ -3,7 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import Any
|
||||||
|
|
||||||
from brother import Brother, SnmpError, UnsupportedModelError
|
from brother import Brother, SnmpError, UnsupportedModelError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -50,11 +50,12 @@ class BrotherConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
|
entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
self.brother: Brother
|
self.brother: Brother
|
||||||
self.host: str | None = None
|
self.host: str | None = None
|
||||||
self.entry: ConfigEntry | None = None
|
|
||||||
|
|
||||||
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
|
||||||
@ -145,13 +146,7 @@ class BrotherConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a reconfiguration flow initialized by the user."""
|
"""Handle a reconfiguration flow initialized by the user."""
|
||||||
entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
self.entry = self._get_reconfigure_entry()
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
assert entry is not None
|
|
||||||
|
|
||||||
self.entry = entry
|
|
||||||
|
|
||||||
return await self.async_step_reconfigure_confirm()
|
return await self.async_step_reconfigure_confirm()
|
||||||
|
|
||||||
async def async_step_reconfigure_confirm(
|
async def async_step_reconfigure_confirm(
|
||||||
@ -160,9 +155,6 @@ class BrotherConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
"""Handle a reconfiguration flow initialized by the user."""
|
"""Handle a reconfiguration flow initialized by the user."""
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
assert self.entry is not None
|
|
||||||
|
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
try:
|
try:
|
||||||
await validate_input(self.hass, user_input, self.entry.unique_id)
|
await validate_input(self.hass, user_input, self.entry.unique_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user