From ffe7d47b31167605ff89d3310d8161ca222d8ab6 Mon Sep 17 00:00:00 2001 From: lumapu Date: Mon, 24 Jul 2023 23:33:54 +0200 Subject: [PATCH] 0.7.16 * next attempt to fix yield day for multiple inverters #1016 * fix export settings date #1040 * fix time on WebUI (timezone was not observed) #913 #1016 --- src/CHANGES.md | 5 +++++ src/defines.h | 2 +- src/hm/hmInverter.h | 2 +- src/publisher/pubMqttIvData.h | 17 +++++++++++++---- src/web/RestApi.h | 2 +- src/web/html/api.js | 4 ++++ src/web/html/index.html | 10 +++------- src/web/html/visualization.html | 2 +- 8 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index 07654865..b428404c 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,10 @@ # Development Changes +## 0.7.16 - 2023-07-24 +* next attempt to fix yield day for multiple inverters #1016 +* fix export settings date #1040 +* fix time on WebUI (timezone was not observed) #913 #1016 + ## 0.7.15 - 2023-07-23 * add NTP sync interval #1019 * adjusted range of contrast / luminance setting #1041 diff --git a/src/defines.h b/src/defines.h index c47662bb..b203aa01 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 7 -#define VERSION_PATCH 15 +#define VERSION_PATCH 16 //------------------------------------- typedef struct { diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index cdd6428d..3fcaf55c 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -401,7 +401,7 @@ class Inverter { avail = true; if(avail) { - if(InverterStatus::OFF == status) + if(status < InverterStatus::PRODUCING) status = InverterStatus::STARTING; else status = InverterStatus::WAS_ON; diff --git a/src/publisher/pubMqttIvData.h b/src/publisher/pubMqttIvData.h index e945598b..c7b60446 100644 --- a/src/publisher/pubMqttIvData.h +++ b/src/publisher/pubMqttIvData.h @@ -68,6 +68,7 @@ class PubMqttIvData { void stateStart() { mLastIvId = 0; mTotalFound = false; + mAllTotalFound = true; if(!mSendList->empty()) { mCmd = mSendList->front().cmd; mIvSend = mSendList->front().iv; @@ -150,7 +151,8 @@ class PubMqttIvData { mTotal[3] += mIv->getValue(mPos, rec); break; } - } + } else + mAllTotalFound = false; } } else mIvLastRTRpub[mIv->id] = lastTs; @@ -169,6 +171,7 @@ class PubMqttIvData { void stateSendTotals() { uint8_t fieldId; + mRTRDataHasBeenSent = true; if(mPos < 4) { bool retained = true; switch (mPos) { @@ -178,9 +181,17 @@ class PubMqttIvData { retained = false; break; case 1: + if(!mAllTotalFound) { + mPos++ + return; + } fieldId = FLD_YT; break; case 2: + if(!mAllTotalFound) { + mPos++ + return; + } fieldId = FLD_YD; break; case 3: @@ -197,8 +208,6 @@ class PubMqttIvData { mZeroValues = false; mState = START; } - - mRTRDataHasBeenSent = true; } HMSYSTEM *mSys; @@ -209,7 +218,7 @@ class PubMqttIvData { uint8_t mCmd; uint8_t mLastIvId; - bool mSendTotals, mTotalFound; + bool mSendTotals, mTotalFound, mAllTotalFound; float mTotal[4]; Inverter<> *mIv, *mIvSend; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 9d349214..0f7f8112 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -184,7 +184,7 @@ class RestApi { response = request->beginResponse(200, F("application/json; charset=utf-8"), tmp); } - String filename = ah::getDateTimeStrFile(mApp->getTimezoneOffset()); + String filename = ah::getDateTimeStrFile(gTimezone.toLocal(mApp->getTimestamp())); filename += "_v" + String(mApp->getVersion()); response->addHeader("Content-Type", "application/octet-stream"); diff --git a/src/web/html/api.js b/src/web/html/api.js index f201d8c5..299144a9 100644 --- a/src/web/html/api.js +++ b/src/web/html/api.js @@ -119,6 +119,10 @@ function parseRssi(obj) { document.getElementById("wifiicon").replaceChildren(svg(icon, 32, 32, "wifi", obj["wifi_rssi"])); } +function toIsoDateStr(d) { + return new Date(d.getTime() + (d.getTimezoneOffset() * -60000)).toISOString().substring(0, 19).replace('T', ', '); +} + function setHide(id, hide) { var elm = document.getElementById(id); if(hide) { diff --git a/src/web/html/index.html b/src/web/html/index.html index f3d9a565..f2afe3c0 100644 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -62,10 +62,6 @@ getAjax("/api/setup", apiCb, "POST", JSON.stringify(obj)); } - function ts2Span(ts) { - return span(new Date(ts * 1000).toLocaleString('de-DE')); - } - function parseGeneric(obj) { if(exeOnce) parseESP(obj); @@ -92,7 +88,7 @@ if(obj["ts_now"] < 1680000000) setTime(); else - dSpan.innerHTML = date.toISOString().substring(0, 19).replace('T', ', '); + dSpan.innerHTML = toIsoDateStr(date); } else { dSpan.innerHTML = ""; @@ -157,7 +153,7 @@ if(false == i["is_avail"]) { if(i["ts_last_success"] > 0) { var date = new Date(i["ts_last_success"] * 1000); - p.append(span("-> last successful transmission: " + date.toISOString().substring(0, 19).replace('T', ', ')), br()); + p.append(span("-> last successful transmission: " + toIsoDateStr(date)), br()); } } } @@ -190,7 +186,7 @@ function tick() { if(0 != ts) - document.getElementById("date").innerHTML = (new Date((++ts) * 1000)).toISOString().substring(0, 19).replace('T', ', '); + document.getElementById("date").innerHTML = toIsoDateStr((new Date((++ts) * 1000))); if(++tickCnt >= 10) { tickCnt = 0; getAjax('/api/index', parse); diff --git a/src/web/html/visualization.html b/src/web/html/visualization.html index e4d23507..b7e5042e 100644 --- a/src/web/html/visualization.html +++ b/src/web/html/visualization.html @@ -158,7 +158,7 @@ var ageInfo = "Last received data requested at: "; if(ts > 0) { var date = new Date(ts * 1000); - ageInfo += date.toISOString().substring(0, 19).replace('T', ', '); + ageInfo += toIsoDateStr(date); } else ageInfo += "nothing received";