Add scan interval to config of Environment Canada sensor (#25414)

* Make refresh period configurable

* Remove throttle, set SCAN_INTERVAL

* Move SCAN_INTERVAL to module
This commit is contained in:
michaeldavie 2019-07-25 07:56:33 -04:00 committed by Pascal Vizeli
parent fae3546910
commit 59c62a261b

View File

@ -15,11 +15,12 @@ from homeassistant.const import (
TEMP_CELSIUS, CONF_LATITUDE, CONF_LONGITUDE, ATTR_ATTRIBUTION,
ATTR_LOCATION)
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(minutes=10)
ATTR_UPDATED = 'updated'
ATTR_STATION = 'station'
ATTR_DETAIL = 'alert detail'
@ -29,8 +30,6 @@ CONF_ATTRIBUTION = "Data provided by Environment Canada"
CONF_STATION = 'station'
CONF_LANGUAGE = 'language'
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=1)
def validate_station(station):
"""Check that the station ID is well-formed."""
@ -110,7 +109,6 @@ class ECSensor(Entity):
"""Return the units of measurement."""
return self._unit
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Update current conditions."""
self.ec_data.update()