mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-06-16 15:16:30 +00:00
Update config_entries_options_flow_handler.md
This commit is contained in:
parent
f6c0952b01
commit
0f65f56f70
@ -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()
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user