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:
parent
f6622ea8e0
commit
b75277cc24
1 changed files with 2 additions and 1 deletions
|
@ -32,6 +32,7 @@ from homeassistant.core import (
|
||||||
from homeassistant.exceptions import HomeAssistantError, PlatformNotReady
|
from homeassistant.exceptions import HomeAssistantError, PlatformNotReady
|
||||||
from homeassistant.generated import languages
|
from homeassistant.generated import languages
|
||||||
from homeassistant.setup import async_start_setup
|
from homeassistant.setup import async_start_setup
|
||||||
|
from homeassistant.util.async_ import create_eager_task
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
config_validation as cv,
|
config_validation as cv,
|
||||||
|
@ -988,7 +989,7 @@ class EntityPlatform:
|
||||||
return
|
return
|
||||||
|
|
||||||
if tasks := [
|
if tasks := [
|
||||||
entity.async_update_ha_state(True)
|
create_eager_task(entity.async_update_ha_state(True))
|
||||||
for entity in self.entities.values()
|
for entity in self.entities.values()
|
||||||
if entity.should_poll
|
if entity.should_poll
|
||||||
]:
|
]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue