diff --git a/homeassistant/helpers/trigger.py b/homeassistant/helpers/trigger.py index 2483806abc1..d98b24f9afd 100644 --- a/homeassistant/helpers/trigger.py +++ b/homeassistant/helpers/trigger.py @@ -28,6 +28,7 @@ from homeassistant.core import ( ) from homeassistant.exceptions import HomeAssistantError from homeassistant.loader import IntegrationNotFound, async_get_integration +from homeassistant.util.async_ import create_eager_task from .typing import ConfigType, TemplateVarsType @@ -305,7 +306,7 @@ async def async_initialize_triggers( variables: TemplateVarsType = None, ) -> CALLBACK_TYPE | None: """Initialize triggers.""" - triggers: list[Coroutine[Any, Any, CALLBACK_TYPE]] = [] + triggers: list[asyncio.Task[CALLBACK_TYPE]] = [] for idx, conf in enumerate(trigger_config): # Skip triggers that are not enabled if not conf.get(CONF_ENABLED, True): @@ -325,8 +326,10 @@ async def async_initialize_triggers( ) triggers.append( - platform.async_attach_trigger( - hass, conf, _trigger_action_wrapper(hass, action, conf), info + create_eager_task( + platform.async_attach_trigger( + hass, conf, _trigger_action_wrapper(hass, action, conf), info + ) ) )