mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Avoid task creation when calling schedule_update_ha_state without force update (#91352)
This commit is contained in:
parent
9e1a670e6e
commit
445b823232
@ -698,10 +698,13 @@ class Entity(ABC):
|
|||||||
If state is changed more than once before the ha state change task has
|
If state is changed more than once before the ha state change task has
|
||||||
been executed, the intermediate state transitions will be missed.
|
been executed, the intermediate state transitions will be missed.
|
||||||
"""
|
"""
|
||||||
self.hass.create_task(
|
if force_refresh:
|
||||||
self.async_update_ha_state(force_refresh),
|
self.hass.create_task(
|
||||||
f"Entity {self.entity_id} schedule update ha state",
|
self.async_update_ha_state(force_refresh),
|
||||||
)
|
f"Entity {self.entity_id} schedule update ha state",
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.hass.loop.call_soon_threadsafe(self.async_write_ha_state)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_schedule_update_ha_state(self, force_refresh: bool = False) -> None:
|
def async_schedule_update_ha_state(self, force_refresh: bool = False) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user