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