Fix dangling task for wiz (#88301)

This commit is contained in:
Paulus Schoutsen 2023-02-17 09:29:46 -05:00 committed by GitHub
parent 9989a4787b
commit f3e4783a5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,6 @@
"""WiZ Platform integration."""
from __future__ import annotations
import asyncio
from datetime import timedelta
import logging
from typing import Any
@ -51,7 +50,7 @@ async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
hass, await async_discover_devices(hass, DISCOVER_SCAN_TIMEOUT)
)
asyncio.create_task(_async_discovery())
hass.async_create_background_task(_async_discovery(), "wiz-discovery")
async_track_time_interval(hass, _async_discovery, DISCOVERY_INTERVAL)
return True