ESPHome: Remove disconnect callbacks after they are done (#69169)

This commit is contained in:
Jesse Hills 2022-04-04 03:19:23 +12:00 committed by GitHub
parent 198f4a12f0
commit 0558be0ab2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -520,6 +520,7 @@ async def _cleanup_instance(
data = domain_data.pop_entry_data(entry)
for disconnect_cb in data.disconnect_callbacks:
disconnect_cb()
data.disconnect_callbacks = []
for cleanup_callback in data.cleanup_callbacks:
cleanup_callback()
await data.client.disconnect()