Skip to content

Commit ba31f5a

Browse files
authored
Fix deprecation message (#138)
1 parent 80bd06b commit ba31f5a

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

custom_components/ta_cmi/config_flow.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
import homeassistant.helpers.config_validation as cv
1010
import voluptuous as vol
1111
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+
)
1318
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
1419
from homeassistant.core import callback
15-
from homeassistant.data_entry_flow import FlowResult
1620
from homeassistant.exceptions import HomeAssistantError
1721
from homeassistant.helpers.aiohttp_client import async_get_clientsession
1822
from ta_cmi import CMI, ApiError, Device, InvalidCredentialsError, RateLimitError
@@ -79,7 +83,7 @@ async def fetch_device(device: Device, retry=False) -> None:
7983
raise
8084

8185

82-
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
86+
class ConfigFlow(ConfigFlow, domain=DOMAIN):
8387
"""Handle a config flow for Technische Alternative C.M.I.."""
8488

8589
VERSION = 1
@@ -97,7 +101,7 @@ def __init__(self) -> None:
97101

98102
async def async_step_user(
99103
self, user_input: dict[str, Any] | None = None
100-
) -> FlowResult:
104+
) -> ConfigFlowResult:
101105
"""Handle the initial step."""
102106
errors: dict[str, Any] = {}
103107

@@ -139,7 +143,7 @@ async def async_step_user(
139143

140144
async def async_step_devices(
141145
self, user_input: dict[str, Any] | None = None
142-
) -> FlowResult:
146+
) -> ConfigFlowResult:
143147
"""Step for setup devices."""
144148
errors: dict[str, Any] = {}
145149

@@ -229,7 +233,7 @@ def _generate_channel_types(self) -> list[str]:
229233

230234
async def async_step_channel(
231235
self, user_input: dict[str, Any] | None = None
232-
) -> FlowResult:
236+
) -> ConfigFlowResult:
233237
"""Step for setup channels."""
234238

235239
errors: dict[str, Any] = {}
@@ -278,7 +282,7 @@ async def async_step_channel(
278282
errors=errors,
279283
)
280284

281-
async def async_step_finish(self) -> FlowResult:
285+
async def async_step_finish(self) -> ConfigFlowResult:
282286
"""Step for save the config."""
283287
# Wait to prevent rate limiting from being triggered.
284288
end_time = time.time()
@@ -290,7 +294,7 @@ async def async_step_finish(self) -> FlowResult:
290294
@staticmethod
291295
@callback
292296
def async_get_options_flow(
293-
config_entry: config_entries.ConfigEntry,
297+
config_entry: ConfigEntry,
294298
) -> OptionsFlowHandler:
295299
"""Get the options flow for this handler."""
296300
return OptionsFlowHandler(config_entry)
@@ -314,17 +318,16 @@ def get_schema(config: dict[str, Any], device_count: int) -> vol.Schema:
314318
)
315319

316320

317-
class OptionsFlowHandler(config_entries.OptionsFlow):
321+
class OptionsFlowHandler(OptionsFlow):
318322
"""Handle a option flow for Technische Alternative C.M.I.."""
319323

320-
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
324+
def __init__(self, config_entry: ConfigEntry) -> None:
321325
"""Initialize options flow."""
322-
self.config_entry = config_entry
323-
self.data = dict(self.config_entry.data)
326+
self.data = dict(config_entry.data)
324327

325328
async def async_step_init(
326329
self, user_input: dict[str, Any] | None = None
327-
) -> FlowResult:
330+
) -> ConfigFlowResult:
328331
"""Handle options flow."""
329332

330333
errors: dict[str, Any] = {}

0 commit comments

Comments
 (0)