diff --git a/src/CHANGES.md b/src/CHANGES.md index a11a4e2b..fd02a030 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,8 @@ # Development Changes +## 0.8.50 - 2024-01-09 +* merge PR: added history charts to web #1336 + ## 0.8.49 - 2024-01-08 * fix send total values if inverter state is different from `OFF` #1331 * fix german language issues #1335 diff --git a/src/defines.h b/src/defines.h index b205297f..9d0e97c9 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 49 +#define VERSION_PATCH 50 //------------------------------------- typedef struct { diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 26ca571f..96a4c5e4 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -794,7 +794,6 @@ class RestApi { void getPowerHistory(AsyncWebServerRequest *request, JsonObject obj) { getGeneric(request, obj.createNestedObject(F("generic"))); obj[F("refresh")] = mConfig->inst.sendInterval; - obj[F("datapoints")] = HISTORY_DATA_ARR_LENGTH; uint16_t max = 0; for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) { uint16_t value = mApp->getHistoryValue((uint8_t)HistoryStorageType::POWER, fld); @@ -809,7 +808,6 @@ class RestApi { void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) { getGeneric(request, obj.createNestedObject(F("generic"))); obj[F("refresh")] = 86400; // 1 day - obj[F("datapoints")] = HISTORY_DATA_ARR_LENGTH; uint16_t max = 0; for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) { uint16_t value = mApp->getHistoryValue((uint8_t)HistoryStorageType::YIELD, fld); diff --git a/src/web/html/history.html b/src/web/html/history.html index 5b6c1fb5..d0f33755 100644 --- a/src/web/html/history.html +++ b/src/web/html/history.html @@ -1,135 +1,113 @@ + + {#NAV_HISTORY} + {#HTML_HEADER} + + - - History - {#HTML_HEADER} - - + - - - - {#HTML_NAV} -
-
-

Total Power history

-
-
-

- Maximum day: W. Last value: W.
- Maximum graphics: W. Updated every seconds

-
-

Yield per day history

-
-
-

- Maximum value: Wh
- Updated every seconds

+ + {#HTML_NAV} +
+
+

{#TOTAL_POWER}

+
+
+

+ {#MAX_DAY}: W. {#LAST_VALUE}: W.
+ {#MAXIMUM}: W. {#UPDATED} {#SECONDS} +

+
+

{#TOTAL_YIELD_PER_DAY}

+
+
+

+ {#MAXIMUM}: Wh
+ {#UPDATED} {#SECONDS} +

+
+
+ {#HTML_FOOTER} -

Insert data into Yield per day history

-
- Insert data (*.json) i.e. from a saved "/api/yieldDayHistory" call -
- - -
-
-

-
-
- {#HTML_FOOTER} + + function parsePowerHistory(obj){ + if (null != obj) { + parseHistory(obj,"pwr", pwrExeOnce) + document.getElementById("pwrLast").innerHTML = mLastValue + document.getElementById("pwrMaxDay").innerHTML = obj.maxDay + } + if (pwrExeOnce) { + pwrExeOnce = false; + window.setInterval("getAjax('/api/powerHistory', parsePowerHistory)", mRefresh * 1000); - + setTimeout(() => { + getAjax("/api/yieldDayHistory", parseYieldDayHistory); + } , 20); + } + } + function parseYieldDayHistory(obj) { + if (null != obj) { + parseNav(obj.generic); + parseHistory(obj, "yd", ydExeOnce) + } + if (ydExeOnce) { + ydExeOnce = false; + window.setInterval("getAjax('/api/yieldDayHistory', parseYieldDayHistory)", mRefresh * 500); + } + } - \ No newline at end of file + getAjax("/api/powerHistory", parsePowerHistory); + + + diff --git a/src/web/html/save.html b/src/web/html/save.html index e5d5a67d..bfc9a12a 100644 --- a/src/web/html/save.html +++ b/src/web/html/save.html @@ -1,7 +1,7 @@ - Save + {#NAV_SAVE} {#HTML_HEADER} diff --git a/src/web/html/serial.html b/src/web/html/serial.html index ef7aa4c3..25940eb0 100644 --- a/src/web/html/serial.html +++ b/src/web/html/serial.html @@ -1,7 +1,7 @@ - Serial Console + {#NAV_WEBSERIAL} {#HTML_HEADER} diff --git a/src/web/html/style.css b/src/web/html/style.css index 3ad91a8b..ef581ffa 100644 --- a/src/web/html/style.css +++ b/src/web/html/style.css @@ -36,21 +36,17 @@ textarea { svg rect {fill: #0000AA;} svg.chart { background: #f2f2f2; - border: 2px solid gray; - padding: 1px; + border: 2px solid gray; + padding: 1px; } div.chartDivContainer { - padding: 1px; - margin: 1px; + padding: 1px; + margin: 1px; } div.chartdivContainer span { color: var(--fg2); } -div.chartDiv { - padding: 0px; - margin: 0px; -} .topnav { diff --git a/src/web/html/visualization.html b/src/web/html/visualization.html index 8099539c..15b0c7b5 100644 --- a/src/web/html/visualization.html +++ b/src/web/html/visualization.html @@ -1,7 +1,7 @@ - Live + {#NAV_LIVE} {#HTML_HEADER} diff --git a/src/web/html/wizard.html b/src/web/html/wizard.html index 674823b2..3df44dc4 100644 --- a/src/web/html/wizard.html +++ b/src/web/html/wizard.html @@ -1,7 +1,7 @@ - Setup Wizard + {#NAV_WIZARD} {#HTML_HEADER} diff --git a/src/web/lang.json b/src/web/lang.json index 9f1b9e5e..cb8ab8d6 100644 --- a/src/web/lang.json +++ b/src/web/lang.json @@ -3,13 +3,18 @@ { "name": "general", "list": [ + { + "token": "NAV_WIZARD", + "en": "Setup Wizard", + "de": "Daten" + }, { "token": "NAV_LIVE", "en": "Live", "de": "Daten" }, { - "token": "{#NAV_HISTORY}", + "token": "NAV_HISTORY", "en": "History", "de": "Verlauf" }, @@ -28,6 +33,11 @@ "en": "Documentation", "de": "Dokumentation" }, + { + "token": "NAV_SAVE", + "en": "save", + "de": "speichern" + }, { "token": "NAV_ABOUT", "en": "About", @@ -1334,6 +1344,46 @@ "de": "Fehler beim Speichern" } ] + }, + { + "name": "history.html", + "list": [ + { + "token": "TOTAL_POWER", + "en": "Total Power", + "de": "Gesamtleistung" + }, + { + "token": "TOTAL_YIELD_PER_DAY", + "en": "Total Yield per day", + "de": "Gesamtertrag pro Tag" + }, + { + "token": "MAX_DAY", + "en": "maximum day", + "de": "Tagesmaximum" + }, + { + "token": "LAST_VALUE", + "en": "last value", + "de": "letzter Wert" + }, + { + "token": "MAXIMUM", + "en": "maximum value", + "de": "Maximalwert" + }, + { + "token": "UPDATED", + "en": "Updated every", + "de": "aktualisiert alle" + }, + { + "token": "SECONDS", + "en": "seconds", + "de": "Sekunden" + } + ] } ] }