Migrate integrations u-z to generic flowhandler (#111866)

This commit is contained in:
Erik Montnemery 2024-02-29 20:08:16 +01:00 committed by GitHub
parent e06446d0fa
commit 9ec9ac4fd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
64 changed files with 577 additions and 454 deletions

View file

@ -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: