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