Skip to content

Commit 080ef73

Browse files
committed
fix: migration handler and options flow compatibility
- Add async_migrate_entry for v1 -> v2 config entry migration - Remove OptionsFlow __init__ that conflicts with HA's config_entry property - Bump version to 1.6.1
1 parent 6fb6036 commit 080ef73

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.6.1] - 2026-03-04
9+
10+
### Fixed
11+
12+
- **Migration error on upgrade** - Added missing `async_migrate_entry` handler for existing installations upgrading from v1.5.x
13+
- **Options flow crash** - Fixed `OptionsFlow` constructor conflicting with HA's built-in `config_entry` property
14+
815
## [1.6.0] - 2026-03-04
916

1017
### Added

custom_components/bmw_wallbox/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@
2727
]
2828

2929

30+
async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
31+
"""Migrate old entry to new version."""
32+
_LOGGER.debug("Migrating from version %s", config_entry.version)
33+
34+
if config_entry.version == 1:
35+
# Version 2 added scan_interval - no data changes needed,
36+
# coordinator falls back to DEFAULT_SCAN_INTERVAL if missing
37+
hass.config_entries.async_update_entry(config_entry, version=2)
38+
39+
_LOGGER.info("Migration to version %s successful", config_entry.version)
40+
return True
41+
42+
3043
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
3144
"""Set up BMW Wallbox from a config entry."""
3245
_LOGGER.debug("Setting up BMW Wallbox integration")

custom_components/bmw_wallbox/config_flow.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def async_get_options_flow(
7676
config_entry: config_entries.ConfigEntry,
7777
) -> config_entries.OptionsFlow:
7878
"""Get the options flow for this handler."""
79-
return OptionsFlow(config_entry)
79+
return OptionsFlow()
8080

8181
async def async_step_user(
8282
self, user_input: dict[str, Any] | None = None
@@ -123,10 +123,6 @@ class InvalidSSLKey(HomeAssistantError):
123123
class OptionsFlow(config_entries.OptionsFlow):
124124
"""Handle options flow for BMW Wallbox."""
125125

126-
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
127-
"""Initialize options flow."""
128-
self.config_entry = config_entry
129-
130126
async def async_step_init(
131127
self, user_input: dict[str, Any] | None = None
132128
) -> FlowResult:

custom_components/bmw_wallbox/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"requirements": [
1212
"ocpp>=0.20.0"
1313
],
14-
"version": "1.6.0"
14+
"version": "1.6.1"
1515
}

0 commit comments

Comments
 (0)