mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Enhance Androidtv remote config flow typing (#99144)
This commit is contained in:
parent
3db61a99a4
commit
fc6f48e076
@ -12,8 +12,12 @@ from androidtvremote2 import (
|
|||||||
)
|
)
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components import zeroconf
|
from homeassistant.components import zeroconf
|
||||||
|
from homeassistant.config_entries import (
|
||||||
|
ConfigEntry,
|
||||||
|
ConfigFlow,
|
||||||
|
OptionsFlowWithConfigEntry,
|
||||||
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
@ -35,7 +39,7 @@ STEP_PAIR_DATA_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class AndroidTVRemoteConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class AndroidTVRemoteConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Android TV Remote."""
|
"""Handle a config flow for Android TV Remote."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
@ -43,7 +47,7 @@ class AndroidTVRemoteConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize a new AndroidTVRemoteConfigFlow."""
|
"""Initialize a new AndroidTVRemoteConfigFlow."""
|
||||||
self.api: AndroidTVRemote | None = None
|
self.api: AndroidTVRemote | None = None
|
||||||
self.reauth_entry: config_entries.ConfigEntry | None = None
|
self.reauth_entry: ConfigEntry | None = None
|
||||||
self.host: str | None = None
|
self.host: str | None = None
|
||||||
self.name: str | None = None
|
self.name: str | None = None
|
||||||
self.mac: str | None = None
|
self.mac: str | None = None
|
||||||
@ -192,19 +196,15 @@ class AndroidTVRemoteConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(
|
def async_get_options_flow(
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
) -> config_entries.OptionsFlow:
|
) -> AndroidTVRemoteOptionsFlowHandler:
|
||||||
"""Create the options flow."""
|
"""Create the options flow."""
|
||||||
return OptionsFlowHandler(config_entry)
|
return AndroidTVRemoteOptionsFlowHandler(config_entry)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(config_entries.OptionsFlow):
|
class AndroidTVRemoteOptionsFlowHandler(OptionsFlowWithConfigEntry):
|
||||||
"""Android TV Remote options flow."""
|
"""Android TV Remote options flow."""
|
||||||
|
|
||||||
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
|
||||||
"""Initialize options flow."""
|
|
||||||
self.config_entry = config_entry
|
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user