From 0d58580717ceee98747d645e1982147533a36a71 Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Thu, 6 Mar 2025 21:49:02 +0100 Subject: [PATCH 1/4] Fix config_flow Tbd --- custom_components/ble_monitor/config_flow.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/custom_components/ble_monitor/config_flow.py b/custom_components/ble_monitor/config_flow.py index 53bbe775..00cff3cf 100644 --- a/custom_components/ble_monitor/config_flow.py +++ b/custom_components/ble_monitor/config_flow.py @@ -3,7 +3,8 @@ import logging import voluptuous as vol -from homeassistant import config_entries, data_entry_flow +from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow +from homeassistant.data_entry_flow import FlowHandler from homeassistant.const import (CONF_DEVICES, CONF_DISCOVERY, CONF_MAC, CONF_NAME, CONF_TEMPERATURE_UNIT, UnitOfTemperature) @@ -99,7 +100,7 @@ ) -class BLEMonitorFlow(data_entry_flow.FlowHandler): +class BLEMonitorFlow(FlowHandler): """BLEMonitor flow.""" def __init__(self): @@ -333,7 +334,7 @@ async def async_step_add_remove_device(self, user_input=None): ) -class BLEMonitorConfigFlow(BLEMonitorFlow, config_entries.ConfigFlow, domain=DOMAIN): +class BLEMonitorConfigFlow(BLEMonitorFlow, ConfigFlow, domain=DOMAIN): """BLEMonitor config flow.""" VERSION = 5 @@ -341,9 +342,9 @@ class BLEMonitorConfigFlow(BLEMonitorFlow, config_entries.ConfigFlow, domain=DOM @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow(config_entry: ConfigEntry): """Get the options flow for this handler.""" - return BLEMonitorOptionsFlow(config_entry) + return BLEMonitorOptionsFlow() def _show_main_form(self, errors=None): return self._show_user_form("user", DOMAIN_SCHEMA, errors or {}) @@ -383,13 +384,16 @@ async def async_step_import(self, user_input=None): return await self.async_step_user(user_input) -class BLEMonitorOptionsFlow(BLEMonitorFlow, config_entries.OptionsFlow): +class BLEMonitorOptionsFlow(BLEMonitorFlow, OptionsFlow): """Handle BLE Monitor options.""" - def __init__(self, config_entry): + def __init__(self): """Initialize options flow.""" super().__init__() - self.config_entry = config_entry + + @property + def config_entry(self): + return self.hass.config_entries.async_get_entry(self.handler) def _show_main_form(self, errors=None): options_schema = vol.Schema( From 063d7290d36c57576694b6196d6fae9b98fb0fcc Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Thu, 6 Mar 2025 21:53:11 +0100 Subject: [PATCH 2/4] Sort imports --- custom_components/ble_monitor/config_flow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/ble_monitor/config_flow.py b/custom_components/ble_monitor/config_flow.py index 00cff3cf..28287a8f 100644 --- a/custom_components/ble_monitor/config_flow.py +++ b/custom_components/ble_monitor/config_flow.py @@ -4,11 +4,11 @@ import voluptuous as vol from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow -from homeassistant.data_entry_flow import FlowHandler from homeassistant.const import (CONF_DEVICES, CONF_DISCOVERY, CONF_MAC, CONF_NAME, CONF_TEMPERATURE_UNIT, UnitOfTemperature) from homeassistant.core import callback +from homeassistant.data_entry_flow import FlowHandler from homeassistant.helpers import config_validation as cv from homeassistant.helpers import device_registry From 57be69e06355501d4af5a37fd53c1bd6222c6e3d Mon Sep 17 00:00:00 2001 From: Ernst79 Date: Sun, 9 Mar 2025 19:12:40 +0100 Subject: [PATCH 3/4] fix config_entries --- custom_components/ble_monitor/config_flow.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/ble_monitor/config_flow.py b/custom_components/ble_monitor/config_flow.py index 28287a8f..8ebafea4 100644 --- a/custom_components/ble_monitor/config_flow.py +++ b/custom_components/ble_monitor/config_flow.py @@ -3,7 +3,8 @@ import logging import voluptuous as vol -from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow +from homeassistant.config_entries import (CONN_CLASS_LOCAL_PUSH, ConfigEntry, + ConfigFlow, OptionsFlow) from homeassistant.const import (CONF_DEVICES, CONF_DISCOVERY, CONF_MAC, CONF_NAME, CONF_TEMPERATURE_UNIT, UnitOfTemperature) @@ -338,7 +339,7 @@ class BLEMonitorConfigFlow(BLEMonitorFlow, ConfigFlow, domain=DOMAIN): """BLEMonitor config flow.""" VERSION = 5 - CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH + CONNECTION_CLASS = CONN_CLASS_LOCAL_PUSH @staticmethod @callback From 35fec7bec878376f9ee6505af5618554ed691f82 Mon Sep 17 00:00:00 2001 From: Ernst79 Date: Sun, 9 Mar 2025 19:21:35 +0100 Subject: [PATCH 4/4] bump version --- custom_components/ble_monitor/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/ble_monitor/manifest.json b/custom_components/ble_monitor/manifest.json index 8cd0c163..d7bc31a4 100644 --- a/custom_components/ble_monitor/manifest.json +++ b/custom_components/ble_monitor/manifest.json @@ -14,5 +14,5 @@ "btsocket>=0.3.0", "pyric>=0.1.6.3" ], - "version": "13.0.0" + "version": "13.0.1" }