Add link to config entry migration (#1735)

This commit is contained in:
Erik Montnemery 2023-03-31 15:52:51 +02:00 committed by GitHub
parent df7092023c
commit 1e7124d44a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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."""
```