Migrate integrations u-z to generic flowhandler (#111866)
This commit is contained in:
parent
e06446d0fa
commit
9ec9ac4fd4
64 changed files with 577 additions and 454 deletions
|
@ -9,17 +9,21 @@ import requests.exceptions
|
|||
import upcloud_api
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.config_entries import (
|
||||
ConfigEntry,
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
)
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResult
|
||||
|
||||
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class UpCloudConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
class UpCloudConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""UpCloud config flow."""
|
||||
|
||||
VERSION = 1
|
||||
|
@ -29,7 +33,7 @@ class UpCloudConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> FlowResult:
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle user initiated flow."""
|
||||
if user_input is None:
|
||||
return self._async_show_form(step_id="user")
|
||||
|
@ -66,7 +70,7 @@ class UpCloudConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
step_id: str,
|
||||
user_input: dict[str, Any] | None = None,
|
||||
errors: dict[str, str] | None = None,
|
||||
) -> FlowResult:
|
||||
) -> ConfigFlowResult:
|
||||
"""Show our form."""
|
||||
if user_input is None:
|
||||
user_input = {}
|
||||
|
@ -88,22 +92,22 @@ class UpCloudConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
config_entry: config_entries.ConfigEntry,
|
||||
config_entry: ConfigEntry,
|
||||
) -> UpCloudOptionsFlow:
|
||||
"""Get options flow."""
|
||||
return UpCloudOptionsFlow(config_entry)
|
||||
|
||||
|
||||
class UpCloudOptionsFlow(config_entries.OptionsFlow):
|
||||
class UpCloudOptionsFlow(OptionsFlow):
|
||||
"""UpCloud options flow."""
|
||||
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||
"""Initialize options flow."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> FlowResult:
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle options flow."""
|
||||
|
||||
if user_input is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue