Skip to content

Commit 79aae30

Browse files
authored
Merge branch 'master' into mikrotik
2 parents 7bc3d0a + 48a1bb2 commit 79aae30

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

custom_components/ble_monitor/config_flow.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import logging
44

55
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)
78
from homeassistant.const import (CONF_DEVICES, CONF_DISCOVERY, CONF_MAC,
89
CONF_NAME, CONF_TEMPERATURE_UNIT,
910
UnitOfTemperature)
1011
from homeassistant.core import callback
12+
from homeassistant.data_entry_flow import FlowHandler
1113
from homeassistant.helpers import config_validation as cv
1214
from homeassistant.helpers import device_registry
1315

@@ -99,7 +101,7 @@
99101
)
100102

101103

102-
class BLEMonitorFlow(data_entry_flow.FlowHandler):
104+
class BLEMonitorFlow(FlowHandler):
103105
"""BLEMonitor flow."""
104106

105107
def __init__(self):
@@ -333,17 +335,17 @@ async def async_step_add_remove_device(self, user_input=None):
333335
)
334336

335337

336-
class BLEMonitorConfigFlow(BLEMonitorFlow, config_entries.ConfigFlow, domain=DOMAIN):
338+
class BLEMonitorConfigFlow(BLEMonitorFlow, ConfigFlow, domain=DOMAIN):
337339
"""BLEMonitor config flow."""
338340

339341
VERSION = 5
340-
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
342+
CONNECTION_CLASS = CONN_CLASS_LOCAL_PUSH
341343

342344
@staticmethod
343345
@callback
344-
def async_get_options_flow(config_entry):
346+
def async_get_options_flow(config_entry: ConfigEntry):
345347
"""Get the options flow for this handler."""
346-
return BLEMonitorOptionsFlow(config_entry)
348+
return BLEMonitorOptionsFlow()
347349

348350
def _show_main_form(self, errors=None):
349351
return self._show_user_form("user", DOMAIN_SCHEMA, errors or {})
@@ -383,13 +385,16 @@ async def async_step_import(self, user_input=None):
383385
return await self.async_step_user(user_input)
384386

385387

386-
class BLEMonitorOptionsFlow(BLEMonitorFlow, config_entries.OptionsFlow):
388+
class BLEMonitorOptionsFlow(BLEMonitorFlow, OptionsFlow):
387389
"""Handle BLE Monitor options."""
388390

389-
def __init__(self, config_entry):
391+
def __init__(self):
390392
"""Initialize options flow."""
391393
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)
393398

394399
def _show_main_form(self, errors=None):
395400
options_schema = vol.Schema(

0 commit comments

Comments
 (0)