Missing async_migrate_entry prevents future config entry schema changes #8

Closed
opened 2026-05-09 05:10:29 +00:00 by Mark · 1 comment
Owner

Severity: Low

File: custom_components/yeedi/__init__.py

Issue: The config entry VERSION is set to 1 in config_flow.py, but there is no async_migrate_entry function in __init__.py. If the config entry schema needs to change in a future version (e.g., adding new fields, changing token storage format), there is no migration path. Users would have to remove and re-add the integration, losing their configuration.

Fix: Add a migration function:

async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    if entry.version == 1:
        # Example: migrate from version 1 to 2
        # new_data = {**entry.data, "new_field": "default"}
        # hass.config_entries.async_update_entry(entry, data=new_data, version=2)
        pass
    return True
**Severity:** Low **File:** `custom_components/yeedi/__init__.py` **Issue:** The config entry VERSION is set to 1 in `config_flow.py`, but there is no `async_migrate_entry` function in `__init__.py`. If the config entry schema needs to change in a future version (e.g., adding new fields, changing token storage format), there is no migration path. Users would have to remove and re-add the integration, losing their configuration. **Fix:** Add a migration function: ```python async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: if entry.version == 1: # Example: migrate from version 1 to 2 # new_data = {**entry.data, "new_field": "default"} # hass.config_entries.async_update_entry(entry, data=new_data, version=2) pass return True ```
Author
Owner

Implemented: added async_migrate_entry function with version 1 placeholder. Pushed to main.

Implemented: added async_migrate_entry function with version 1 placeholder. Pushed to main.
Mark closed this issue 2026-05-15 14:26:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/yeedi_awmbuild#8
No description provided.