Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve config flow type hints in wolflink #125313

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions homeassistant/components/wolflink/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Config flow for Wolf SmartSet Service integration."""

import logging
from typing import Any

from httpcore import ConnectError
import voluptuous as vol
from wolf_comm.models import Device
from wolf_comm.token_auth import InvalidAuth
from wolf_comm.wolf_client import WolfClient

Expand All @@ -26,14 +26,15 @@ class WolfLinkConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
MINOR_VERSION = 2

fetched_systems: list[Device]

def __init__(self) -> None:
"""Initialize with empty username and password."""
self.username = None
self.password = None
self.fetched_systems = None
self.username: str | None = None
self.password: str | None = None

async def async_step_user(
self, user_input: dict[str, Any] | None = None
self, user_input: dict[str, str] | None = None
) -> ConfigFlowResult:
"""Handle the initial step to get connection parameters."""
errors = {}
Expand All @@ -58,9 +59,11 @@ async def async_step_user(
step_id="user", data_schema=USER_SCHEMA, errors=errors
)

async def async_step_device(self, user_input=None):
async def async_step_device(
self, user_input: dict[str, str] | None = None
) -> ConfigFlowResult:
"""Allow user to select device from devices connected to specified account."""
errors = {}
errors: dict[str, str] = {}
if user_input is not None:
device_name = user_input[DEVICE_NAME]
system = [
Expand Down