Migrate integrations u-z to generic flowhandler (#111866)
This commit is contained in:
parent
e06446d0fa
commit
9ec9ac4fd4
64 changed files with 577 additions and 454 deletions
|
@ -8,9 +8,8 @@ from typing import Any
|
|||
from aiowithings import AuthScope
|
||||
|
||||
from homeassistant.components.webhook import async_generate_id
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigFlowResult
|
||||
from homeassistant.const import CONF_TOKEN, CONF_WEBHOOK_ID
|
||||
from homeassistant.data_entry_flow import FlowResult
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
|
||||
from .const import CONF_USE_WEBHOOK, DEFAULT_TITLE, DOMAIN
|
||||
|
@ -44,7 +43,9 @@ class WithingsFlowHandler(
|
|||
)
|
||||
}
|
||||
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(
|
||||
self, entry_data: Mapping[str, Any]
|
||||
) -> ConfigFlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self.reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
self.context["entry_id"]
|
||||
|
@ -53,13 +54,13 @@ class WithingsFlowHandler(
|
|||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> FlowResult:
|
||||
) -> ConfigFlowResult:
|
||||
"""Confirm reauth dialog."""
|
||||
if user_input is None:
|
||||
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:
|
||||
async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
|
||||
"""Create an entry for the flow, or update existing entry."""
|
||||
user_id = str(data[CONF_TOKEN]["userid"])
|
||||
if not self.reauth_entry:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue