diff --git a/custom_components/hilo/const.py b/custom_components/hilo/const.py index c946706..e1d67f9 100644 --- a/custom_components/hilo/const.py +++ b/custom_components/hilo/const.py @@ -33,6 +33,8 @@ DEFAULT_APPRECIATION_PHASE = 0 DEFAULT_SCAN_INTERVAL = 60 +EVENT_SCAN_INTERVAL = 600 +REWARD_SCAN_INTERVAL = 7200 MIN_SCAN_INTERVAL = 15 CONF_TARIFF = { diff --git a/custom_components/hilo/sensor.py b/custom_components/hilo/sensor.py index 172b511..aff5b22 100644 --- a/custom_components/hilo/sensor.py +++ b/custom_components/hilo/sensor.py @@ -51,9 +51,11 @@ DEFAULT_SCAN_INTERVAL, DEFAULT_UNTARIFICATED_DEVICES, DOMAIN, + EVENT_SCAN_INTERVAL, HILO_ENERGY_TOTAL, HILO_SENSOR_CLASSES, LOG, + REWARD_SCAN_INTERVAL, TARIFF_LIST, ) from .managers import EnergyManager, UtilityManager @@ -486,7 +488,7 @@ def __init__(self, hilo, device, scan_interval): self._attr_native_unit_of_measurement = hilo._hass.config.currency self._state = 0 self._history = [] - self.async_update = Throttle(self.scan_interval)(self._async_update) + self.async_update = Throttle(REWARD_SCAN_INTERVAL)(self._async_update) @property def state(self): @@ -555,7 +557,7 @@ def __init__(self, hilo, device, scan_interval): self.scan_interval = timedelta(seconds=scan_interval) self._state = "off" self._next_events = [] - self.async_update = Throttle(self.scan_interval)(self._async_update) + self.async_update = Throttle(EVENT_SCAN_INTERVAL)(self._async_update) @property def state(self):