Migrate integrations a-d to generic flowhandler (#111861)
This commit is contained in:
parent
ba4120d779
commit
6fe28d3764
111 changed files with 841 additions and 758 deletions
|
@ -9,10 +9,9 @@ from blinkpy.auth import Auth, LoginError, TokenRefreshFailed
|
|||
from blinkpy.blinkpy import Blink, BlinkSetupError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigFlow
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_PIN, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.data_entry_flow import FlowResult
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
|
@ -51,7 +50,7 @@ class BlinkConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> FlowResult:
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle a flow initiated by the user."""
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
|
@ -86,7 +85,7 @@ class BlinkConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_2fa(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> FlowResult:
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle 2FA step."""
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
|
@ -113,12 +112,14 @@ class BlinkConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
errors=errors,
|
||||
)
|
||||
|
||||
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 migration of old entries."""
|
||||
return await self.async_step_user(dict(entry_data))
|
||||
|
||||
@callback
|
||||
def _async_finish_flow(self) -> FlowResult:
|
||||
def _async_finish_flow(self) -> ConfigFlowResult:
|
||||
"""Finish with setup."""
|
||||
assert self.auth
|
||||
return self.async_create_entry(title=DOMAIN, data=self.auth.login_attributes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue