|
3 | 3 | import logging
|
4 | 4 |
|
5 | 5 | import voluptuous as vol
|
6 |
| -from homeassistant import config_entries, data_entry_flow |
| 6 | +from homeassistant.config_entries import (CONN_CLASS_LOCAL_PUSH, ConfigEntry, |
| 7 | + ConfigFlow, OptionsFlow) |
7 | 8 | from homeassistant.const import (CONF_DEVICES, CONF_DISCOVERY, CONF_MAC,
|
8 | 9 | CONF_NAME, CONF_TEMPERATURE_UNIT,
|
9 | 10 | UnitOfTemperature)
|
10 | 11 | from homeassistant.core import callback
|
| 12 | +from homeassistant.data_entry_flow import FlowHandler |
11 | 13 | from homeassistant.helpers import config_validation as cv
|
12 | 14 | from homeassistant.helpers import device_registry
|
13 | 15 |
|
|
99 | 101 | )
|
100 | 102 |
|
101 | 103 |
|
102 |
| -class BLEMonitorFlow(data_entry_flow.FlowHandler): |
| 104 | +class BLEMonitorFlow(FlowHandler): |
103 | 105 | """BLEMonitor flow."""
|
104 | 106 |
|
105 | 107 | def __init__(self):
|
@@ -333,17 +335,17 @@ async def async_step_add_remove_device(self, user_input=None):
|
333 | 335 | )
|
334 | 336 |
|
335 | 337 |
|
336 |
| -class BLEMonitorConfigFlow(BLEMonitorFlow, config_entries.ConfigFlow, domain=DOMAIN): |
| 338 | +class BLEMonitorConfigFlow(BLEMonitorFlow, ConfigFlow, domain=DOMAIN): |
337 | 339 | """BLEMonitor config flow."""
|
338 | 340 |
|
339 | 341 | VERSION = 5
|
340 |
| - CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH |
| 342 | + CONNECTION_CLASS = CONN_CLASS_LOCAL_PUSH |
341 | 343 |
|
342 | 344 | @staticmethod
|
343 | 345 | @callback
|
344 |
| - def async_get_options_flow(config_entry): |
| 346 | + def async_get_options_flow(config_entry: ConfigEntry): |
345 | 347 | """Get the options flow for this handler."""
|
346 |
| - return BLEMonitorOptionsFlow(config_entry) |
| 348 | + return BLEMonitorOptionsFlow() |
347 | 349 |
|
348 | 350 | def _show_main_form(self, errors=None):
|
349 | 351 | return self._show_user_form("user", DOMAIN_SCHEMA, errors or {})
|
@@ -383,13 +385,16 @@ async def async_step_import(self, user_input=None):
|
383 | 385 | return await self.async_step_user(user_input)
|
384 | 386 |
|
385 | 387 |
|
386 |
| -class BLEMonitorOptionsFlow(BLEMonitorFlow, config_entries.OptionsFlow): |
| 388 | +class BLEMonitorOptionsFlow(BLEMonitorFlow, OptionsFlow): |
387 | 389 | """Handle BLE Monitor options."""
|
388 | 390 |
|
389 |
| - def __init__(self, config_entry): |
| 391 | + def __init__(self): |
390 | 392 | """Initialize options flow."""
|
391 | 393 | super().__init__()
|
392 |
| - self.config_entry = config_entry |
| 394 | + |
| 395 | + @property |
| 396 | + def config_entry(self): |
| 397 | + return self.hass.config_entries.async_get_entry(self.handler) |
393 | 398 |
|
394 | 399 | def _show_main_form(self, errors=None):
|
395 | 400 | options_schema = vol.Schema(
|
|
0 commit comments