Fix dangling task for crownstone (#88292)

This commit is contained in:
Paulus Schoutsen 2023-02-17 14:51:22 -05:00 committed by GitHub
parent 26f0de0d80
commit 5a31bb2ff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,6 @@
"""Manager to set up IO with Crownstone devices for a config entry."""
from __future__ import annotations
import asyncio
import logging
from typing import Any
@ -87,7 +86,9 @@ class CrownstoneEntryManager:
project_name=PROJECT_NAME,
)
# Listen for events in the background, without task tracking
asyncio.create_task(self.async_process_events(self.sse))
self.config_entry.async_create_background_task(
self.hass, self.async_process_events(self.sse), "crownstone-sse"
)
setup_sse_listeners(self)
# Set up a Crownstone USB only if path exists