From a5170340a39afd6fce16ab7c813540563977ca21 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 16 Feb 2023 23:05:06 -0500 Subject: [PATCH] Fix dangling task for unifiprotect (#88300) --- homeassistant/components/unifiprotect/discovery.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/homeassistant/components/unifiprotect/discovery.py b/homeassistant/components/unifiprotect/discovery.py index d58cad4e40a..1828687c0dd 100644 --- a/homeassistant/components/unifiprotect/discovery.py +++ b/homeassistant/components/unifiprotect/discovery.py @@ -1,7 +1,6 @@ """The unifiprotect integration discovery.""" from __future__ import annotations -import asyncio from dataclasses import asdict from datetime import timedelta import logging @@ -34,7 +33,7 @@ def async_start_discovery(hass: HomeAssistant) -> None: async_trigger_discovery(hass, await async_discover_devices()) # Do not block startup since discovery takes 31s or more - asyncio.create_task(_async_discovery()) + hass.async_create_background_task(_async_discovery(), "unifiprotect-discovery") async_track_time_interval(hass, _async_discovery, DISCOVERY_INTERVAL)