Change dict[str, Any] to FlowResultDict (#49546)
parent
686c92097f
commit
48695869f9
|
@ -2,13 +2,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from bsblan import BSBLan, BSBLanError, Info
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
|
@ -25,7 +25,7 @@ class BSBLanFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if user_input is None:
|
||||
return self._show_setup_form()
|
||||
|
@ -57,7 +57,7 @@ class BSBLanFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
},
|
||||
)
|
||||
|
||||
def _show_setup_form(self, errors: dict | None = None) -> dict[str, Any]:
|
||||
def _show_setup_form(self, errors: dict | None = None) -> FlowResultDict:
|
||||
"""Show the setup form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
|
|
|
@ -11,6 +11,7 @@ import voluptuous as vol
|
|||
from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL, ConfigFlow, OptionsFlow
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
|
@ -52,13 +53,13 @@ class CanaryConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_import(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by configuration file."""
|
||||
return await self.async_step_user(user_input)
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if self._async_current_entries():
|
||||
return self.async_abort(reason="single_instance_allowed")
|
||||
|
|
|
@ -22,6 +22,7 @@ from homeassistant.const import (
|
|||
CONF_NAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -89,7 +90,7 @@ class ClimaCellOptionsConfigFlow(config_entries.OptionsFlow):
|
|||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Manage the ClimaCell options."""
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(title="", data=user_input)
|
||||
|
@ -122,7 +123,7 @@ class ClimaCellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle the initial step."""
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
|
|
|
@ -6,6 +6,7 @@ from typing import Any
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
|
||||
from . import get_coordinator
|
||||
from .const import DOMAIN, OPTION_WORLDWIDE
|
||||
|
@ -21,7 +22,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle the initial step."""
|
||||
errors = {}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ from homeassistant import config_entries
|
|||
from homeassistant.components import ssdp
|
||||
from homeassistant.const import CONF_HOST, CONF_TYPE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.httpx_client import get_async_client
|
||||
|
||||
from .receiver import ConnectDenonAVR
|
||||
|
@ -134,7 +135,7 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_select(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle multiple receivers found."""
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
|
@ -155,7 +156,7 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Allow the user to confirm adding the device."""
|
||||
if user_input is not None:
|
||||
return await self.async_step_connect()
|
||||
|
@ -165,7 +166,7 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_connect(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Connect to the receiver."""
|
||||
connect_denonavr = ConnectDenonAVR(
|
||||
self.host,
|
||||
|
@ -214,7 +215,7 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
},
|
||||
)
|
||||
|
||||
async def async_step_ssdp(self, discovery_info: dict[str, Any]) -> dict[str, Any]:
|
||||
async def async_step_ssdp(self, discovery_info: dict[str, Any]) -> FlowResultDict:
|
||||
"""Handle a discovered Denon AVR.
|
||||
|
||||
This flow is triggered by the SSDP component. It will check if the
|
||||
|
|
|
@ -12,6 +12,7 @@ from homeassistant.components.ssdp import ATTR_SSDP_LOCATION, ATTR_UPNP_SERIAL
|
|||
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
|
@ -47,7 +48,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if user_input is None:
|
||||
return self._show_setup_form()
|
||||
|
@ -69,7 +70,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_ssdp(
|
||||
self, discovery_info: DiscoveryInfoType
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle SSDP discovery."""
|
||||
host = urlparse(discovery_info[ATTR_SSDP_LOCATION]).hostname
|
||||
receiver_id = None
|
||||
|
@ -102,7 +103,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_ssdp_confirm(
|
||||
self, user_input: ConfigType = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a confirmation flow initiated by SSDP."""
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
|
@ -116,7 +117,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
data=self.discovery_info,
|
||||
)
|
||||
|
||||
def _show_setup_form(self, errors: dict | None = None) -> dict[str, Any]:
|
||||
def _show_setup_form(self, errors: dict | None = None) -> FlowResultDict:
|
||||
"""Show the setup form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
|
|
|
@ -9,6 +9,7 @@ import voluptuous as vol
|
|||
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import CONF_SERIAL_NUMBER, DOMAIN
|
||||
|
@ -26,7 +27,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if user_input is None:
|
||||
return self._async_show_setup_form()
|
||||
|
@ -43,7 +44,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_zeroconf(
|
||||
self, discovery_info: dict[str, Any]
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle zeroconf discovery."""
|
||||
self.host = discovery_info[CONF_HOST]
|
||||
self.port = discovery_info[CONF_PORT]
|
||||
|
@ -61,14 +62,14 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_zeroconf_confirm(
|
||||
self, _: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by zeroconf."""
|
||||
return self._async_create_entry()
|
||||
|
||||
@callback
|
||||
def _async_show_setup_form(
|
||||
self, errors: dict[str, str] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Show the setup form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
|
@ -82,7 +83,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
)
|
||||
|
||||
@callback
|
||||
def _async_create_entry(self) -> dict[str, Any]:
|
||||
def _async_create_entry(self) -> FlowResultDict:
|
||||
return self.async_create_entry(
|
||||
title=self.serial_number,
|
||||
data={
|
||||
|
|
|
@ -17,6 +17,7 @@ from homeassistant.const import (
|
|||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.httpx_client import get_async_client
|
||||
|
||||
|
@ -131,7 +132,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle the initial step."""
|
||||
errors = {}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
"""Config flow to configure the HomematicIP Cloud component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
|
||||
from .const import (
|
||||
_LOGGER,
|
||||
|
@ -29,11 +28,11 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow):
|
|||
"""Initialize HomematicIP Cloud config flow."""
|
||||
self.auth = None
|
||||
|
||||
async def async_step_user(self, user_input=None) -> dict[str, Any]:
|
||||
async def async_step_user(self, user_input=None) -> FlowResultDict:
|
||||
"""Handle a flow initialized by the user."""
|
||||
return await self.async_step_init(user_input)
|
||||
|
||||
async def async_step_init(self, user_input=None) -> dict[str, Any]:
|
||||
async def async_step_init(self, user_input=None) -> FlowResultDict:
|
||||
"""Handle a flow start."""
|
||||
errors = {}
|
||||
|
||||
|
@ -64,7 +63,7 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow):
|
|||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_link(self, user_input=None) -> dict[str, Any]:
|
||||
async def async_step_link(self, user_input=None) -> FlowResultDict:
|
||||
"""Attempt to link with the HomematicIP Cloud access point."""
|
||||
errors = {}
|
||||
|
||||
|
@ -86,7 +85,7 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow):
|
|||
|
||||
return self.async_show_form(step_id="link", errors=errors)
|
||||
|
||||
async def async_step_import(self, import_info) -> dict[str, Any]:
|
||||
async def async_step_import(self, import_info) -> FlowResultDict:
|
||||
"""Import a new access point as a config entry."""
|
||||
hapid = import_info[HMIPC_HAPID].replace("-", "").upper()
|
||||
authtoken = import_info[HMIPC_AUTHTOKEN]
|
||||
|
|
|
@ -14,6 +14,7 @@ from homeassistant import config_entries, core
|
|||
from homeassistant.components import ssdp
|
||||
from homeassistant.const import CONF_HOST, CONF_USERNAME
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers import aiohttp_client
|
||||
|
||||
from .bridge import authenticate_bridge
|
||||
|
@ -117,7 +118,7 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_manual(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle manual bridge setup."""
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
|
@ -252,7 +253,7 @@ class HueOptionsFlowHandler(config_entries.OptionsFlow):
|
|||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Manage Hue options."""
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(title="", data=user_input)
|
||||
|
|
|
@ -23,6 +23,7 @@ from homeassistant.const import (
|
|||
CONF_SSL,
|
||||
CONF_VERIFY_SSL,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
|
||||
|
@ -63,7 +64,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if user_input is None:
|
||||
return self._show_setup_form()
|
||||
|
@ -99,7 +100,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
return self.async_create_entry(title=user_input[CONF_HOST], data=user_input)
|
||||
|
||||
async def async_step_zeroconf(self, discovery_info: ConfigType) -> dict[str, Any]:
|
||||
async def async_step_zeroconf(self, discovery_info: ConfigType) -> FlowResultDict:
|
||||
"""Handle zeroconf discovery."""
|
||||
port = discovery_info[CONF_PORT]
|
||||
zctype = discovery_info["type"]
|
||||
|
@ -167,7 +168,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_zeroconf_confirm(
|
||||
self, user_input: ConfigType = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a confirmation flow initiated by zeroconf."""
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
|
@ -181,7 +182,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
data=self.discovery_info,
|
||||
)
|
||||
|
||||
def _show_setup_form(self, errors: dict | None = None) -> dict[str, Any]:
|
||||
def _show_setup_form(self, errors: dict | None = None) -> FlowResultDict:
|
||||
"""Show the setup form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
|
|
|
@ -10,6 +10,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import CONF_PORT
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
@ -21,7 +22,7 @@ class LiteJetConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Create a LiteJet config entry based upon user input."""
|
||||
if self.hass.config_entries.async_entries(DOMAIN):
|
||||
return self.async_abort(reason="single_instance_allowed")
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
"""Config flow to configure Met component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import (
|
||||
|
@ -81,7 +80,7 @@ class MetFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
errors=self._errors,
|
||||
)
|
||||
|
||||
async def async_step_import(self, user_input: dict | None = None) -> dict[str, Any]:
|
||||
async def async_step_import(self, user_input: dict | None = None) -> FlowResultDict:
|
||||
"""Handle configuration by yaml file."""
|
||||
return await self.async_step_user(user_input)
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ from homeassistant.components.mysensors import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from . import CONF_RETAIN, CONF_VERSION, DEFAULT_VERSION
|
||||
|
@ -281,7 +282,7 @@ class MySensorsConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
@callback
|
||||
def _async_create_entry(
|
||||
self, user_input: dict[str, str] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Create the config entry."""
|
||||
return self.async_create_entry(
|
||||
title=f"{user_input[CONF_DEVICE]}",
|
||||
|
|
|
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||
CONF_VERIFY_SSL,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
|
@ -66,7 +67,7 @@ class NZBGetConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_import(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by configuration file."""
|
||||
if CONF_SCAN_INTERVAL in user_input:
|
||||
user_input[CONF_SCAN_INTERVAL] = user_input[
|
||||
|
@ -77,7 +78,7 @@ class NZBGetConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if self._async_current_entries():
|
||||
return self.async_abort(reason="single_instance_allowed")
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aiohttp import ContentTypeError
|
||||
from requests.exceptions import ConnectTimeout, HTTPError
|
||||
|
@ -10,6 +9,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -37,7 +37,7 @@ class PlumLightpadConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initialized by the user or redirected to by import."""
|
||||
if not user_input:
|
||||
return self._show_form()
|
||||
|
@ -61,6 +61,6 @@ class PlumLightpadConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_import(
|
||||
self, import_config: ConfigType | None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Import a config entry from configuration.yaml."""
|
||||
return await self.async_step_user(import_config)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from rokuecp import Roku, RokuError
|
||||
|
@ -16,6 +15,7 @@ from homeassistant.components.ssdp import (
|
|||
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -54,7 +54,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
self.discovery_info = {}
|
||||
|
||||
@callback
|
||||
def _show_form(self, errors: dict | None = None) -> dict[str, Any]:
|
||||
def _show_form(self, errors: dict | None = None) -> FlowResultDict:
|
||||
"""Show the form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
|
@ -62,7 +62,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
errors=errors or {},
|
||||
)
|
||||
|
||||
async def async_step_user(self, user_input: dict | None = None) -> dict[str, Any]:
|
||||
async def async_step_user(self, user_input: dict | None = None) -> FlowResultDict:
|
||||
"""Handle a flow initialized by the user."""
|
||||
if not user_input:
|
||||
return self._show_form()
|
||||
|
@ -115,7 +115,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_ssdp(
|
||||
self, discovery_info: dict | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initialized by discovery."""
|
||||
host = urlparse(discovery_info[ATTR_SSDP_LOCATION]).hostname
|
||||
name = discovery_info[ATTR_UPNP_FRIENDLY_NAME]
|
||||
|
@ -141,7 +141,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_discovery_confirm(
|
||||
self, user_input: dict | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle user-confirmation of discovered device."""
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
|
|
|
@ -7,6 +7,7 @@ from rpi_bad_power import new_under_voltage
|
|||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.config_entry_flow import DiscoveryFlowHandler
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -34,7 +35,7 @@ class RPiPowerFlow(DiscoveryFlowHandler, domain=DOMAIN):
|
|||
|
||||
async def async_step_onboarding(
|
||||
self, data: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initialized by onboarding."""
|
||||
has_devices = await self._discovery_function(self.hass)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
|
||||
from .const import (
|
||||
CONF_DSN,
|
||||
|
@ -48,7 +49,7 @@ class SentryConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a user config flow."""
|
||||
if self._async_current_entries():
|
||||
return self.async_abort(reason="single_instance_allowed")
|
||||
|
@ -79,7 +80,7 @@ class SentryOptionsFlow(config_entries.OptionsFlow):
|
|||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Manage Sentry options."""
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(title="", data=user_input)
|
||||
|
|
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
|||
CONF_SSL,
|
||||
CONF_VERIFY_SSL,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -68,7 +69,7 @@ class SmaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""First step in config flow."""
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
|
@ -117,7 +118,7 @@ class SmaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_import(
|
||||
self, import_config: dict[str, Any] | None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Import a config flow from configuration."""
|
||||
device_info = await validate_input(self.hass, import_config)
|
||||
import_config[DEVICE_INFO] = device_info
|
||||
|
|
|
@ -10,6 +10,7 @@ import voluptuous as vol
|
|||
from homeassistant import config_entries
|
||||
from homeassistant.const import CONF_API_KEY, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.util import slugify
|
||||
|
||||
from .const import CONF_SITE_ID, DEFAULT_NAME, DOMAIN
|
||||
|
@ -56,7 +57,7 @@ class SolarEdgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Step when user initializes a integration."""
|
||||
self._errors = {}
|
||||
if user_input is not None:
|
||||
|
@ -92,7 +93,7 @@ class SolarEdgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_import(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Import a config entry."""
|
||||
if self._site_in_configuration_exists(user_input[CONF_SITE_ID]):
|
||||
return self.async_abort(reason="already_configured")
|
||||
|
|
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
|||
CONF_VERIFY_SSL,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
|
@ -75,7 +76,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
"""Get the options flow for this handler."""
|
||||
return SonarrOptionsFlowHandler(config_entry)
|
||||
|
||||
async def async_step_reauth(self, data: ConfigType | None = None) -> dict[str, Any]:
|
||||
async def async_step_reauth(self, data: ConfigType | None = None) -> FlowResultDict:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._reauth = True
|
||||
self._entry_data = dict(data)
|
||||
|
@ -86,7 +87,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Confirm reauth dialog."""
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
|
@ -100,7 +101,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
errors = {}
|
||||
|
||||
|
@ -139,7 +140,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def _async_reauth_update_entry(
|
||||
self, entry_id: str, data: dict
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Update existing config entry."""
|
||||
entry = self.hass.config_entries.async_get_entry(entry_id)
|
||||
self.hass.config_entries.async_update_entry(entry, data=data)
|
||||
|
|
|
@ -9,6 +9,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components import persistent_notification
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
|
||||
from .const import DOMAIN, SPOTIFY_SCOPES
|
||||
|
@ -38,7 +39,7 @@ class SpotifyFlowHandler(
|
|||
"""Extra data that needs to be appended to the authorize url."""
|
||||
return {"scope": ",".join(SPOTIFY_SCOPES)}
|
||||
|
||||
async def async_oauth_create_entry(self, data: dict[str, Any]) -> dict[str, Any]:
|
||||
async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResultDict:
|
||||
"""Create an entry for Spotify."""
|
||||
spotify = Spotify(auth=data["token"]["access_token"])
|
||||
|
||||
|
@ -60,7 +61,7 @@ class SpotifyFlowHandler(
|
|||
|
||||
return self.async_create_entry(title=name, data=data)
|
||||
|
||||
async def async_step_reauth(self, entry: dict[str, Any]) -> dict[str, Any]:
|
||||
async def async_step_reauth(self, entry: dict[str, Any]) -> FlowResultDict:
|
||||
"""Perform reauth upon migration of old entries."""
|
||||
if entry:
|
||||
self.entry = entry
|
||||
|
@ -76,7 +77,7 @@ class SpotifyFlowHandler(
|
|||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Confirm reauth dialog."""
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
|
|
|
@ -8,6 +8,7 @@ from toonapi import Agreement, Toon, ToonError
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.config_entry_oauth2_flow import AbstractOAuth2FlowHandler
|
||||
|
||||
|
@ -29,7 +30,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
|
|||
"""Return logger."""
|
||||
return logging.getLogger(__name__)
|
||||
|
||||
async def async_oauth_create_entry(self, data: dict[str, Any]) -> dict[str, Any]:
|
||||
async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResultDict:
|
||||
"""Test connection and load up agreements."""
|
||||
self.data = data
|
||||
|
||||
|
@ -49,7 +50,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
|
|||
|
||||
async def async_step_import(
|
||||
self, config: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Start a configuration flow based on imported data.
|
||||
|
||||
This step is merely here to trigger "discovery" when the `toon`
|
||||
|
@ -66,7 +67,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
|
|||
|
||||
async def async_step_agreement(
|
||||
self, user_input: dict[str, Any] = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Select Toon agreement to add."""
|
||||
if len(self.agreements) == 1:
|
||||
return await self._create_entry(self.agreements[0])
|
||||
|
@ -87,7 +88,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
|
|||
agreement_index = agreements_list.index(user_input[CONF_AGREEMENT])
|
||||
return await self._create_entry(self.agreements[agreement_index])
|
||||
|
||||
async def _create_entry(self, agreement: Agreement) -> dict[str, Any]:
|
||||
async def _create_entry(self, agreement: Agreement) -> FlowResultDict:
|
||||
if CONF_MIGRATE in self.context:
|
||||
await self.hass.config_entries.async_remove(self.context[CONF_MIGRATE])
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import voluptuous as vol
|
|||
from homeassistant import config_entries
|
||||
from homeassistant.config_entries import ConfigFlow
|
||||
from homeassistant.const import CONF_ID
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import CONF_HOUSE_LETTER, CONF_HOUSE_NUMBER, CONF_POST_CODE, DOMAIN
|
||||
|
@ -26,7 +27,7 @@ class TwenteMilieuFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def _show_setup_form(
|
||||
self, errors: dict[str, str] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Show the setup form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
|
@ -42,7 +43,7 @@ class TwenteMilieuFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if user_input is None:
|
||||
return await self._show_setup_form(user_input)
|
||||
|
|
|
@ -19,6 +19,7 @@ from homeassistant.config_entries import (
|
|||
)
|
||||
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
|
||||
from .const import (
|
||||
CONF_GIID,
|
||||
|
@ -57,7 +58,7 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle the initial step."""
|
||||
errors: dict[str, str] = {}
|
||||
|
||||
|
@ -96,7 +97,7 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_installation(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Select Verisure installation to add."""
|
||||
if len(self.installations) == 1:
|
||||
user_input = {CONF_GIID: list(self.installations)[0]}
|
||||
|
@ -124,14 +125,14 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
},
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: dict[str, Any]) -> dict[str, Any]:
|
||||
async def async_step_reauth(self, data: dict[str, Any]) -> FlowResultDict:
|
||||
"""Handle initiation of re-authentication with Verisure."""
|
||||
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle re-authentication with Verisure."""
|
||||
errors: dict[str, str] = {}
|
||||
|
||||
|
@ -173,7 +174,7 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_import(self, user_input: dict[str, Any]) -> dict[str, Any]:
|
||||
async def async_step_import(self, user_input: dict[str, Any]) -> FlowResultDict:
|
||||
"""Import Verisure YAML configuration."""
|
||||
if user_input[CONF_GIID]:
|
||||
self.giid = user_input[CONF_GIID]
|
||||
|
@ -203,7 +204,7 @@ class VerisureOptionsFlowHandler(OptionsFlow):
|
|||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Manage Verisure options."""
|
||||
errors = {}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ from homeassistant.const import (
|
|||
CONF_TYPE,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import DiscoveryInfoType
|
||||
|
@ -111,7 +112,7 @@ class VizioOptionsConfigFlow(config_entries.OptionsFlow):
|
|||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Manage the vizio options."""
|
||||
if user_input is not None:
|
||||
if user_input.get(CONF_APPS_TO_INCLUDE_OR_EXCLUDE):
|
||||
|
@ -193,7 +194,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
self._data = None
|
||||
self._apps = {}
|
||||
|
||||
async def _create_entry(self, input_dict: dict[str, Any]) -> dict[str, Any]:
|
||||
async def _create_entry(self, input_dict: dict[str, Any]) -> FlowResultDict:
|
||||
"""Create vizio config entry."""
|
||||
# Remove extra keys that will not be used by entry setup
|
||||
input_dict.pop(CONF_APPS_TO_INCLUDE_OR_EXCLUDE, None)
|
||||
|
@ -206,7 +207,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initialized by the user."""
|
||||
errors = {}
|
||||
|
||||
|
@ -279,7 +280,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
return self.async_show_form(step_id="user", data_schema=schema, errors=errors)
|
||||
|
||||
async def async_step_import(self, import_config: dict[str, Any]) -> dict[str, Any]:
|
||||
async def async_step_import(self, import_config: dict[str, Any]) -> FlowResultDict:
|
||||
"""Import a config entry from configuration.yaml."""
|
||||
# Check if new config entry matches any existing config entries
|
||||
for entry in self.hass.config_entries.async_entries(DOMAIN):
|
||||
|
@ -343,7 +344,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_zeroconf(
|
||||
self, discovery_info: DiscoveryInfoType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle zeroconf discovery."""
|
||||
# If host already has port, no need to add it again
|
||||
if ":" not in discovery_info[CONF_HOST]:
|
||||
|
@ -380,7 +381,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_pair_tv(
|
||||
self, user_input: dict[str, Any] = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""
|
||||
Start pairing process for TV.
|
||||
|
||||
|
@ -445,7 +446,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
errors=errors,
|
||||
)
|
||||
|
||||
async def _pairing_complete(self, step_id: str) -> dict[str, Any]:
|
||||
async def _pairing_complete(self, step_id: str) -> FlowResultDict:
|
||||
"""Handle config flow completion."""
|
||||
if not self._must_show_form:
|
||||
return await self._create_entry(self._data)
|
||||
|
@ -459,7 +460,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_pairing_complete(
|
||||
self, user_input: dict[str, Any] = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""
|
||||
Complete non-import sourced config flow.
|
||||
|
||||
|
@ -469,7 +470,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_pairing_complete_import(
|
||||
self, user_input: dict[str, Any] = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""
|
||||
Complete import sourced config flow.
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"""Config flow to configure the WLED integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
from wled import WLED, WLEDConnectionError
|
||||
|
||||
|
@ -12,6 +10,7 @@ from homeassistant.config_entries import (
|
|||
ConfigFlow,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
|
@ -26,13 +25,13 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by the user."""
|
||||
return await self._handle_config_flow(user_input)
|
||||
|
||||
async def async_step_zeroconf(
|
||||
self, discovery_info: ConfigType | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle zeroconf discovery."""
|
||||
if discovery_info is None:
|
||||
return self.async_abort(reason="cannot_connect")
|
||||
|
@ -55,13 +54,13 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_zeroconf_confirm(
|
||||
self, user_input: ConfigType = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle a flow initiated by zeroconf."""
|
||||
return await self._handle_config_flow(user_input)
|
||||
|
||||
async def _handle_config_flow(
|
||||
self, user_input: ConfigType | None = None, prepare: bool = False
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Config flow handler for WLED."""
|
||||
source = self.context.get("source")
|
||||
|
||||
|
@ -102,7 +101,7 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
data={CONF_HOST: user_input[CONF_HOST], CONF_MAC: user_input[CONF_MAC]},
|
||||
)
|
||||
|
||||
def _show_setup_form(self, errors: dict | None = None) -> dict[str, Any]:
|
||||
def _show_setup_form(self, errors: dict | None = None) -> FlowResultDict:
|
||||
"""Show the setup form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
|
@ -110,7 +109,7 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
errors=errors or {},
|
||||
)
|
||||
|
||||
def _show_confirm_dialog(self, errors: dict | None = None) -> dict[str, Any]:
|
||||
def _show_confirm_dialog(self, errors: dict | None = None) -> FlowResultDict:
|
||||
"""Show the confirm dialog to the user."""
|
||||
name = self.context.get(CONF_NAME)
|
||||
return self.async_show_form(
|
||||
|
|
|
@ -8,6 +8,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultDict
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -69,7 +70,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResultDict:
|
||||
"""Handle the initial step."""
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
|
|
Loading…
Reference in New Issue