9
9
import homeassistant .helpers .config_validation as cv
10
10
import voluptuous as vol
11
11
from aiohttp import ClientSession
12
- from homeassistant import config_entries
12
+ from homeassistant .config_entries import (
13
+ ConfigEntry ,
14
+ ConfigFlow ,
15
+ ConfigFlowResult ,
16
+ OptionsFlow ,
17
+ )
13
18
from homeassistant .const import CONF_HOST , CONF_PASSWORD , CONF_USERNAME
14
19
from homeassistant .core import callback
15
- from homeassistant .data_entry_flow import FlowResult
16
20
from homeassistant .exceptions import HomeAssistantError
17
21
from homeassistant .helpers .aiohttp_client import async_get_clientsession
18
22
from ta_cmi import CMI , ApiError , Device , InvalidCredentialsError , RateLimitError
@@ -79,7 +83,7 @@ async def fetch_device(device: Device, retry=False) -> None:
79
83
raise
80
84
81
85
82
- class ConfigFlow (config_entries . ConfigFlow , domain = DOMAIN ):
86
+ class ConfigFlow (ConfigFlow , domain = DOMAIN ):
83
87
"""Handle a config flow for Technische Alternative C.M.I.."""
84
88
85
89
VERSION = 1
@@ -97,7 +101,7 @@ def __init__(self) -> None:
97
101
98
102
async def async_step_user (
99
103
self , user_input : dict [str , Any ] | None = None
100
- ) -> FlowResult :
104
+ ) -> ConfigFlowResult :
101
105
"""Handle the initial step."""
102
106
errors : dict [str , Any ] = {}
103
107
@@ -139,7 +143,7 @@ async def async_step_user(
139
143
140
144
async def async_step_devices (
141
145
self , user_input : dict [str , Any ] | None = None
142
- ) -> FlowResult :
146
+ ) -> ConfigFlowResult :
143
147
"""Step for setup devices."""
144
148
errors : dict [str , Any ] = {}
145
149
@@ -229,7 +233,7 @@ def _generate_channel_types(self) -> list[str]:
229
233
230
234
async def async_step_channel (
231
235
self , user_input : dict [str , Any ] | None = None
232
- ) -> FlowResult :
236
+ ) -> ConfigFlowResult :
233
237
"""Step for setup channels."""
234
238
235
239
errors : dict [str , Any ] = {}
@@ -278,7 +282,7 @@ async def async_step_channel(
278
282
errors = errors ,
279
283
)
280
284
281
- async def async_step_finish (self ) -> FlowResult :
285
+ async def async_step_finish (self ) -> ConfigFlowResult :
282
286
"""Step for save the config."""
283
287
# Wait to prevent rate limiting from being triggered.
284
288
end_time = time .time ()
@@ -290,7 +294,7 @@ async def async_step_finish(self) -> FlowResult:
290
294
@staticmethod
291
295
@callback
292
296
def async_get_options_flow (
293
- config_entry : config_entries . ConfigEntry ,
297
+ config_entry : ConfigEntry ,
294
298
) -> OptionsFlowHandler :
295
299
"""Get the options flow for this handler."""
296
300
return OptionsFlowHandler (config_entry )
@@ -314,17 +318,16 @@ def get_schema(config: dict[str, Any], device_count: int) -> vol.Schema:
314
318
)
315
319
316
320
317
- class OptionsFlowHandler (config_entries . OptionsFlow ):
321
+ class OptionsFlowHandler (OptionsFlow ):
318
322
"""Handle a option flow for Technische Alternative C.M.I.."""
319
323
320
- def __init__ (self , config_entry : config_entries . ConfigEntry ) -> None :
324
+ def __init__ (self , config_entry : ConfigEntry ) -> None :
321
325
"""Initialize options flow."""
322
- self .config_entry = config_entry
323
- self .data = dict (self .config_entry .data )
326
+ self .data = dict (config_entry .data )
324
327
325
328
async def async_step_init (
326
329
self , user_input : dict [str , Any ] | None = None
327
- ) -> FlowResult :
330
+ ) -> ConfigFlowResult :
328
331
"""Handle options flow."""
329
332
330
333
errors : dict [str , Any ] = {}
0 commit comments