Fix nest to cancel event listener on config entry unload (#119257)

This commit is contained in:
Allen Porter 2024-06-09 23:18:50 -07:00 committed by GitHub
parent 8b6fbd5b3f
commit f046545883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -224,7 +224,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Close connection when hass stops.""" """Close connection when hass stops."""
subscriber.stop_async() subscriber.stop_async()
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop) entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop)
)
hass.data[DOMAIN][entry.entry_id] = { hass.data[DOMAIN][entry.entry_id] = {
DATA_SUBSCRIBER: subscriber, DATA_SUBSCRIBER: subscriber,