From b75277cc24a7bb5a522669cf2a896c91cfc567a1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 26 Feb 2024 15:49:09 -1000 Subject: [PATCH] Use an eager task to update multiple entities (#111556) If there are multiple entities on the same platform its likely that only one of them will suspend in the update so schedule them eagerly --- homeassistant/helpers/entity_platform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/helpers/entity_platform.py b/homeassistant/helpers/entity_platform.py index f2893302e1d..6703935c10a 100644 --- a/homeassistant/helpers/entity_platform.py +++ b/homeassistant/helpers/entity_platform.py @@ -32,6 +32,7 @@ from homeassistant.core import ( from homeassistant.exceptions import HomeAssistantError, PlatformNotReady from homeassistant.generated import languages from homeassistant.setup import async_start_setup +from homeassistant.util.async_ import create_eager_task from . import ( config_validation as cv, @@ -988,7 +989,7 @@ class EntityPlatform: return if tasks := [ - entity.async_update_ha_state(True) + create_eager_task(entity.async_update_ha_state(True)) for entity in self.entities.values() if entity.should_poll ]: