From fc42d4391becc48a69f6bdbbf0b1833b8850a719 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Fri, 18 Aug 2023 09:20:41 +0200 Subject: [PATCH] Fixed ENTSO-E price fetching around midnight --- lib/EntsoePriceApi/src/EntsoeApi.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/EntsoePriceApi/src/EntsoeApi.cpp b/lib/EntsoePriceApi/src/EntsoeApi.cpp index 0731f461..79b6baae 100644 --- a/lib/EntsoePriceApi/src/EntsoeApi.cpp +++ b/lib/EntsoePriceApi/src/EntsoeApi.cpp @@ -303,12 +303,12 @@ float EntsoeApi::getCurrencyMultiplier(const char* from, const char* to, time_t PricesContainer* EntsoeApi::fetchPrices(time_t t) { if(strlen(getToken()) > 0) { tmElements_t tm; - breakTime(t, tm); - time_t e1 = t - (tm.Hour * 3600) - (tm.Minute * 60) - tm.Second; // UTC midnight + breakTime(tz->toLocal(t), tm); + time_t e1 = t - (tm.Hour * 3600) - (tm.Minute * 60) - tm.Second; // Local midnight time_t e2 = e1 + SECS_PER_DAY; tmElements_t d1, d2; - breakTime(tz->toUTC(e1), d1); // To get day and hour for CET/CEST at UTC midnight - breakTime(tz->toUTC(e2), d2); + breakTime(e1, d1); + breakTime(e2, d2); snprintf_P(buf, BufferSize, PSTR("https://web-api.tp.entsoe.eu/api?securityToken=%s&documentType=A44&periodStart=%04d%02d%02d%02d%02d&periodEnd=%04d%02d%02d%02d%02d&in_Domain=%s&out_Domain=%s"), getToken(),