diff --git a/homeassistant/components/zha/core/channels/security.py b/homeassistant/components/zha/core/channels/security.py index 58990851ca0..b5a8d5d8cf5 100644 --- a/homeassistant/components/zha/core/channels/security.py +++ b/homeassistant/components/zha/core/channels/security.py @@ -5,7 +5,6 @@ https://home-assistant.io/integrations/zha/ """ from __future__ import annotations -import asyncio from collections.abc import Callable from typing import TYPE_CHECKING, Any @@ -351,7 +350,7 @@ class IASZoneChannel(ZigbeeChannel): elif command_id == 1: self.debug("Enroll requested") res = self._cluster.enroll_response(0, 0) - asyncio.create_task(res) + self._cluster.create_catching_task(res) async def async_configure(self): """Configure IAS device.""" diff --git a/homeassistant/components/zha/core/gateway.py b/homeassistant/components/zha/core/gateway.py index a1691c1a419..af2fec6c6a8 100644 --- a/homeassistant/components/zha/core/gateway.py +++ b/homeassistant/components/zha/core/gateway.py @@ -254,7 +254,9 @@ class ZHAGateway: ) # background the fetching of state for mains powered devices - asyncio.create_task(fetch_updated_state()) + self._hass.async_create_background_task( + fetch_updated_state(), "zha.gateway-fetch_updated_state" + ) def device_joined(self, device: zigpy.device.Device) -> None: """Handle device joined. diff --git a/homeassistant/components/zha/light.py b/homeassistant/components/zha/light.py index 1e6bf203d01..832104892fb 100644 --- a/homeassistant/components/zha/light.py +++ b/homeassistant/components/zha/light.py @@ -1,7 +1,6 @@ """Lights on Zigbee Home Automation networks.""" from __future__ import annotations -import asyncio from collections import Counter from collections.abc import Callable from datetime import timedelta @@ -613,7 +612,10 @@ class BaseLight(LogMixin, light.LightEntity): ) if self._debounced_member_refresh is not None: self.debug("transition complete - refreshing group member states") - asyncio.create_task(self._debounced_member_refresh.async_call()) + self.hass.async_create_background_task( + self._debounced_member_refresh.async_call(), + "zha.light-refresh-debounced-member", + ) @STRICT_MATCH(channel_names=CHANNEL_ON_OFF, aux_channels={CHANNEL_COLOR, CHANNEL_LEVEL})