Skip to content

Commit

Permalink
Adding EVENT_SCAN_INTERVAL and REWARD_SCAN_INTERVAL
Browse files Browse the repository at this point in the history
  • Loading branch information
valleedelisle committed Feb 21, 2022
1 parent cff0bec commit ae953fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions custom_components/hilo/const.py
Expand Up @@ -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 = {
Expand Down
6 changes: 4 additions & 2 deletions custom_components/hilo/sensor.py
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit ae953fc

Please sign in to comment.