From 1e7124d44a161e03fe4431e2572b0f6657763e0d Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 31 Mar 2023 15:52:51 +0200 Subject: [PATCH] Add link to config entry migration (#1735) --- docs/config_entries_index.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/config_entries_index.md b/docs/config_entries_index.md index 8ad5b255..b0d95d7e 100644 --- a/docs/config_entries_index.md +++ b/docs/config_entries_index.md @@ -139,3 +139,12 @@ If a component needs to clean up code when an entry is removed, it can define a async def async_remove_entry(hass, entry) -> None: """Handle removal of an entry.""" ``` + +## Migrating config entries to a new version + +If the config entry version is changed, `async_migrate_entry` must be implemented to support the migration of old entries. This is documented in detail in the [config flow documentation](/config_entries_config_flow_handler.md#config-entry-migration) + +```python +async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: + """Migrate old entry.""" +```