1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Switch async_track_same_state to use async_call_later (#99219)

* Switch async_track_same_state to use async_call_later

There was no need to use async_track_point_in_utc_time here since
we only need a delay

* update trigger tests

* remove some more utcnow patching

* remove some more utcnow patching

* remove some more utcnow patching
This commit is contained in:
J. Nick Koston
2023-08-28 15:30:20 -05:00
committed by GitHub
parent 95c03b4192
commit 0e6b3d6583
3 changed files with 249 additions and 280 deletions

View File

@@ -1327,9 +1327,7 @@ def async_track_same_state(
if not async_check_same_func(entity, from_state, to_state):
clear_listener()
async_remove_state_for_listener = async_track_point_in_utc_time(
hass, state_for_listener, dt_util.utcnow() + period
)
async_remove_state_for_listener = async_call_later(hass, period, state_for_listener)
if entity_ids == MATCH_ALL:
async_remove_state_for_cancel = hass.bus.async_listen(