Have async_track_point_in_utc_time call async_run_job directly from call_at (#37790)

We do not need a nested function here since call_at
takes args
This commit is contained in:
J. Nick Koston 2020-07-14 17:24:36 -10:00 committed by GitHub
parent e852a2eb9b
commit 41cd90648e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -328,14 +328,11 @@ def async_track_point_in_utc_time(
# Ensure point_in_time is UTC
point_in_time = dt_util.as_utc(point_in_time)
@callback
def point_in_time_listener() -> None:
"""Listen for matching time_changed events."""
hass.async_run_job(action, point_in_time)
cancel_callback = hass.loop.call_at(
hass.loop.time() + point_in_time.timestamp() - time.time(),
point_in_time_listener,
hass.async_run_job,
action,
point_in_time,
)
@callback