From 5a31bb2ff3c2d4438a87253f227aa246f4d83e74 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 17 Feb 2023 14:51:22 -0500 Subject: [PATCH] Fix dangling task for crownstone (#88292) --- homeassistant/components/crownstone/entry_manager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/crownstone/entry_manager.py b/homeassistant/components/crownstone/entry_manager.py index 575a76b45b6..bb6b00942e5 100644 --- a/homeassistant/components/crownstone/entry_manager.py +++ b/homeassistant/components/crownstone/entry_manager.py @@ -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