mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Use async_track_utc_time_change to schedule short term statistics (#58903)
This commit is contained in:
parent
a9c0f89c09
commit
34e5596375
@ -41,6 +41,7 @@ from homeassistant.helpers.entityfilter import (
|
|||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
async_track_time_change,
|
async_track_time_change,
|
||||||
async_track_time_interval,
|
async_track_time_interval,
|
||||||
|
async_track_utc_time_change,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.integration_platform import (
|
from homeassistant.helpers.integration_platform import (
|
||||||
async_process_integration_platforms,
|
async_process_integration_platforms,
|
||||||
@ -622,7 +623,7 @@ class Recorder(threading.Thread):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Compile short term statistics every 5 minutes
|
# Compile short term statistics every 5 minutes
|
||||||
async_track_time_change(
|
async_track_utc_time_change(
|
||||||
self.hass, self.async_periodic_statistics, minute=range(0, 60, 5), second=10
|
self.hass, self.async_periodic_statistics, minute=range(0, 60, 5), second=10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1483,7 +1483,7 @@ def async_track_time_change(
|
|||||||
minute: Any | None = None,
|
minute: Any | None = None,
|
||||||
second: Any | None = None,
|
second: Any | None = None,
|
||||||
) -> CALLBACK_TYPE:
|
) -> CALLBACK_TYPE:
|
||||||
"""Add a listener that will fire if UTC time matches a pattern."""
|
"""Add a listener that will fire if local time matches a pattern."""
|
||||||
return async_track_utc_time_change(hass, action, hour, minute, second, local=True)
|
return async_track_utc_time_change(hass, action, hour, minute, second, local=True)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user