Improve config flow type hints (part 1) (#124343)

* Improve config flow type hints

* Revert sms
This commit is contained in:
epenet 2024-08-21 22:42:58 +02:00 committed by GitHub
parent 67bc568db6
commit 913e5404da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
65 changed files with 348 additions and 114 deletions

View File

@ -1,9 +1,11 @@
"""Config flow for AirTouch4.""" """Config flow for AirTouch4."""
from typing import Any
from airtouch4pyapi import AirTouch, AirTouchStatus from airtouch4pyapi import AirTouch, AirTouchStatus
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST from homeassistant.const import CONF_HOST
from .const import DOMAIN from .const import DOMAIN
@ -16,7 +18,9 @@ class AirtouchConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
if user_input is None: if user_input is None:
return self.async_show_form(step_id="user", data_schema=DATA_SCHEMA) return self.async_show_form(step_id="user", data_schema=DATA_SCHEMA)

View File

@ -2,6 +2,8 @@
from __future__ import annotations from __future__ import annotations
from typing import Any
from aioambient import API from aioambient import API
from aioambient.errors import AmbientError from aioambient.errors import AmbientError
import voluptuous as vol import voluptuous as vol
@ -32,7 +34,9 @@ class AmbientStationFlowHandler(ConfigFlow, domain=DOMAIN):
errors=errors if errors else {}, errors=errors if errors else {},
) )
async def async_step_user(self, user_input: dict | None = None) -> ConfigFlowResult: async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow.""" """Handle the start of the config flow."""
if not user_input: if not user_input:
return await self._show_form() return await self._show_form()

View File

@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from aiohttp.client_exceptions import ClientError from aiohttp.client_exceptions import ClientError
from pyControl4.account import C4Account from pyControl4.account import C4Account
@ -10,7 +11,12 @@ from pyControl4.director import C4Director
from pyControl4.error_handling import NotFound, Unauthorized from pyControl4.error_handling import NotFound, Unauthorized
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import ( from homeassistant.const import (
CONF_HOST, CONF_HOST,
CONF_PASSWORD, CONF_PASSWORD,
@ -93,7 +99,9 @@ class Control4ConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -2,10 +2,17 @@
from __future__ import annotations from __future__ import annotations
from typing import Any
from pydexcom import AccountError, Dexcom, SessionError from pydexcom import AccountError, Dexcom, SessionError
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_PASSWORD, CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME
from homeassistant.core import callback from homeassistant.core import callback
@ -25,7 +32,9 @@ class DexcomConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -1,10 +1,12 @@
"""Config flow to configure the EcoNet component.""" """Config flow to configure the EcoNet component."""
from typing import Any
from pyeconet import EcoNetApiInterface from pyeconet import EcoNetApiInterface
from pyeconet.errors import InvalidCredentialsError, PyeconetError from pyeconet.errors import InvalidCredentialsError, PyeconetError
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from .const import DOMAIN from .const import DOMAIN
@ -24,7 +26,9 @@ class EcoNetFlowHandler(ConfigFlow, domain=DOMAIN):
} }
) )
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow.""" """Handle the start of the config flow."""
if not user_input: if not user_input:
return self.async_show_form( return self.async_show_form(

View File

@ -1,8 +1,10 @@
"""Config flow to configure emulated_roku component.""" """Config flow to configure emulated_roku component."""
from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_NAME from homeassistant.const import CONF_NAME
from homeassistant.core import callback from homeassistant.core import callback
@ -22,9 +24,11 @@ class EmulatedRokuFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
errors = {} errors: dict[str, str] = {}
if user_input is not None: if user_input is not None:
self._async_abort_entries_match({CONF_NAME: user_input[CONF_NAME]}) self._async_abort_entries_match({CONF_NAME: user_input[CONF_NAME]})

View File

@ -1,8 +1,10 @@
"""Config flows for the ENOcean integration.""" """Config flows for the ENOcean integration."""
from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_DEVICE from homeassistant.const import CONF_DEVICE
from . import dongle from . import dongle
@ -32,7 +34,9 @@ class EnOceanFlowHandler(ConfigFlow, domain=DOMAIN):
return self.create_enocean_entry(data) return self.create_enocean_entry(data)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle an EnOcean config flow start.""" """Handle an EnOcean config flow start."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View File

@ -1,13 +1,14 @@
"""Config flow for Environment Canada integration.""" """Config flow for Environment Canada integration."""
import logging import logging
from typing import Any
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import aiohttp import aiohttp
from env_canada import ECWeather, ec_exc from env_canada import ECWeather, ec_exc
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_LANGUAGE, CONF_LATITUDE, CONF_LONGITUDE from homeassistant.const import CONF_LANGUAGE, CONF_LATITUDE, CONF_LONGITUDE
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
@ -46,7 +47,9 @@ class EnvironmentCanadaConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -1,10 +1,11 @@
"""Config flow for epson integration.""" """Config flow for epson integration."""
import logging import logging
from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
from . import validate_projector from . import validate_projector
@ -26,7 +27,9 @@ class EpsonConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -2,12 +2,13 @@
import asyncio import asyncio
import logging import logging
from typing import Any
from pyflick.authentication import AuthException, SimpleFlickAuth from pyflick.authentication import AuthException, SimpleFlickAuth
from pyflick.const import DEFAULT_CLIENT_ID, DEFAULT_CLIENT_SECRET from pyflick.const import DEFAULT_CLIENT_ID, DEFAULT_CLIENT_SECRET
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import ( from homeassistant.const import (
CONF_CLIENT_ID, CONF_CLIENT_ID,
CONF_CLIENT_SECRET, CONF_CLIENT_SECRET,
@ -55,7 +56,9 @@ class FlickConfigFlow(ConfigFlow, domain=DOMAIN):
return token is not None return token is not None
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle gathering login info.""" """Handle gathering login info."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -1,10 +1,12 @@
"""Config flow for flo integration.""" """Config flow for flo integration."""
from typing import Any
from aioflo import async_get_api from aioflo import async_get_api
from aioflo.errors import RequestError from aioflo.errors import RequestError
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -36,7 +38,9 @@ class FloConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -2,6 +2,7 @@
from contextlib import suppress from contextlib import suppress
import logging import logging
from typing import Any
from pyforked_daapd import ForkedDaapdAPI from pyforked_daapd import ForkedDaapdAPI
import voluptuous as vol import voluptuous as vol
@ -135,7 +136,9 @@ class ForkedDaapdFlowHandler(ConfigFlow, domain=DOMAIN):
) )
return validate_result return validate_result
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a forked-daapd config flow start. """Handle a forked-daapd config flow start.
Manage device specific parameters. Manage device specific parameters.

View File

@ -1,5 +1,7 @@
"""Config flow for foscam integration.""" """Config flow for foscam integration."""
from typing import Any
from libpyfoscam import FoscamCamera from libpyfoscam import FoscamCamera
from libpyfoscam.foscam import ( from libpyfoscam.foscam import (
ERROR_FOSCAM_AUTH, ERROR_FOSCAM_AUTH,
@ -8,7 +10,7 @@ from libpyfoscam.foscam import (
) )
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import ( from homeassistant.const import (
CONF_HOST, CONF_HOST,
CONF_NAME, CONF_NAME,
@ -90,7 +92,9 @@ class FoscamConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=name, data=data) return self.async_create_entry(title=name, data=data)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}

View File

@ -1,9 +1,11 @@
"""Config flow to configure Freedompro.""" """Config flow to configure Freedompro."""
from typing import Any
from pyfreedompro import get_list from pyfreedompro import get_list
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_API_KEY from homeassistant.const import CONF_API_KEY
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -45,7 +47,9 @@ class FreedomProConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Show the setup form to the user.""" """Show the setup form to the user."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(

View File

@ -1,10 +1,11 @@
"""Config flow to configure the GeoNet NZ Quakes integration.""" """Config flow to configure the GeoNet NZ Quakes integration."""
import logging import logging
from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import ( from homeassistant.const import (
CONF_LATITUDE, CONF_LATITUDE,
CONF_LONGITUDE, CONF_LONGITUDE,
@ -48,7 +49,9 @@ class GeonetnzQuakesFlowHandler(ConfigFlow, domain=DOMAIN):
"""Import a config entry from configuration.yaml.""" """Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config) return await self.async_step_user(import_config)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow.""" """Handle the start of the config flow."""
_LOGGER.debug("User input: %s", user_input) _LOGGER.debug("User input: %s", user_input)
if not user_input: if not user_input:

View File

@ -1,8 +1,10 @@
"""Config flow to configure the GeoNet NZ Volcano integration.""" """Config flow to configure the GeoNet NZ Volcano integration."""
from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import ( from homeassistant.const import (
CONF_LATITUDE, CONF_LATITUDE,
CONF_LONGITUDE, CONF_LONGITUDE,
@ -49,7 +51,9 @@ class GeonetnzVolcanoFlowHandler(ConfigFlow, domain=DOMAIN):
"""Import a config entry from configuration.yaml.""" """Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config) return await self.async_step_user(import_config)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow.""" """Handle the start of the config flow."""
if not user_input: if not user_input:
return await self._show_form() return await self._show_form()

View File

@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from goodwe import InverterError, connect from goodwe import InverterError, connect
import voluptuous as vol import voluptuous as vol
@ -26,7 +27,9 @@ class GoodweFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input: dict | None = None) -> ConfigFlowResult: async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -3,12 +3,13 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from aiohttp import ClientResponseError from aiohttp import ClientResponseError
from habitipy.aio import HabitipyAsync from habitipy.aio import HabitipyAsync
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_URL from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_URL
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -56,7 +57,9 @@ class HabiticaConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}

View File

@ -1,6 +1,6 @@
"""Config flow to configure Heos.""" """Config flow to configure Heos."""
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, Any
from urllib.parse import urlparse from urllib.parse import urlparse
from pyheos import Heos, HeosError from pyheos import Heos, HeosError
@ -51,7 +51,9 @@ class HeosFlowHandler(ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id(DOMAIN, raise_on_progress=False) await self.async_set_unique_id(DOMAIN, raise_on_progress=False)
return self.async_create_entry(title=format_title(host), data={CONF_HOST: host}) return self.async_create_entry(title=format_title(host), data={CONF_HOST: host})
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Obtain host and validate connection.""" """Obtain host and validate connection."""
self.hass.data.setdefault(DATA_DISCOVERED_HOSTS, {}) self.hass.data.setdefault(DATA_DISCOVERED_HOSTS, {})
# Only a single entry is needed for all devices # Only a single entry is needed for all devices

View File

@ -1,11 +1,12 @@
"""Config flow for HLK-SW16.""" """Config flow for HLK-SW16."""
import asyncio import asyncio
from typing import Any
from hlk_sw16 import create_hlk_sw16_connection from hlk_sw16 import create_hlk_sw16_connection
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -73,7 +74,9 @@ class SW16FlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle import.""" """Handle import."""
return await self.async_step_user(user_input) return await self.async_step_user(user_input)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -1,11 +1,12 @@
"""Config flow for EnergyFlip integration.""" """Config flow for EnergyFlip integration."""
import logging import logging
from typing import Any
from energyflip import EnergyFlip, EnergyFlipConnectionException, EnergyFlipException from energyflip import EnergyFlip, EnergyFlipConnectionException, EnergyFlipException
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME
from homeassistant.data_entry_flow import AbortFlow from homeassistant.data_entry_flow import AbortFlow
@ -23,7 +24,9 @@ class EnergyFlipConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if user_input is None: if user_input is None:
return await self._show_setup_form(user_input) return await self._show_setup_form(user_input)

View File

@ -1,11 +1,12 @@
"""Config flow for Antifurto365 iAlarm integration.""" """Config flow for Antifurto365 iAlarm integration."""
import logging import logging
from typing import Any
from pyialarm import IAlarm from pyialarm import IAlarm
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -31,7 +32,9 @@ class IAlarmConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
mac = None mac = None

View File

@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from pyinsteon import async_connect from pyinsteon import async_connect
@ -54,7 +55,9 @@ class InsteonFlowHandler(ConfigFlow, domain=DOMAIN):
_device_name: str | None = None _device_name: str | None = None
discovered_conf: dict[str, str] = {} discovered_conf: dict[str, str] = {}
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Init the config flow.""" """Init the config flow."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View File

@ -1,13 +1,14 @@
"""Config flow for JuiceNet integration.""" """Config flow for JuiceNet integration."""
import logging import logging
from typing import Any
import aiohttp import aiohttp
from pyjuicenet import Api, TokenError from pyjuicenet import Api, TokenError
import voluptuous as vol import voluptuous as vol
from homeassistant import core, exceptions from homeassistant import core, exceptions
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -44,7 +45,9 @@ class JuiceNetConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -42,9 +42,9 @@ class MicroBotConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
def __init__(self): def __init__(self) -> None:
"""Initialize.""" """Initialize."""
self._errors = {} self._errors: dict[str, str] = {}
self._discovered_adv: MicroBotAdvertisement | None = None self._discovered_adv: MicroBotAdvertisement | None = None
self._discovered_advs: dict[str, MicroBotAdvertisement] = {} self._discovered_advs: dict[str, MicroBotAdvertisement] = {}
self._client: MicroBotApiClient | None = None self._client: MicroBotApiClient | None = None

View File

@ -3,13 +3,19 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
import aiohttp import aiohttp
from pykmtronic.auth import Auth from pykmtronic.auth import Auth
from pykmtronic.hub import KMTronicHubAPI from pykmtronic.hub import KMTronicHubAPI
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -62,7 +68,9 @@ class KmtronicConfigFlow(ConfigFlow, domain=DOMAIN):
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return KMTronicOptionsFlow(config_entry) return KMTronicOptionsFlow(config_entry)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection
import voluptuous as vol import voluptuous as vol
@ -149,7 +150,9 @@ class KodiConfigFlow(ConfigFlow, domain=DOMAIN):
return self._create_entry() return self._create_entry()
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}

View File

@ -303,7 +303,9 @@ class KonnectedFlowHandler(ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="unknown") return self.async_abort(reason="unknown")
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Connect to panel and get config.""" """Connect to panel and get config."""
errors = {} errors = {}
if user_input: if user_input:

View File

@ -1,12 +1,13 @@
"""Config flow to configure the Meteoclimatic integration.""" """Config flow to configure the Meteoclimatic integration."""
import logging import logging
from typing import Any
from meteoclimatic import MeteoclimaticClient from meteoclimatic import MeteoclimaticClient
from meteoclimatic.exceptions import MeteoclimaticError, StationNotFound from meteoclimatic.exceptions import MeteoclimaticError, StationNotFound
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from .const import CONF_STATION_CODE, DOMAIN from .const import CONF_STATION_CODE, DOMAIN
@ -35,9 +36,11 @@ class MeteoclimaticFlowHandler(ConfigFlow, domain=DOMAIN):
errors=errors or {}, errors=errors or {},
) )
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
errors = {} errors: dict[str, str] = {}
if user_input is None: if user_input is None:
return self._show_setup_form(user_input, errors) return self._show_setup_form(user_input, errors)

View File

@ -1,10 +1,12 @@
"""Adds config flow for Mill integration.""" """Adds config flow for Mill integration."""
from typing import Any
from mill import Mill from mill import Mill
from mill_local import Mill as MillLocal from mill_local import Mill as MillLocal
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -16,7 +18,9 @@ class MillConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
data_schema = vol.Schema( data_schema = vol.Schema(
{ {

View File

@ -1,9 +1,10 @@
"""Config flow for Mobile App.""" """Config flow for Mobile App."""
from typing import Any
import uuid import uuid
from homeassistant.components import person from homeassistant.components import person
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import ATTR_DEVICE_ID from homeassistant.const import ATTR_DEVICE_ID
from homeassistant.helpers import entity_registry as er from homeassistant.helpers import entity_registry as er
@ -15,7 +16,9 @@ class MobileAppFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
placeholders = { placeholders = {
"apps_url": "https://www.home-assistant.io/integrations/mobile_app/#apps" "apps_url": "https://www.home-assistant.io/integrations/mobile_app/#apps"

View File

@ -3,12 +3,18 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from pymonoprice import get_monoprice from pymonoprice import get_monoprice
from serial import SerialException from serial import SerialException
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_PORT from homeassistant.const import CONF_PORT
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -76,7 +82,9 @@ class MonoPriceConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -3,7 +3,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import cast from typing import Any, cast
from urllib.parse import urlparse from urllib.parse import urlparse
from pynetgear import DEFAULT_HOST, DEFAULT_PORT, DEFAULT_USER from pynetgear import DEFAULT_HOST, DEFAULT_PORT, DEFAULT_USER
@ -175,7 +175,9 @@ class NetgearFlowHandler(ConfigFlow, domain=DOMAIN):
return await self.async_step_user() return await self.async_step_user()
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
errors = {} errors = {}

View File

@ -1,13 +1,14 @@
"""Config flow for Nexia integration.""" """Config flow for Nexia integration."""
import logging import logging
from typing import Any
import aiohttp import aiohttp
from nexia.const import BRAND_ASAIR, BRAND_NEXIA, BRAND_TRANE from nexia.const import BRAND_ASAIR, BRAND_NEXIA, BRAND_TRANE
from nexia.home import NexiaHome from nexia.home import NexiaHome
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -81,7 +82,9 @@ class NexiaConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -79,7 +79,7 @@ class NextBusFlowHandler(ConfigFlow, domain=DOMAIN):
_route_tags: dict[str, str] _route_tags: dict[str, str]
_stop_tags: dict[str, str] _stop_tags: dict[str, str]
def __init__(self): def __init__(self) -> None:
"""Initialize NextBus config flow.""" """Initialize NextBus config flow."""
self.data: dict[str, str] = {} self.data: dict[str, str] = {}
self._client = NextBusClient() self._client = NextBusClient()

View File

@ -2,12 +2,13 @@
from http import HTTPStatus from http import HTTPStatus
import logging import logging
from typing import Any
import nuheat import nuheat
import requests.exceptions import requests.exceptions
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -64,7 +65,9 @@ class NuHeatConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -63,7 +63,9 @@ class OctoPrintConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for OctoPrint.""" """Handle a config flow for OctoPrint."""
self._sessions: list[aiohttp.ClientSession] = [] self._sessions: list[aiohttp.ClientSession] = []
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
# When coming back from the progress steps, the user_input is stored in the # When coming back from the progress steps, the user_input is stored in the
# instance variable instead of being passed in # instance variable instead of being passed in

View File

@ -3,11 +3,17 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from omnilogic import LoginException, OmniLogic, OmniLogicException from omnilogic import LoginException, OmniLogic, OmniLogicException
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers import aiohttp_client from homeassistant.helpers import aiohttp_client
@ -30,9 +36,11 @@ class OmniLogicConfigFlow(ConfigFlow, domain=DOMAIN):
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return OptionsFlowHandler(config_entry) return OptionsFlowHandler(config_entry)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors: dict[str, str] = {}
config_entry = self._async_current_entries() config_entry = self._async_current_entries()
if config_entry: if config_entry:

View File

@ -3,13 +3,19 @@
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
from typing import Any
import pyotgw import pyotgw
from pyotgw import vars as gw_vars from pyotgw import vars as gw_vars
from serial import SerialException from serial import SerialException
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import ( from homeassistant.const import (
CONF_DEVICE, CONF_DEVICE,
CONF_ID, CONF_ID,
@ -80,7 +86,9 @@ class OpenThermGwConfigFlow(ConfigFlow, domain=DOMAIN):
return self._show_form() return self._show_form()
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle manual initiation of the config flow.""" """Handle manual initiation of the config flow."""
return await self.async_step_init(user_input) return await self.async_step_init(user_input)

View File

@ -1,9 +1,10 @@
"""Config flow for OwnTracks.""" """Config flow for OwnTracks."""
import secrets import secrets
from typing import Any
from homeassistant.components import cloud, webhook from homeassistant.components import cloud, webhook
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_WEBHOOK_ID from homeassistant.const import CONF_WEBHOOK_ID
from .const import DOMAIN from .const import DOMAIN
@ -18,7 +19,9 @@ class OwnTracksFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a user initiated set up flow to create OwnTracks webhook.""" """Handle a user initiated set up flow to create OwnTracks webhook."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View File

@ -87,7 +87,9 @@ class PicnicConfigFlow(ConfigFlow, domain=DOMAIN):
"""Perform the re-auth step upon an API authentication error.""" """Perform the re-auth step upon an API authentication error."""
return await self.async_step_user() return await self.async_step_user()
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the authentication step, this is the generic step for both `step_user` and `step_reauth`.""" """Handle the authentication step, this is the generic step for both `step_user` and `step_reauth`."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(

View File

@ -3,12 +3,13 @@
import asyncio import asyncio
from collections import OrderedDict from collections import OrderedDict
import logging import logging
from typing import Any
from pypoint import PointSession from pypoint import PointSession
import voluptuous as vol import voluptuous as vol
from homeassistant.components.http import KEY_HASS, HomeAssistantView from homeassistant.components.http import KEY_HASS, HomeAssistantView
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -59,7 +60,9 @@ class PointFlowHandler(ConfigFlow, domain=DOMAIN):
return await self.async_step_auth() return await self.async_step_auth()
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow start.""" """Handle a flow start."""
flows = self.hass.data.get(DATA_FLOW_IMPL, {}) flows = self.hass.data.get(DATA_FLOW_IMPL, {})

View File

@ -1,6 +1,8 @@
"""Config flow for Profiler integration.""" """Config flow for Profiler integration."""
from homeassistant.config_entries import ConfigFlow from typing import Any
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from .const import DEFAULT_NAME, DOMAIN from .const import DEFAULT_NAME, DOMAIN
@ -10,7 +12,9 @@ class ProfilerConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View File

@ -51,7 +51,9 @@ class ProsegurConfigFlow(ConfigFlow, domain=DOMAIN):
user_input: dict user_input: dict
contracts: list[dict[str, str]] contracts: list[dict[str, str]]
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}

View File

@ -4,6 +4,7 @@ from __future__ import annotations
from http import HTTPStatus from http import HTTPStatus
import logging import logging
from typing import Any
from rachiopy import Rachio from rachiopy import Rachio
from requests.exceptions import ConnectTimeout from requests.exceptions import ConnectTimeout
@ -67,7 +68,9 @@ class RachioConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -1,6 +1,7 @@
"""Config flow for Smappee.""" """Config flow for Smappee."""
import logging import logging
from typing import Any
from pysmappee import helper, mqtt from pysmappee import helper, mqtt
import voluptuous as vol import voluptuous as vol
@ -106,7 +107,9 @@ class SmappeeFlowHandler(
data={CONF_IP_ADDRESS: ip_address, CONF_SERIALNUMBER: serial_number}, data={CONF_IP_ADDRESS: ip_address, CONF_SERIALNUMBER: serial_number},
) )
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
# If there is a CLOUD entry already, abort a new LOCAL entry # If there is a CLOUD entry already, abort a new LOCAL entry

View File

@ -1,6 +1,7 @@
"""Config flow for Smart Meter Texas integration.""" """Config flow for Smart Meter Texas integration."""
import logging import logging
from typing import Any
from aiohttp import ClientError from aiohttp import ClientError
from smart_meter_texas import Account, Client, ClientSSLContext from smart_meter_texas import Account, Client, ClientSSLContext
@ -10,7 +11,7 @@ from smart_meter_texas.exceptions import (
) )
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -52,7 +53,9 @@ class SMTConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}

View File

@ -2,13 +2,14 @@
from http import HTTPStatus from http import HTTPStatus
import logging import logging
from typing import Any
from aiohttp import ClientResponseError from aiohttp import ClientResponseError
from pysmartthings import APIResponseError, AppOAuth, SmartThings from pysmartthings import APIResponseError, AppOAuth, SmartThings
from pysmartthings.installedapp import format_install_url from pysmartthings.installedapp import format_install_url
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -57,7 +58,9 @@ class SmartThingsFlowHandler(ConfigFlow, domain=DOMAIN):
"""Occurs when a previously entry setup fails and is re-initiated.""" """Occurs when a previously entry setup fails and is re-initiated."""
return await self.async_step_user(user_input) return await self.async_step_user(user_input)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Validate and confirm webhook setup.""" """Validate and confirm webhook setup."""
if not self.endpoints_initialized: if not self.endpoints_initialized:
self.endpoints_initialized = True self.endpoints_initialized = True

View File

@ -1,12 +1,13 @@
"""Config flow for Soma.""" """Config flow for Soma."""
import logging import logging
from typing import Any
from api.soma_api import SomaApi from api.soma_api import SomaApi
from requests import RequestException from requests import RequestException
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
from .const import DOMAIN from .const import DOMAIN
@ -24,7 +25,9 @@ class SomaFlowHandler(ConfigFlow, domain=DOMAIN):
def __init__(self) -> None: def __init__(self) -> None:
"""Instantiate config flow.""" """Instantiate config flow."""
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow start.""" """Handle a flow start."""
if user_input is None: if user_input is None:
data = { data = {

View File

@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from urllib.parse import urlparse from urllib.parse import urlparse
from songpal import Device, SongpalException from songpal import Device, SongpalException
@ -36,7 +37,9 @@ class SongpalConfigFlow(ConfigFlow, domain=DOMAIN):
"""Initialize the flow.""" """Initialize the flow."""
self.conf: SongpalConfig | None = None self.conf: SongpalConfig | None = None
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(

View File

@ -1,11 +1,12 @@
"""Config flow for Spider.""" """Config flow for Spider."""
import logging import logging
from typing import Any
from spiderpy.spiderapi import SpiderApi, SpiderApiException, UnauthorizedException from spiderpy.spiderapi import SpiderApi, SpiderApiException, UnauthorizedException
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN from .const import DEFAULT_SCAN_INTERVAL, DOMAIN
@ -49,7 +50,9 @@ class SpiderConfigFlow(ConfigFlow, domain=DOMAIN):
return RESULT_SUCCESS return RESULT_SUCCESS
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View File

@ -131,7 +131,9 @@ class SqueezeboxConfigFlow(ConfigFlow, domain=DOMAIN):
return None return None
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
errors = {} errors = {}
if user_input and CONF_HOST in user_input: if user_input and CONF_HOST in user_input:

View File

@ -2,10 +2,12 @@
from __future__ import annotations from __future__ import annotations
from typing import Any
from starline import StarlineAuth from starline import StarlineAuth
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback from homeassistant.core import callback
@ -52,7 +54,9 @@ class StarlineFlowHandler(ConfigFlow, domain=DOMAIN):
self._auth = StarlineAuth() self._auth = StarlineAuth()
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
return await self.async_step_auth_app(user_input) return await self.async_step_auth_app(user_input)

View File

@ -1,9 +1,11 @@
"""Config flow for syncthing integration.""" """Config flow for syncthing integration."""
from typing import Any
import aiosyncthing import aiosyncthing
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL from homeassistant.const import CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -42,7 +44,9 @@ class SyncThingConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}

View File

@ -1,6 +1,7 @@
"""Config flow for Samsung SyncThru.""" """Config flow for Samsung SyncThru."""
import re import re
from typing import Any
from urllib.parse import urlparse from urllib.parse import urlparse
from pysyncthru import ConnectionMode, SyncThru, SyncThruAPINotSupported from pysyncthru import ConnectionMode, SyncThru, SyncThruAPINotSupported
@ -23,7 +24,9 @@ class SyncThruConfigFlow(ConfigFlow, domain=DOMAIN):
url: str url: str
name: str name: str
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle user initiated flow.""" """Handle user initiated flow."""
if user_input is None: if user_input is None:
return await self._async_show_form(step_id="user") return await self._async_show_form(step_id="user")

View File

@ -3,11 +3,12 @@
import asyncio import asyncio
import logging import logging
import os import os
from typing import Any
from tellduslive import Session, supports_local_api from tellduslive import Session, supports_local_api
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST from homeassistant.const import CONF_HOST
from homeassistant.util.json import load_json_object from homeassistant.util.json import load_json_object
@ -50,7 +51,9 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
) )
return self._session.authorize_url return self._session.authorize_url
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Let user select host or cloud.""" """Let user select host or cloud."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="already_setup") return self.async_abort(reason="already_setup")

View File

@ -28,7 +28,9 @@ class TwinklyConfigFlow(ConfigFlow, domain=DOMAIN):
"""Initialize the config flow.""" """Initialize the config flow."""
self._discovered_device: tuple[dict[str, Any], str] | None = None self._discovered_device: tuple[dict[str, Any], str] | None = None
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle config steps.""" """Handle config steps."""
host = user_input[CONF_HOST] if user_input else None host = user_input[CONF_HOST] if user_input else None

View File

@ -3,12 +3,13 @@
import asyncio import asyncio
from contextlib import suppress from contextlib import suppress
import logging import logging
from typing import Any
from urllib.parse import urlparse from urllib.parse import urlparse
import upb_lib import upb_lib
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ADDRESS, CONF_FILE_PATH, CONF_HOST, CONF_PROTOCOL from homeassistant.const import CONF_ADDRESS, CONF_FILE_PATH, CONF_HOST, CONF_PROTOCOL
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -82,7 +83,9 @@ class UPBConfigFlow(ConfigFlow, domain=DOMAIN):
"""Initialize the UPB config flow.""" """Initialize the UPB config flow."""
self.importing = False self.importing = False
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -1,6 +1,7 @@
"""Config flow for Vilfo Router integration.""" """Config flow for Vilfo Router integration."""
import logging import logging
from typing import Any
from vilfo import Client as VilfoClient from vilfo import Client as VilfoClient
from vilfo.exceptions import ( from vilfo.exceptions import (
@ -9,7 +10,7 @@ from vilfo.exceptions import (
) )
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, CONF_ID, CONF_MAC from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, CONF_ID, CONF_MAC
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -99,7 +100,9 @@ class DomainConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from pyvolumio import CannotConnectError, Volumio from pyvolumio import CannotConnectError, Volumio
import voluptuous as vol import voluptuous as vol
@ -68,7 +69,9 @@ class VolumioConfigFlow(ConfigFlow, domain=DOMAIN):
} }
) )
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -44,7 +44,9 @@ class VulcanFlowHandler(ConfigFlow, domain=DOMAIN):
self.keystore = None self.keystore = None
self.students = None self.students = None
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle config flow.""" """Handle config flow."""
if self._async_current_entries(): if self._async_current_entries():
return await self.async_step_add_next_config_entry() return await self.async_step_add_next_config_entry()

View File

@ -6,11 +6,17 @@ Used by UI to setup a wiffi integration.
from __future__ import annotations from __future__ import annotations
import errno import errno
from typing import Any
import voluptuous as vol import voluptuous as vol
from wiffi import WiffiTcpServer from wiffi import WiffiTcpServer
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_PORT, CONF_TIMEOUT from homeassistant.const import CONF_PORT, CONF_TIMEOUT
from homeassistant.core import callback from homeassistant.core import callback
@ -30,7 +36,9 @@ class WiffiFlowHandler(ConfigFlow, domain=DOMAIN):
"""Create Wiffi server setup option flow.""" """Create Wiffi server setup option flow."""
return OptionsFlowHandler(config_entry) return OptionsFlowHandler(config_entry)
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow. """Handle the start of the config flow.
Called after wiffi integration has been selected in the 'add integration Called after wiffi integration has been selected in the 'add integration

View File

@ -1,13 +1,14 @@
"""Config flow for Wolf SmartSet Service integration.""" """Config flow for Wolf SmartSet Service integration."""
import logging import logging
from typing import Any
from httpcore import ConnectError from httpcore import ConnectError
import voluptuous as vol import voluptuous as vol
from wolf_comm.token_auth import InvalidAuth from wolf_comm.token_auth import InvalidAuth
from wolf_comm.wolf_client import WolfClient from wolf_comm.wolf_client import WolfClient
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from .const import DEVICE_GATEWAY, DEVICE_ID, DEVICE_NAME, DOMAIN from .const import DEVICE_GATEWAY, DEVICE_ID, DEVICE_NAME, DOMAIN
@ -30,7 +31,9 @@ class WolfLinkConfigFlow(ConfigFlow, domain=DOMAIN):
self.password = None self.password = None
self.fetched_systems = None self.fetched_systems = None
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step to get connection parameters.""" """Handle the initial step to get connection parameters."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -8,7 +8,12 @@ from typing import Any
from pyws66i import WS66i, get_ws66i from pyws66i import WS66i, get_ws66i
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_IP_ADDRESS from homeassistant.const import CONF_IP_ADDRESS
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -94,7 +99,9 @@ class WS66iConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -1,7 +1,9 @@
"""Config flow for xbox.""" """Config flow for xbox."""
import logging import logging
from typing import Any
from homeassistant.config_entries import ConfigFlowResult
from homeassistant.helpers import config_entry_oauth2_flow from homeassistant.helpers import config_entry_oauth2_flow
from .const import DOMAIN from .const import DOMAIN
@ -25,7 +27,9 @@ class OAuth2FlowHandler(
scopes = ["Xboxlive.signin", "Xboxlive.offline_access"] scopes = ["Xboxlive.signin", "Xboxlive.offline_access"]
return {"scope": " ".join(scopes)} return {"scope": " ".join(scopes)}
async def async_step_user(self, user_input=None): async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow start.""" """Handle a flow start."""
await self.async_set_unique_id(DOMAIN) await self.async_set_unique_id(DOMAIN)