fix: unsubscribe config-entry listener on unload

This commit is contained in:
dajiaohuang 2026-10-05 15:03:17 +08:00
commit f874d28853

View file

@ -106,7 +106,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
# This will reload any changes the user made to any YAML configurations.
# Called during 'quick reload' or hass.reload_config_entry
hass.bus.async_listen("hass.config.entry_updated", reload_configuration_yaml)
config_entry.async_on_unload(
hass.bus.async_listen("hass.config.entry_updated", reload_configuration_yaml),
)
undo_listener = config_entry.add_update_listener(async_update_options)
data[config_entry.entry_id] = {UNDO_UPDATE_LISTENER: undo_listener}