mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Spread seconds (#5025)
This commit is contained in:
parent
a8b3900913
commit
b170f4c399
@ -7,6 +7,7 @@ https://home-assistant.io/components/sensor.yr/
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from random import randrange
|
||||
from xml.parsers.expat import ExpatError
|
||||
|
||||
import async_timeout
|
||||
@ -80,8 +81,9 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||
yield from async_add_devices(dev)
|
||||
|
||||
weather = YrData(hass, coordinates, dev)
|
||||
# Update weather on the hour
|
||||
async_track_utc_time_change(hass, weather.async_update, minute=0, second=0)
|
||||
# Update weather on the hour, spread seconds
|
||||
async_track_utc_time_change(hass, weather.async_update, minute=0,
|
||||
second=randrange(5, 25))
|
||||
yield from weather.async_update()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user