Spread seconds (#5025)

This commit is contained in:
Johann Kellerman 2016-12-21 09:42:23 +02:00 committed by Fabian Affolter
parent a8b3900913
commit b170f4c399

View File

@ -7,6 +7,7 @@ https://home-assistant.io/components/sensor.yr/
import asyncio import asyncio
from datetime import timedelta from datetime import timedelta
import logging import logging
from random import randrange
from xml.parsers.expat import ExpatError from xml.parsers.expat import ExpatError
import async_timeout 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) yield from async_add_devices(dev)
weather = YrData(hass, coordinates, dev) weather = YrData(hass, coordinates, dev)
# Update weather on the hour # Update weather on the hour, spread seconds
async_track_utc_time_change(hass, weather.async_update, minute=0, second=0) async_track_utc_time_change(hass, weather.async_update, minute=0,
second=randrange(5, 25))
yield from weather.async_update() yield from weather.async_update()