Make config flow imports consistent (#114962)
* Make config flow imports consistent * Fix
This commit is contained in:
parent
aeaed83578
commit
0214511b38
18 changed files with 67 additions and 75 deletions
|
@ -8,7 +8,7 @@ from typing import Any
|
||||||
from airtouch5py.airtouch5_simple_client import Airtouch5SimpleClient
|
from airtouch5py.airtouch5_simple_client import Airtouch5SimpleClient
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
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
|
||||||
|
@ -18,14 +18,14 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
STEP_USER_DATA_SCHEMA = vol.Schema({vol.Required(CONF_HOST): str})
|
STEP_USER_DATA_SCHEMA = vol.Schema({vol.Required(CONF_HOST): str})
|
||||||
|
|
||||||
|
|
||||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class AirTouch5ConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Airtouch 5."""
|
"""Handle a config flow for Airtouch 5."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors: dict[str, str] | None = None
|
errors: dict[str, str] | None = None
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
|
@ -8,7 +8,7 @@ from typing import Any
|
||||||
from pyaprilaire.const import Attribute
|
from pyaprilaire.const import Attribute
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.device_registry import format_mac
|
from homeassistant.helpers.device_registry import format_mac
|
||||||
|
@ -26,14 +26,14 @@ STEP_USER_DATA_SCHEMA = vol.Schema(
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class AprilaireConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Aprilaire."""
|
"""Handle a config flow for Aprilaire."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
|
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
|
|
|
@ -9,7 +9,7 @@ from bring_api.bring import Bring
|
||||||
from bring_api.exceptions import BringAuthException, BringRequestException
|
from bring_api.exceptions import BringAuthException, BringRequestException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.selector import (
|
from homeassistant.helpers.selector import (
|
||||||
|
@ -38,14 +38,14 @@ STEP_USER_DATA_SCHEMA = vol.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class BringConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Bring!."""
|
"""Handle a config flow for Bring!."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
|
@ -8,14 +8,14 @@ from typing import TYPE_CHECKING, Any
|
||||||
from elvia import Elvia, error as ElviaError
|
from elvia import Elvia, error as ElviaError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_API_TOKEN
|
from homeassistant.const import CONF_API_TOKEN
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from .const import CONF_METERING_POINT_ID, DOMAIN, LOGGER
|
from .const import CONF_METERING_POINT_ID, DOMAIN, LOGGER
|
||||||
|
|
||||||
|
|
||||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class ElviaConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Elvia."""
|
"""Handle a config flow for Elvia."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
@ -26,7 +26,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self,
|
self,
|
||||||
user_input: dict[str, Any] | None = None,
|
user_input: dict[str, Any] | None = None,
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
@ -75,7 +75,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_select_meter(
|
async def async_step_select_meter(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle selecting a metering point ID."""
|
"""Handle selecting a metering point ID."""
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
assert self._metering_point_ids is not None
|
assert self._metering_point_ids is not None
|
||||||
|
@ -103,7 +103,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
self,
|
self,
|
||||||
api_token: str,
|
api_token: str,
|
||||||
metering_point_id: str,
|
metering_point_id: str,
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Store metering point ID and API token."""
|
"""Store metering point ID and API token."""
|
||||||
if (await self.async_set_unique_id(metering_point_id)) is not None:
|
if (await self.async_set_unique_id(metering_point_id)) is not None:
|
||||||
return self.async_abort(
|
return self.async_abort(
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components.bluetooth import BluetoothServiceInfoBleak
|
from homeassistant.components.bluetooth import BluetoothServiceInfoBleak
|
||||||
from homeassistant.config_entries import ConfigFlowResult
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_MAC
|
from homeassistant.const import CONF_MAC
|
||||||
from homeassistant.helpers.device_registry import format_mac
|
from homeassistant.helpers.device_registry import format_mac
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
@ -13,7 +12,7 @@ from .const import DOMAIN
|
||||||
from .schemas import SCHEMA_MAC
|
from .schemas import SCHEMA_MAC
|
||||||
|
|
||||||
|
|
||||||
class EQ3ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class EQ3ConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Config flow for eQ-3 Bluetooth Smart thermostats."""
|
"""Config flow for eQ-3 Bluetooth Smart thermostats."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
|
|
@ -13,7 +13,7 @@ from fyta_cli.fyta_exceptions import (
|
||||||
)
|
)
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
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 DOMAIN
|
from .const import DOMAIN
|
||||||
|
@ -26,14 +26,14 @@ DATA_SCHEMA = vol.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class FytaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class FytaConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Fyta."""
|
"""Handle a config flow for Fyta."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
|
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
|
@ -9,7 +9,7 @@ from huum.exceptions import Forbidden, NotAuthenticated
|
||||||
from huum.huum import Huum
|
from huum.huum import Huum
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
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.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
|
||||||
|
@ -25,14 +25,14 @@ STEP_USER_DATA_SCHEMA = vol.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HuumConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class HuumConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for huum."""
|
"""Handle a config flow for huum."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors = {}
|
errors = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
|
@ -7,7 +7,7 @@ from typing import Any
|
||||||
import lupupy
|
import lupupy
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
|
@ -31,12 +31,12 @@ DATA_SCHEMA = vol.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class LupusecConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
class LupusecConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
"""Lupusec config flow."""
|
"""Lupusec config flow."""
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a flow initiated by the user."""
|
"""Handle a flow initiated by the user."""
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
|
@ -66,9 +66,7 @@ class LupusecConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_import(
|
async def async_step_import(self, user_input: dict[str, Any]) -> ConfigFlowResult:
|
||||||
self, user_input: dict[str, Any]
|
|
||||||
) -> config_entries.ConfigFlowResult:
|
|
||||||
"""Import the yaml config."""
|
"""Import the yaml config."""
|
||||||
self._async_abort_entries_match(
|
self._async_abort_entries_match(
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@ from typing import Any
|
||||||
from microBeesPy import MicroBees, MicroBeesException
|
from microBeesPy import MicroBees, MicroBeesException
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
|
from homeassistant.config_entries import ConfigFlowResult
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_TOKEN
|
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_TOKEN
|
||||||
from homeassistant.helpers import aiohttp_client, config_entry_oauth2_flow
|
from homeassistant.helpers import aiohttp_client, config_entry_oauth2_flow
|
||||||
|
|
||||||
|
@ -32,9 +33,7 @@ class OAuth2FlowHandler(
|
||||||
scopes = ["read", "write"]
|
scopes = ["read", "write"]
|
||||||
return {"scope": " ".join(scopes)}
|
return {"scope": " ".join(scopes)}
|
||||||
|
|
||||||
async def async_oauth_create_entry(
|
async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
|
||||||
self, data: dict[str, Any]
|
|
||||||
) -> config_entries.ConfigFlowResult:
|
|
||||||
"""Create an oauth config entry or update existing entry for reauth."""
|
"""Create an oauth config entry or update existing entry for reauth."""
|
||||||
|
|
||||||
microbees = MicroBees(
|
microbees = MicroBees(
|
||||||
|
@ -65,7 +64,7 @@ class OAuth2FlowHandler(
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(
|
||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Perform reauth upon an API authentication error."""
|
"""Perform reauth upon an API authentication error."""
|
||||||
self.reauth_entry = self.hass.config_entries.async_get_entry(
|
self.reauth_entry = self.hass.config_entries.async_get_entry(
|
||||||
self.context["entry_id"]
|
self.context["entry_id"]
|
||||||
|
@ -74,7 +73,7 @@ class OAuth2FlowHandler(
|
||||||
|
|
||||||
async def async_step_reauth_confirm(
|
async def async_step_reauth_confirm(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Confirm reauth dialog."""
|
"""Confirm reauth dialog."""
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(step_id="reauth_confirm")
|
return self.async_show_form(step_id="reauth_confirm")
|
||||||
|
|
|
@ -8,8 +8,8 @@ from typing import Any
|
||||||
from rabbitair import UdpClient
|
from rabbitair import UdpClient
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components import zeroconf
|
from homeassistant.components import zeroconf
|
||||||
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, CONF_MAC
|
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, CONF_MAC
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
|
@ -49,7 +49,7 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str,
|
||||||
return {"mac": info.mac}
|
return {"mac": info.mac}
|
||||||
|
|
||||||
|
|
||||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class RabbitAirConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Rabbit Air."""
|
"""Handle a config flow for Rabbit Air."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
@ -58,7 +58,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_zeroconf(
|
async def async_step_zeroconf(
|
||||||
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle zeroconf discovery."""
|
"""Handle zeroconf discovery."""
|
||||||
mac = dr.format_mac(discovery_info.properties["id"])
|
mac = dr.format_mac(discovery_info.properties["id"])
|
||||||
await self.async_set_unique_id(mac)
|
await self.async_set_unique_id(mac)
|
||||||
|
|
|
@ -5,15 +5,15 @@ from __future__ import annotations
|
||||||
import romy
|
import romy
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components import zeroconf
|
from homeassistant.components import zeroconf
|
||||||
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
from .const import DOMAIN, LOGGER
|
from .const import DOMAIN, LOGGER
|
||||||
|
|
||||||
|
|
||||||
class RomyConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class RomyConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle config flow for ROMY."""
|
"""Handle config flow for ROMY."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
@ -26,7 +26,7 @@ class RomyConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, str] | None = None
|
self, user_input: dict[str, str] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the user step."""
|
"""Handle the user step."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class RomyConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_password(
|
async def async_step_password(
|
||||||
self, user_input: dict[str, str] | None = None
|
self, user_input: dict[str, str] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Unlock the robots local http interface with password."""
|
"""Unlock the robots local http interface with password."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class RomyConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_zeroconf(
|
async def async_step_zeroconf(
|
||||||
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle zeroconf discovery."""
|
"""Handle zeroconf discovery."""
|
||||||
|
|
||||||
LOGGER.debug("Zeroconf discovery_info: %s", discovery_info)
|
LOGGER.debug("Zeroconf discovery_info: %s", discovery_info)
|
||||||
|
@ -125,7 +125,7 @@ class RomyConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_zeroconf_confirm(
|
async def async_step_zeroconf_confirm(
|
||||||
self, user_input: dict[str, str] | None = None
|
self, user_input: dict[str, str] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a confirmation flow initiated by zeroconf."""
|
"""Handle a confirmation flow initiated by zeroconf."""
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
|
@ -137,7 +137,7 @@ class RomyConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
)
|
)
|
||||||
return await self._async_step_finish_config()
|
return await self._async_step_finish_config()
|
||||||
|
|
||||||
async def _async_step_finish_config(self) -> config_entries.ConfigFlowResult:
|
async def _async_step_finish_config(self) -> ConfigFlowResult:
|
||||||
"""Finish the configuration setup."""
|
"""Finish the configuration setup."""
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=self.robot_name_given_by_user,
|
title=self.robot_name_given_by_user,
|
||||||
|
|
|
@ -6,19 +6,19 @@ from requests.exceptions import ConnectTimeout, HTTPError
|
||||||
from rova.rova import Rova
|
from rova.rova import Rova
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
|
|
||||||
from .const import CONF_HOUSE_NUMBER, CONF_HOUSE_NUMBER_SUFFIX, CONF_ZIP_CODE, DOMAIN
|
from .const import CONF_HOUSE_NUMBER, CONF_HOUSE_NUMBER_SUFFIX, CONF_ZIP_CODE, DOMAIN
|
||||||
|
|
||||||
|
|
||||||
class RovaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class RovaConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle Rova config flow."""
|
"""Handle Rova config flow."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Step when user initializes a integration."""
|
"""Step when user initializes a integration."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
|
|
||||||
|
@ -60,9 +60,7 @@ class RovaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_import(
|
async def async_step_import(self, user_input: dict[str, Any]) -> ConfigFlowResult:
|
||||||
self, user_input: dict[str, Any]
|
|
||||||
) -> config_entries.ConfigFlowResult:
|
|
||||||
"""Import the yaml config."""
|
"""Import the yaml config."""
|
||||||
zip_code = user_input[CONF_ZIP_CODE]
|
zip_code = user_input[CONF_ZIP_CODE]
|
||||||
number = user_input[CONF_HOUSE_NUMBER]
|
number = user_input[CONF_HOUSE_NUMBER]
|
||||||
|
|
|
@ -9,8 +9,7 @@ from py17track import Client as SeventeenTrackClient
|
||||||
from py17track.errors import SeventeenTrackError
|
from py17track.errors import SeventeenTrackError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant.config_entries import ConfigEntry, ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.config_entries import 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
|
||||||
from homeassistant.helpers import aiohttp_client
|
from homeassistant.helpers import aiohttp_client
|
||||||
|
@ -47,7 +46,7 @@ USER_SCHEMA = vol.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SeventeenTrackConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class SeventeenTrackConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""17track config flow."""
|
"""17track config flow."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
@ -55,7 +54,7 @@ class SeventeenTrackConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(
|
def async_get_options_flow(
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
) -> SchemaOptionsFlowHandler:
|
) -> SchemaOptionsFlowHandler:
|
||||||
"""Get options flow for this handler."""
|
"""Get options flow for this handler."""
|
||||||
return SchemaOptionsFlowHandler(config_entry, OPTIONS_FLOW)
|
return SchemaOptionsFlowHandler(config_entry, OPTIONS_FLOW)
|
||||||
|
|
|
@ -14,7 +14,7 @@ from tesla_fleet_api.exceptions import (
|
||||||
)
|
)
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
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
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ DESCRIPTION_PLACEHOLDERS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TeslemetryConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class TeslemetryConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Config Teslemetry API connection."""
|
"""Config Teslemetry API connection."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: Mapping[str, Any] | None = None
|
self, user_input: Mapping[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Get configuration from the user."""
|
"""Get configuration from the user."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
if user_input:
|
if user_input:
|
||||||
|
|
|
@ -9,6 +9,7 @@ from pytraccar import ApiClient, ServerModel, TraccarException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
|
@ -111,7 +112,7 @@ OPTIONS_FLOW = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TraccarServerConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class TraccarServerConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Traccar Server."""
|
"""Handle a config flow for Traccar Server."""
|
||||||
|
|
||||||
async def _get_server_info(self, user_input: dict[str, Any]) -> ServerModel:
|
async def _get_server_info(self, user_input: dict[str, Any]) -> ServerModel:
|
||||||
|
@ -130,7 +131,7 @@ class TraccarServerConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self,
|
self,
|
||||||
user_input: dict[str, Any] | None = None,
|
user_input: dict[str, Any] | None = None,
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
@ -162,7 +163,7 @@ class TraccarServerConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_import(
|
async def async_step_import(
|
||||||
self, import_info: Mapping[str, Any]
|
self, import_info: Mapping[str, Any]
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Import an entry."""
|
"""Import an entry."""
|
||||||
configured_port = str(import_info[CONF_PORT])
|
configured_port = str(import_info[CONF_PORT])
|
||||||
self._async_abort_entries_match(
|
self._async_abort_entries_match(
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any
|
||||||
from pyvlx import PyVLX, PyVLXException
|
from pyvlx import PyVLX, PyVLXException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD
|
||||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN
|
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@ -21,12 +21,10 @@ DATA_SCHEMA = vol.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class VeluxConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class VeluxConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for velux."""
|
"""Handle a config flow for velux."""
|
||||||
|
|
||||||
async def async_step_import(
|
async def async_step_import(self, config: dict[str, Any]) -> ConfigFlowResult:
|
||||||
self, config: dict[str, Any]
|
|
||||||
) -> config_entries.ConfigFlowResult:
|
|
||||||
"""Import a config entry."""
|
"""Import a config entry."""
|
||||||
|
|
||||||
def create_repair(error: str | None = None) -> None:
|
def create_repair(error: str | None = None) -> None:
|
||||||
|
@ -81,7 +79,7 @@ class VeluxConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, str] | None = None
|
self, user_input: dict[str, str] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from aiohttp import ClientResponseError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from weatherflow4py.api import WeatherFlowRestAPI
|
from weatherflow4py.api import WeatherFlowRestAPI
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_API_TOKEN
|
from homeassistant.const import CONF_API_TOKEN
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
@ -27,14 +27,14 @@ async def _validate_api_token(api_token: str) -> dict[str, Any]:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class WeatherFlowCloudConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for WeatherFlowCloud."""
|
"""Handle a config flow for WeatherFlowCloud."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(
|
||||||
self, user_input: Mapping[str, Any]
|
self, user_input: Mapping[str, Any]
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a flow for reauth."""
|
"""Handle a flow for reauth."""
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> config_entries.ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a flow initialized by the user."""
|
"""Handle a flow initialized by the user."""
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import pytest
|
||||||
|
|
||||||
from homeassistant.components.aprilaire.config_flow import (
|
from homeassistant.components.aprilaire.config_flow import (
|
||||||
STEP_USER_DATA_SCHEMA,
|
STEP_USER_DATA_SCHEMA,
|
||||||
ConfigFlow,
|
AprilaireConfigFlow,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ async def test_user_input_step() -> None:
|
||||||
|
|
||||||
show_form_mock = Mock()
|
show_form_mock = Mock()
|
||||||
|
|
||||||
config_flow = ConfigFlow()
|
config_flow = AprilaireConfigFlow()
|
||||||
config_flow.async_show_form = show_form_mock
|
config_flow.async_show_form = show_form_mock
|
||||||
|
|
||||||
await config_flow.async_step_user(None)
|
await config_flow.async_step_user(None)
|
||||||
|
@ -41,7 +41,7 @@ async def test_config_flow_invalid_data(client: AprilaireClient) -> None:
|
||||||
set_unique_id_mock = AsyncMock()
|
set_unique_id_mock = AsyncMock()
|
||||||
async_abort_entries_match_mock = Mock()
|
async_abort_entries_match_mock = Mock()
|
||||||
|
|
||||||
config_flow = ConfigFlow()
|
config_flow = AprilaireConfigFlow()
|
||||||
config_flow.async_show_form = show_form_mock
|
config_flow.async_show_form = show_form_mock
|
||||||
config_flow.async_set_unique_id = set_unique_id_mock
|
config_flow.async_set_unique_id = set_unique_id_mock
|
||||||
config_flow._async_abort_entries_match = async_abort_entries_match_mock
|
config_flow._async_abort_entries_match = async_abort_entries_match_mock
|
||||||
|
@ -77,7 +77,7 @@ async def test_config_flow_data(client: AprilaireClient, hass: HomeAssistant) ->
|
||||||
abort_if_unique_id_configured_mock = Mock()
|
abort_if_unique_id_configured_mock = Mock()
|
||||||
create_entry_mock = Mock()
|
create_entry_mock = Mock()
|
||||||
|
|
||||||
config_flow = ConfigFlow()
|
config_flow = AprilaireConfigFlow()
|
||||||
config_flow.hass = hass
|
config_flow.hass = hass
|
||||||
config_flow.async_show_form = show_form_mock
|
config_flow.async_show_form = show_form_mock
|
||||||
config_flow.async_set_unique_id = set_unique_id_mock
|
config_flow.async_set_unique_id = set_unique_id_mock
|
||||||
|
|
Loading…
Add table
Reference in a new issue