diff --git a/docs/config_entries_options_flow_handler.md b/docs/config_entries_options_flow_handler.md index f6f60eab..b84e1256 100644 --- a/docs/config_entries_options_flow_handler.md +++ b/docs/config_entries_options_flow_handler.md @@ -47,7 +47,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow): If the component should act on updated options, you can register an update listener to the config entry that will be called when the entry is updated. ```python -entry.add_update_listener(update_listener) +unsub = entry.add_update_listener(update_listener) ``` The Listener shall be an async function that takes the same input as async_setup_entry. Options can then be accessed from `entry.options`. @@ -56,3 +56,9 @@ The Listener shall be an async function that takes the same input as async_setup async def update_listener(hass, entry): """Handle options update.""" ``` + +Don't forget to unsubscribe the update listener when your config entry is unloaded. You can do this by calling the unsubscribe function returned from adding the listener: + +```python +unsub() +```