mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Improve type hints in homematicip_cloud (#87269)
This commit is contained in:
parent
527de22adf
commit
23a9b92a1c
@ -1,6 +1,8 @@
|
|||||||
"""Config flow to configure the HomematicIP Cloud component."""
|
"""Config flow to configure the HomematicIP Cloud component."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
@ -20,11 +22,15 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize HomematicIP Cloud config flow."""
|
"""Initialize HomematicIP Cloud config flow."""
|
||||||
|
|
||||||
async def async_step_user(self, user_input=None) -> FlowResult:
|
async def async_step_user(
|
||||||
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
) -> FlowResult:
|
||||||
"""Handle a flow initialized by the user."""
|
"""Handle a flow initialized by the user."""
|
||||||
return await self.async_step_init(user_input)
|
return await self.async_step_init(user_input)
|
||||||
|
|
||||||
async def async_step_init(self, user_input=None) -> FlowResult:
|
async def async_step_init(
|
||||||
|
self, user_input: dict[str, str] | None = None
|
||||||
|
) -> FlowResult:
|
||||||
"""Handle a flow start."""
|
"""Handle a flow start."""
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
@ -55,7 +61,7 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_link(self, user_input=None) -> FlowResult:
|
async def async_step_link(self, user_input: None = None) -> FlowResult:
|
||||||
"""Attempt to link with the HomematicIP Cloud access point."""
|
"""Attempt to link with the HomematicIP Cloud access point."""
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
@ -65,9 +71,9 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
if authtoken:
|
if authtoken:
|
||||||
_LOGGER.info("Write config entry for HomematicIP Cloud")
|
_LOGGER.info("Write config entry for HomematicIP Cloud")
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=self.auth.config.get(HMIPC_HAPID),
|
title=self.auth.config[HMIPC_HAPID],
|
||||||
data={
|
data={
|
||||||
HMIPC_HAPID: self.auth.config.get(HMIPC_HAPID),
|
HMIPC_HAPID: self.auth.config[HMIPC_HAPID],
|
||||||
HMIPC_AUTHTOKEN: authtoken,
|
HMIPC_AUTHTOKEN: authtoken,
|
||||||
HMIPC_NAME: self.auth.config.get(HMIPC_NAME),
|
HMIPC_NAME: self.auth.config.get(HMIPC_NAME),
|
||||||
},
|
},
|
||||||
@ -77,7 +83,7 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
return self.async_show_form(step_id="link", errors=errors)
|
return self.async_show_form(step_id="link", errors=errors)
|
||||||
|
|
||||||
async def async_step_import(self, import_info) -> FlowResult:
|
async def async_step_import(self, import_info: dict[str, str]) -> FlowResult:
|
||||||
"""Import a new access point as a config entry."""
|
"""Import a new access point as a config entry."""
|
||||||
hapid = import_info[HMIPC_HAPID].replace("-", "").upper()
|
hapid = import_info[HMIPC_HAPID].replace("-", "").upper()
|
||||||
authtoken = import_info[HMIPC_AUTHTOKEN]
|
authtoken = import_info[HMIPC_AUTHTOKEN]
|
||||||
|
@ -27,7 +27,7 @@ class HomematicipAuth:
|
|||||||
|
|
||||||
auth: AsyncAuth
|
auth: AsyncAuth
|
||||||
|
|
||||||
def __init__(self, hass, config) -> None:
|
def __init__(self, hass: HomeAssistant, config: dict[str, str]) -> None:
|
||||||
"""Initialize HomematicIP Cloud client registration."""
|
"""Initialize HomematicIP Cloud client registration."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.config = config
|
self.config = config
|
||||||
|
Loading…
x
Reference in New Issue
Block a user