diff --git a/homeassistant/components/bsblan/config_flow.py b/homeassistant/components/bsblan/config_flow.py index f5df1df0437..9ccad6089b2 100644 --- a/homeassistant/components/bsblan/config_flow.py +++ b/homeassistant/components/bsblan/config_flow.py @@ -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", diff --git a/homeassistant/components/canary/config_flow.py b/homeassistant/components/canary/config_flow.py index d02be83a7ee..f01c558024e 100644 --- a/homeassistant/components/canary/config_flow.py +++ b/homeassistant/components/canary/config_flow.py @@ -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") diff --git a/homeassistant/components/climacell/config_flow.py b/homeassistant/components/climacell/config_flow.py index 69cf0c052a1..5c5bb86a479 100644 --- a/homeassistant/components/climacell/config_flow.py +++ b/homeassistant/components/climacell/config_flow.py @@ -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: diff --git a/homeassistant/components/coronavirus/config_flow.py b/homeassistant/components/coronavirus/config_flow.py index 4f6e865fa37..4bf1dcd56b9 100644 --- a/homeassistant/components/coronavirus/config_flow.py +++ b/homeassistant/components/coronavirus/config_flow.py @@ -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 = {} diff --git a/homeassistant/components/denonavr/config_flow.py b/homeassistant/components/denonavr/config_flow.py index 695c323e1f7..190c5e55af9 100644 --- a/homeassistant/components/denonavr/config_flow.py +++ b/homeassistant/components/denonavr/config_flow.py @@ -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 diff --git a/homeassistant/components/directv/config_flow.py b/homeassistant/components/directv/config_flow.py index 3b8b5913716..78e44f2f1ee 100644 --- a/homeassistant/components/directv/config_flow.py +++ b/homeassistant/components/directv/config_flow.py @@ -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", diff --git a/homeassistant/components/elgato/config_flow.py b/homeassistant/components/elgato/config_flow.py index afdbe7e1cdc..2f3e25d4fb5 100644 --- a/homeassistant/components/elgato/config_flow.py +++ b/homeassistant/components/elgato/config_flow.py @@ -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={ diff --git a/homeassistant/components/enphase_envoy/config_flow.py b/homeassistant/components/enphase_envoy/config_flow.py index a47a095fde7..5f8fdcfd0e7 100644 --- a/homeassistant/components/enphase_envoy/config_flow.py +++ b/homeassistant/components/enphase_envoy/config_flow.py @@ -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 = {} diff --git a/homeassistant/components/homematicip_cloud/config_flow.py b/homeassistant/components/homematicip_cloud/config_flow.py index d90d8d7023b..4e18e4fdb6b 100644 --- a/homeassistant/components/homematicip_cloud/config_flow.py +++ b/homeassistant/components/homematicip_cloud/config_flow.py @@ -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] diff --git a/homeassistant/components/hue/config_flow.py b/homeassistant/components/hue/config_flow.py index 9fd025d7b6a..1864d724b8c 100644 --- a/homeassistant/components/hue/config_flow.py +++ b/homeassistant/components/hue/config_flow.py @@ -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) diff --git a/homeassistant/components/ipp/config_flow.py b/homeassistant/components/ipp/config_flow.py index d2624931ea0..7c8a394731d 100644 --- a/homeassistant/components/ipp/config_flow.py +++ b/homeassistant/components/ipp/config_flow.py @@ -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", diff --git a/homeassistant/components/litejet/config_flow.py b/homeassistant/components/litejet/config_flow.py index 124b229c786..d453d6a90aa 100644 --- a/homeassistant/components/litejet/config_flow.py +++ b/homeassistant/components/litejet/config_flow.py @@ -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") diff --git a/homeassistant/components/met/config_flow.py b/homeassistant/components/met/config_flow.py index 5cfd71ea801..895a6e33d2d 100644 --- a/homeassistant/components/met/config_flow.py +++ b/homeassistant/components/met/config_flow.py @@ -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) diff --git a/homeassistant/components/mysensors/config_flow.py b/homeassistant/components/mysensors/config_flow.py index 4fd52f29bf3..5299b76d2f5 100644 --- a/homeassistant/components/mysensors/config_flow.py +++ b/homeassistant/components/mysensors/config_flow.py @@ -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]}", diff --git a/homeassistant/components/nzbget/config_flow.py b/homeassistant/components/nzbget/config_flow.py index 980fbc1b2f9..c0feffd9cef 100644 --- a/homeassistant/components/nzbget/config_flow.py +++ b/homeassistant/components/nzbget/config_flow.py @@ -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") diff --git a/homeassistant/components/plum_lightpad/config_flow.py b/homeassistant/components/plum_lightpad/config_flow.py index 40432810cc5..f5ff0f2e06d 100644 --- a/homeassistant/components/plum_lightpad/config_flow.py +++ b/homeassistant/components/plum_lightpad/config_flow.py @@ -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) diff --git a/homeassistant/components/roku/config_flow.py b/homeassistant/components/roku/config_flow.py index d10e22cd1bc..ae79c214d3f 100644 --- a/homeassistant/components/roku/config_flow.py +++ b/homeassistant/components/roku/config_flow.py @@ -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( diff --git a/homeassistant/components/rpi_power/config_flow.py b/homeassistant/components/rpi_power/config_flow.py index b635972f43f..01e789f23b7 100644 --- a/homeassistant/components/rpi_power/config_flow.py +++ b/homeassistant/components/rpi_power/config_flow.py @@ -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) diff --git a/homeassistant/components/sentry/config_flow.py b/homeassistant/components/sentry/config_flow.py index b294fa46236..115a4747a7a 100644 --- a/homeassistant/components/sentry/config_flow.py +++ b/homeassistant/components/sentry/config_flow.py @@ -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) diff --git a/homeassistant/components/sma/config_flow.py b/homeassistant/components/sma/config_flow.py index e4186ec987e..95be954dba5 100644 --- a/homeassistant/components/sma/config_flow.py +++ b/homeassistant/components/sma/config_flow.py @@ -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 diff --git a/homeassistant/components/solaredge/config_flow.py b/homeassistant/components/solaredge/config_flow.py index eecd11d7b12..07f987fb009 100644 --- a/homeassistant/components/solaredge/config_flow.py +++ b/homeassistant/components/solaredge/config_flow.py @@ -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") diff --git a/homeassistant/components/sonarr/config_flow.py b/homeassistant/components/sonarr/config_flow.py index acee381591c..7b1d991c871 100644 --- a/homeassistant/components/sonarr/config_flow.py +++ b/homeassistant/components/sonarr/config_flow.py @@ -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) diff --git a/homeassistant/components/spotify/config_flow.py b/homeassistant/components/spotify/config_flow.py index d0fb73e18bd..0fb23f7c56f 100644 --- a/homeassistant/components/spotify/config_flow.py +++ b/homeassistant/components/spotify/config_flow.py @@ -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( diff --git a/homeassistant/components/toon/config_flow.py b/homeassistant/components/toon/config_flow.py index bc673d2d181..ee76f6472ce 100644 --- a/homeassistant/components/toon/config_flow.py +++ b/homeassistant/components/toon/config_flow.py @@ -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]) diff --git a/homeassistant/components/twentemilieu/config_flow.py b/homeassistant/components/twentemilieu/config_flow.py index 25cdd57b26d..7dedf705f91 100644 --- a/homeassistant/components/twentemilieu/config_flow.py +++ b/homeassistant/components/twentemilieu/config_flow.py @@ -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) diff --git a/homeassistant/components/verisure/config_flow.py b/homeassistant/components/verisure/config_flow.py index 3a434cd8b48..6e984d72e2d 100644 --- a/homeassistant/components/verisure/config_flow.py +++ b/homeassistant/components/verisure/config_flow.py @@ -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 = {} diff --git a/homeassistant/components/vizio/config_flow.py b/homeassistant/components/vizio/config_flow.py index 2c3c365b15a..da76f8081b4 100644 --- a/homeassistant/components/vizio/config_flow.py +++ b/homeassistant/components/vizio/config_flow.py @@ -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. diff --git a/homeassistant/components/wled/config_flow.py b/homeassistant/components/wled/config_flow.py index 9b57109d18f..052fc858a1a 100644 --- a/homeassistant/components/wled/config_flow.py +++ b/homeassistant/components/wled/config_flow.py @@ -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( diff --git a/script/scaffold/templates/config_flow/integration/config_flow.py b/script/scaffold/templates/config_flow/integration/config_flow.py index eea7d73b54c..02c00be8e2a 100644 --- a/script/scaffold/templates/config_flow/integration/config_flow.py +++ b/script/scaffold/templates/config_flow/integration/config_flow.py @@ -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(