mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 04:05:06 +02:00
revert simplify
This commit is contained in:
@@ -615,10 +615,13 @@ def async_track_utc_time_change(
|
|||||||
now = pattern_utc_now()
|
now = pattern_utc_now()
|
||||||
hass.async_run_job(action, dt_util.as_local(now) if local else now)
|
hass.async_run_job(action, dt_util.as_local(now) if local else now)
|
||||||
|
|
||||||
|
if next_time <= now:
|
||||||
# We only want second level precision for time patterns
|
# We only want second level precision for time patterns
|
||||||
# as we do not want to fire them multiple times in
|
# as we do not want to fire them multiple times in
|
||||||
# the same second.
|
# the same second.
|
||||||
next_time = calculate_next(now + timedelta(seconds=1))
|
next_time = calculate_next(now + timedelta(seconds=1))
|
||||||
|
else:
|
||||||
|
next_time = calculate_next(now)
|
||||||
|
|
||||||
cancel_callback = hass.loop.call_at(
|
cancel_callback = hass.loop.call_at(
|
||||||
hass.loop.time() + next_time.timestamp() - time.time(),
|
hass.loop.time() + next_time.timestamp() - time.time(),
|
||||||
|
Reference in New Issue
Block a user