mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Adjust config-flow type hints in philips_js (#72443)
This commit is contained in:
parent
71bc650ac7
commit
4f14d40072
@ -15,12 +15,13 @@ from homeassistant.const import (
|
|||||||
CONF_PIN,
|
CONF_PIN,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
|
|
||||||
from . import LOGGER
|
from . import LOGGER
|
||||||
from .const import CONF_ALLOW_NOTIFY, CONF_SYSTEM, CONST_APP_ID, CONST_APP_NAME, DOMAIN
|
from .const import CONF_ALLOW_NOTIFY, CONF_SYSTEM, CONST_APP_ID, CONST_APP_NAME, DOMAIN
|
||||||
|
|
||||||
|
|
||||||
async def validate_input(
|
async def _validate_input(
|
||||||
hass: core.HomeAssistant, host: str, api_version: int
|
hass: core.HomeAssistant, host: str, api_version: int
|
||||||
) -> tuple[dict, PhilipsTV]:
|
) -> tuple[dict, PhilipsTV]:
|
||||||
"""Validate the user input allows us to connect."""
|
"""Validate the user input allows us to connect."""
|
||||||
@ -47,7 +48,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._hub: PhilipsTV | None = None
|
self._hub: PhilipsTV | None = None
|
||||||
self._pair_state: Any = None
|
self._pair_state: Any = None
|
||||||
|
|
||||||
async def _async_create_current(self):
|
async def _async_create_current(self) -> FlowResult:
|
||||||
|
|
||||||
system = self._current[CONF_SYSTEM]
|
system = self._current[CONF_SYSTEM]
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
@ -55,7 +56,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
data=self._current,
|
data=self._current,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_pair(self, user_input: dict | None = None) -> dict:
|
async def async_step_pair(
|
||||||
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
) -> FlowResult:
|
||||||
"""Attempt to pair with device."""
|
"""Attempt to pair with device."""
|
||||||
assert self._hub
|
assert self._hub
|
||||||
|
|
||||||
@ -106,13 +109,15 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._current[CONF_PASSWORD] = password
|
self._current[CONF_PASSWORD] = password
|
||||||
return await self._async_create_current()
|
return await self._async_create_current()
|
||||||
|
|
||||||
async def async_step_user(self, user_input: dict | None = None) -> dict:
|
async def async_step_user(
|
||||||
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
) -> FlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors = {}
|
errors = {}
|
||||||
if user_input:
|
if user_input:
|
||||||
self._current = user_input
|
self._current = user_input
|
||||||
try:
|
try:
|
||||||
hub = await validate_input(
|
hub = await _validate_input(
|
||||||
self.hass, user_input[CONF_HOST], user_input[CONF_API_VERSION]
|
self.hass, user_input[CONF_HOST], user_input[CONF_API_VERSION]
|
||||||
)
|
)
|
||||||
except ConnectionFailure as exc:
|
except ConnectionFailure as exc:
|
||||||
@ -146,7 +151,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@core.callback
|
@core.callback
|
||||||
def async_get_options_flow(config_entry):
|
def async_get_options_flow(
|
||||||
|
config_entry: config_entries.ConfigEntry,
|
||||||
|
) -> OptionsFlowHandler:
|
||||||
"""Get the options flow for this handler."""
|
"""Get the options flow for this handler."""
|
||||||
return OptionsFlowHandler(config_entry)
|
return OptionsFlowHandler(config_entry)
|
||||||
|
|
||||||
@ -158,7 +165,9 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
"""Initialize options flow."""
|
"""Initialize options flow."""
|
||||||
self.config_entry = config_entry
|
self.config_entry = config_entry
|
||||||
|
|
||||||
async def async_step_init(self, user_input=None):
|
async def async_step_init(
|
||||||
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
) -> FlowResult:
|
||||||
"""Handle options flow."""
|
"""Handle options flow."""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return self.async_create_entry(title="", data=user_input)
|
return self.async_create_entry(title="", data=user_input)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user