mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add async_get_options_flow type hints (hvv) (#73433)
This commit is contained in:
parent
657e7f9a4c
commit
c195d462cc
@ -1,5 +1,8 @@
|
|||||||
"""Config flow for HVV integration."""
|
"""Config flow for HVV integration."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from pygti.auth import GTI_DEFAULT_HOST
|
from pygti.auth import GTI_DEFAULT_HOST
|
||||||
from pygti.exceptions import CannotConnect, InvalidAuth
|
from pygti.exceptions import CannotConnect, InvalidAuth
|
||||||
@ -122,7 +125,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(config_entry):
|
def async_get_options_flow(
|
||||||
|
config_entry: config_entries.ConfigEntry,
|
||||||
|
) -> OptionsFlowHandler:
|
||||||
"""Get options flow."""
|
"""Get options flow."""
|
||||||
return OptionsFlowHandler(config_entry)
|
return OptionsFlowHandler(config_entry)
|
||||||
|
|
||||||
@ -130,12 +135,11 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
class OptionsFlowHandler(config_entries.OptionsFlow):
|
class OptionsFlowHandler(config_entries.OptionsFlow):
|
||||||
"""Options flow handler."""
|
"""Options flow handler."""
|
||||||
|
|
||||||
def __init__(self, config_entry):
|
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
||||||
"""Initialize HVV Departures options flow."""
|
"""Initialize HVV Departures options flow."""
|
||||||
self.config_entry = config_entry
|
self.config_entry = config_entry
|
||||||
self.options = dict(config_entry.options)
|
self.options = dict(config_entry.options)
|
||||||
self.departure_filters = {}
|
self.departure_filters: dict[str, Any] = {}
|
||||||
self.hub = None
|
|
||||||
|
|
||||||
async def async_step_init(self, user_input=None):
|
async def async_step_init(self, user_input=None):
|
||||||
"""Manage the options."""
|
"""Manage the options."""
|
||||||
@ -143,10 +147,10 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
if not self.departure_filters:
|
if not self.departure_filters:
|
||||||
|
|
||||||
departure_list = {}
|
departure_list = {}
|
||||||
self.hub = self.hass.data[DOMAIN][self.config_entry.entry_id]
|
hub: GTIHub = self.hass.data[DOMAIN][self.config_entry.entry_id]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
departure_list = await self.hub.gti.departureList(
|
departure_list = await hub.gti.departureList(
|
||||||
{
|
{
|
||||||
"station": self.config_entry.data[CONF_STATION],
|
"station": self.config_entry.data[CONF_STATION],
|
||||||
"time": {"date": "heute", "time": "jetzt"},
|
"time": {"date": "heute", "time": "jetzt"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user