Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config_flow #1439

Merged
merged 4 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions custom_components/ble_monitor/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import logging

import voluptuous as vol
from homeassistant import config_entries, data_entry_flow
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)
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

Expand Down Expand Up @@ -99,7 +101,7 @@
)


class BLEMonitorFlow(data_entry_flow.FlowHandler):
class BLEMonitorFlow(FlowHandler):
"""BLEMonitor flow."""

def __init__(self):
Expand Down Expand Up @@ -333,17 +335,17 @@ 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
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
CONNECTION_CLASS = CONN_CLASS_LOCAL_PUSH

@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 {})
Expand Down Expand Up @@ -383,13 +385,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(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"btsocket>=0.3.0",
"pyric>=0.1.6.3"
],
"version": "13.0.0"
"version": "13.0.1"
}
Loading