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
This commit is contained in:
J. Nick Koston 2024-02-26 15:49:09 -10:00 committed by GitHub
parent f6622ea8e0
commit b75277cc24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
]: