Fixed incorrect time diff for price fetch

This commit is contained in:
Gunnar Skjold 2022-01-16 17:04:58 +01:00
parent 4b51f0f235
commit 04daf551fb
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ EntsoeApi::EntsoeApi(RemoteDebug* Debug) {
TimeChangeRule CET = {"CET ", Last, Sun, Oct, 3, 60};
tz = new Timezone(CEST, CET);
tomorrowFetchMillis = random(3600000,3780000); // Random between 13:30 and 14:00
tomorrowFetchMillis = 36000000 + (random(1800) * 1000); // Random between 13:30 and 14:00
}
void EntsoeApi::setup(EntsoeConfig& config) {
@ -64,7 +64,7 @@ float EntsoeApi::getValueForHour(time_t cur, uint8_t hour) {
return ENTSOE_NO_VALUE;
}
multiplier *= getCurrencyMultiplier(tomorrow->getCurrency(), config->currency);
} else {
} else if(pos > 0) {
if(today == NULL)
return ENTSOE_NO_VALUE;
value = today->getPoint(pos);

View File

@ -35,7 +35,7 @@ private:
WiFiClientSecure client;
HTTPClient https;
uint32_t tomorrowFetchMillis = 3600000; // Number of ms before midnight. Default fetch 10hrs before midnight (14:00 CE(S)T)
uint32_t tomorrowFetchMillis = 36000000; // Number of ms before midnight. Default fetch 10hrs before midnight (14:00 CE(S)T)
uint64_t midnightMillis = 0;
uint64_t lastTodayFetch = 0;
uint64_t lastTomorrowFetch = 0;