File tree 1 file changed +5
-1
lines changed
homeassistant/components/tibber
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 2
2
import asyncio
3
3
from datetime import timedelta
4
4
import logging
5
+ from random import randrange
5
6
6
7
import aiohttp
7
8
@@ -59,6 +60,7 @@ def __init__(self, tibber_home):
59
60
self ._name = tibber_home .info ["viewer" ]["home" ]["address" ].get (
60
61
"address1" , ""
61
62
)
63
+ self ._spread_load_constant = randrange (3600 )
62
64
63
65
@property
64
66
def device_state_attributes (self ):
@@ -110,7 +112,8 @@ async def async_update(self):
110
112
111
113
if (
112
114
not self ._tibber_home .last_data_timestamp
113
- or (self ._tibber_home .last_data_timestamp - now ).total_seconds () / 3600 < 12
115
+ or (self ._tibber_home .last_data_timestamp - now ).total_seconds ()
116
+ < 12 * 3600 + self ._spread_load_constant
114
117
or not self ._is_available
115
118
):
116
119
_LOGGER .debug ("Asking for new data" )
@@ -156,6 +159,7 @@ def unique_id(self):
156
159
157
160
@Throttle (MIN_TIME_BETWEEN_UPDATES )
158
161
async def _fetch_data (self ):
162
+ _LOGGER .debug ("Fetching data" )
159
163
try :
160
164
await self ._tibber_home .update_info_and_price_info ()
161
165
except (asyncio .TimeoutError , aiohttp .ClientError ):
You can’t perform that action at this time.
0 commit comments