Adjust data entry flow to have an option data_schema (#67637)
parent
3eadc67d59
commit
5965b015dd
|
@ -56,7 +56,6 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="hassio_confirm",
|
step_id="hassio_confirm",
|
||||||
description_placeholders={"addon": self._hassio_discovery["addon"]},
|
description_placeholders={"addon": self._hassio_discovery["addon"]},
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
errors=errors or {},
|
errors=errors or {},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ from typing import Any
|
||||||
from aiohttp import ClientError
|
from aiohttp import ClientError
|
||||||
import async_timeout
|
import async_timeout
|
||||||
from pyalmond import AlmondLocalAuth, WebAlmondAPI
|
from pyalmond import AlmondLocalAuth, WebAlmondAPI
|
||||||
import voluptuous as vol
|
|
||||||
from yarl import URL
|
from yarl import URL
|
||||||
|
|
||||||
from homeassistant import core, data_entry_flow
|
from homeassistant import core, data_entry_flow
|
||||||
|
@ -122,5 +121,4 @@ class AlmondFlowHandler(
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="hassio_confirm",
|
step_id="hassio_confirm",
|
||||||
description_placeholders={"addon": data["addon"]},
|
description_placeholders={"addon": data["addon"]},
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
"""Config flow for Honeywell Lyric."""
|
"""Config flow for Honeywell Lyric."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.helpers import config_entry_oauth2_flow
|
from homeassistant.helpers import config_entry_oauth2_flow
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
@ -27,10 +25,7 @@ class OAuth2FlowHandler(
|
||||||
async def async_step_reauth_confirm(self, user_input=None):
|
async def async_step_reauth_confirm(self, user_input=None):
|
||||||
"""Dialog that informs the user that reauth is required."""
|
"""Dialog that informs the user that reauth is required."""
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(
|
return self.async_show_form(step_id="reauth_confirm")
|
||||||
step_id="reauth_confirm",
|
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
)
|
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
async def async_oauth_create_entry(self, data: dict) -> dict:
|
async def async_oauth_create_entry(self, data: dict) -> dict:
|
||||||
|
|
|
@ -3,8 +3,6 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow
|
from homeassistant.config_entries import ConfigFlow
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
|
@ -30,7 +28,7 @@ class MoonConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
data={},
|
data={},
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.async_show_form(step_id="user", data_schema=vol.Schema({}))
|
return self.async_show_form(step_id="user")
|
||||||
|
|
||||||
async def async_step_import(self, user_input: dict[str, Any]) -> FlowResult:
|
async def async_step_import(self, user_input: dict[str, Any]) -> FlowResult:
|
||||||
"""Handle import from configuration.yaml."""
|
"""Handle import from configuration.yaml."""
|
||||||
|
|
|
@ -5,8 +5,6 @@ import logging
|
||||||
from types import MappingProxyType
|
from types import MappingProxyType
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_REAUTH
|
from homeassistant.config_entries import SOURCE_REAUTH
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
from homeassistant.helpers import config_entry_oauth2_flow
|
from homeassistant.helpers import config_entry_oauth2_flow
|
||||||
|
@ -46,9 +44,7 @@ class OAuth2FlowHandler(
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Confirm reauth upon migration of old entries."""
|
"""Confirm reauth upon migration of old entries."""
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(
|
return self.async_show_form(step_id="reauth_confirm")
|
||||||
step_id="reauth_confirm", data_schema=vol.Schema({})
|
|
||||||
)
|
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResult:
|
async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResult:
|
||||||
|
|
|
@ -232,10 +232,7 @@ class NestFlowHandler(
|
||||||
"""Confirm reauth dialog."""
|
"""Confirm reauth dialog."""
|
||||||
assert self.config_mode != ConfigMode.LEGACY, "Step only supported for SDM API"
|
assert self.config_mode != ConfigMode.LEGACY, "Step only supported for SDM API"
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(
|
return self.async_show_form(step_id="reauth_confirm")
|
||||||
step_id="reauth_confirm",
|
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
)
|
|
||||||
existing_entries = self._async_current_entries()
|
existing_entries = self._async_current_entries()
|
||||||
if existing_entries:
|
if existing_entries:
|
||||||
# Pick an existing auth implementation for Reauth if present. Note
|
# Pick an existing auth implementation for Reauth if present. Note
|
||||||
|
|
|
@ -75,10 +75,7 @@ class NetatmoFlowHandler(
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Dialog that informs the user that reauth is required."""
|
"""Dialog that informs the user that reauth is required."""
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(
|
return self.async_show_form(step_id="reauth_confirm")
|
||||||
step_id="reauth_confirm",
|
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
)
|
|
||||||
|
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
}
|
}
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="confirm_discovery",
|
step_id="confirm_discovery",
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
description_placeholders={
|
description_placeholders={
|
||||||
"name": self.title,
|
"name": self.title,
|
||||||
"ip_address": self.ip_address,
|
"ip_address": self.ip_address,
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""Config flow for Profiler integration."""
|
"""Config flow for Profiler integration."""
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
|
|
||||||
from .const import DEFAULT_NAME, DOMAIN
|
from .const import DEFAULT_NAME, DOMAIN
|
||||||
|
@ -19,4 +17,4 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return self.async_create_entry(title=DEFAULT_NAME, data={})
|
return self.async_create_entry(title=DEFAULT_NAME, data={})
|
||||||
|
|
||||||
return self.async_show_form(step_id="user", data_schema=vol.Schema({}))
|
return self.async_show_form(step_id="user")
|
||||||
|
|
|
@ -97,7 +97,6 @@ class RTSPToWebRTCConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="hassio_confirm",
|
step_id="hassio_confirm",
|
||||||
description_placeholders={"addon": self._hassio_discovery["addon"]},
|
description_placeholders={"addon": self._hassio_discovery["addon"]},
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,6 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="reauth_confirm",
|
step_id="reauth_confirm",
|
||||||
description_placeholders={"url": self.entry.data[CONF_URL]},
|
description_placeholders={"url": self.entry.data[CONF_URL]},
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
errors={},
|
errors={},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from spotipy import Spotify
|
from spotipy import Spotify
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.components import persistent_notification
|
from homeassistant.components import persistent_notification
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
@ -83,7 +82,6 @@ class SpotifyFlowHandler(
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="reauth_confirm",
|
step_id="reauth_confirm",
|
||||||
description_placeholders={"account": self.reauth_entry.data["id"]},
|
description_placeholders={"account": self.reauth_entry.data["id"]},
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
errors={},
|
errors={},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -115,5 +115,4 @@ class VelbusConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="discovery_confirm",
|
step_id="discovery_confirm",
|
||||||
description_placeholders={CONF_NAME: self._title},
|
description_placeholders={CONF_NAME: self._title},
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -454,7 +454,6 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
self._must_show_form = False
|
self._must_show_form = False
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id=step_id,
|
step_id=step_id,
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
description_placeholders={"access_token": self._data[CONF_ACCESS_TOKEN]},
|
description_placeholders={"access_token": self._data[CONF_ACCESS_TOKEN]},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,6 @@ class VLCTelnetConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="hassio_confirm",
|
step_id="hassio_confirm",
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
description_placeholders={"addon": self.hassio_discovery["addon"]},
|
description_placeholders={"addon": self.hassio_discovery["addon"]},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="discovery_confirm",
|
step_id="discovery_confirm",
|
||||||
description_placeholders=placeholders,
|
description_placeholders=placeholders,
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_pick_device(
|
async def async_step_pick_device(
|
||||||
|
|
|
@ -136,9 +136,7 @@ class XiaomiMiioFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
"""Dialog that informs the user that reauth is required."""
|
"""Dialog that informs the user that reauth is required."""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return await self.async_step_cloud()
|
return await self.async_step_cloud()
|
||||||
return self.async_show_form(
|
return self.async_show_form(step_id="reauth_confirm")
|
||||||
step_id="reauth_confirm", data_schema=vol.Schema({})
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_step_import(self, conf: dict):
|
async def async_step_import(self, conf: dict):
|
||||||
"""Import a configuration from config.yaml."""
|
"""Import a configuration from config.yaml."""
|
||||||
|
|
|
@ -156,7 +156,6 @@ class ZhaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="confirm",
|
step_id="confirm",
|
||||||
description_placeholders={CONF_NAME: self._title},
|
description_placeholders={CONF_NAME: self._title},
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_zeroconf(
|
async def async_step_zeroconf(
|
||||||
|
|
|
@ -385,7 +385,6 @@ class ConfigFlow(BaseZwaveJSFlow, config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="usb_confirm",
|
step_id="usb_confirm",
|
||||||
description_placeholders={CONF_NAME: self._title},
|
description_placeholders={CONF_NAME: self._title},
|
||||||
data_schema=vol.Schema({}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self._usb_discovery = True
|
self._usb_discovery = True
|
||||||
|
|
|
@ -69,7 +69,7 @@ class FlowResult(TypedDict, total=False):
|
||||||
title: str
|
title: str
|
||||||
data: Mapping[str, Any]
|
data: Mapping[str, Any]
|
||||||
step_id: str
|
step_id: str
|
||||||
data_schema: vol.Schema
|
data_schema: vol.Schema | None
|
||||||
extra: str
|
extra: str
|
||||||
required: bool
|
required: bool
|
||||||
errors: dict[str, str] | None
|
errors: dict[str, str] | None
|
||||||
|
@ -408,7 +408,7 @@ class FlowHandler:
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
step_id: str,
|
step_id: str,
|
||||||
data_schema: vol.Schema = None,
|
data_schema: vol.Schema | None = None,
|
||||||
errors: dict[str, str] | None = None,
|
errors: dict[str, str] | None = None,
|
||||||
description_placeholders: dict[str, Any] | None = None,
|
description_placeholders: dict[str, Any] | None = None,
|
||||||
last_step: bool | None = None,
|
last_step: bool | None = None,
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ async def test_ignore_flow(hass, hass_ws_client):
|
||||||
|
|
||||||
async def async_step_user(self, user_input=None):
|
async def async_step_user(self, user_input=None):
|
||||||
await self.async_set_unique_id("mock-unique-id")
|
await self.async_set_unique_id("mock-unique-id")
|
||||||
return self.async_show_form(step_id="account", data_schema=vol.Schema({}))
|
return self.async_show_form(step_id="account")
|
||||||
|
|
||||||
ws_client = await hass_ws_client(hass)
|
ws_client = await hass_ws_client(hass)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue