mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Change Tibber request spread (#129276)
This commit is contained in:
parent
da11a72b4c
commit
7929895b11
@ -50,7 +50,7 @@ ICON = "mdi:currency-usd"
|
||||
SCAN_INTERVAL = timedelta(minutes=1)
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=5)
|
||||
PARALLEL_UPDATES = 0
|
||||
|
||||
TWENTY_MINUTES = 20 * 60
|
||||
|
||||
RT_SENSORS_UNIQUE_ID_MIGRATION = {
|
||||
"accumulated_consumption_last_hour": "accumulated consumption current hour",
|
||||
@ -369,7 +369,7 @@ class TibberSensorElPrice(TibberSensor):
|
||||
"""Initialize the sensor."""
|
||||
super().__init__(tibber_home=tibber_home)
|
||||
self._last_updated: datetime.datetime | None = None
|
||||
self._spread_load_constant = randrange(5000)
|
||||
self._spread_load_constant = randrange(TWENTY_MINUTES)
|
||||
|
||||
self._attr_available = False
|
||||
self._attr_extra_state_attributes = {
|
||||
@ -397,7 +397,7 @@ class TibberSensorElPrice(TibberSensor):
|
||||
if (
|
||||
not self._tibber_home.last_data_timestamp
|
||||
or (self._tibber_home.last_data_timestamp - now).total_seconds()
|
||||
< 5 * 3600 + self._spread_load_constant
|
||||
< 11 * 3600 + self._spread_load_constant
|
||||
or not self.available
|
||||
):
|
||||
_LOGGER.debug("Asking for new data")
|
||||
|
Loading…
x
Reference in New Issue
Block a user