Migrate integrations a-d to generic flowhandler (#111861)

This commit is contained in:
Erik Montnemery 2024-02-29 20:07:14 +01:00 committed by GitHub
parent ba4120d779
commit 6fe28d3764
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
111 changed files with 841 additions and 758 deletions

View file

@ -6,10 +6,9 @@ from typing import Any
from bsblan import BSBLAN, BSBLANError
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.device_registry import format_mac
@ -30,7 +29,7 @@ class BSBLANFlowHandler(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."""
if user_input is None:
return self._show_setup_form()
@ -49,7 +48,7 @@ class BSBLANFlowHandler(ConfigFlow, domain=DOMAIN):
return self._async_create_entry()
@callback
def _show_setup_form(self, errors: dict | None = None) -> FlowResult:
def _show_setup_form(self, errors: dict | None = None) -> ConfigFlowResult:
"""Show the setup form to the user."""
return self.async_show_form(
step_id="user",
@ -66,7 +65,7 @@ class BSBLANFlowHandler(ConfigFlow, domain=DOMAIN):
)
@callback
def _async_create_entry(self) -> FlowResult:
def _async_create_entry(self) -> ConfigFlowResult:
return self.async_create_entry(
title=format_mac(self.mac),
data={