Skip to content

Commit 0d58580

Browse files
authored
Fix config_flow
Tbd
1 parent 319c18c commit 0d58580

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

custom_components/ble_monitor/config_flow.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import logging
44

55
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
78
from homeassistant.const import (CONF_DEVICES, CONF_DISCOVERY, CONF_MAC,
89
CONF_NAME, CONF_TEMPERATURE_UNIT,
910
UnitOfTemperature)
@@ -99,7 +100,7 @@
99100
)
100101

101102

102-
class BLEMonitorFlow(data_entry_flow.FlowHandler):
103+
class BLEMonitorFlow(FlowHandler):
103104
"""BLEMonitor flow."""
104105

105106
def __init__(self):
@@ -333,17 +334,17 @@ async def async_step_add_remove_device(self, user_input=None):
333334
)
334335

335336

336-
class BLEMonitorConfigFlow(BLEMonitorFlow, config_entries.ConfigFlow, domain=DOMAIN):
337+
class BLEMonitorConfigFlow(BLEMonitorFlow, ConfigFlow, domain=DOMAIN):
337338
"""BLEMonitor config flow."""
338339

339340
VERSION = 5
340341
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
341342

342343
@staticmethod
343344
@callback
344-
def async_get_options_flow(config_entry):
345+
def async_get_options_flow(config_entry: ConfigEntry):
345346
"""Get the options flow for this handler."""
346-
return BLEMonitorOptionsFlow(config_entry)
347+
return BLEMonitorOptionsFlow()
347348

348349
def _show_main_form(self, errors=None):
349350
return self._show_user_form("user", DOMAIN_SCHEMA, errors or {})
@@ -383,13 +384,16 @@ async def async_step_import(self, user_input=None):
383384
return await self.async_step_user(user_input)
384385

385386

386-
class BLEMonitorOptionsFlow(BLEMonitorFlow, config_entries.OptionsFlow):
387+
class BLEMonitorOptionsFlow(BLEMonitorFlow, OptionsFlow):
387388
"""Handle BLE Monitor options."""
388389

389-
def __init__(self, config_entry):
390+
def __init__(self):
390391
"""Initialize options flow."""
391392
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)
393397

394398
def _show_main_form(self, errors=None):
395399
options_schema = vol.Schema(

0 commit comments

Comments
 (0)