From 4cfc891e88825f05df7456712201c64593ba22c3 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Thu, 5 Dec 2024 21:51:33 +0100 Subject: [PATCH] webapp: show precise data age for inverters since we reduced the DTU polling interval minimum value, it is desirable to have the data age value increment at the right time point, which is dependent on the sub-second data age when the data was crafted. --- src/WebApi_ws_live.cpp | 2 +- webapp/src/types/LiveDataStatus.ts | 2 +- webapp/src/views/HomeView.vue | 40 ++++++++++++++++++++---------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/WebApi_ws_live.cpp b/src/WebApi_ws_live.cpp index 36031a357..02e15aac9 100644 --- a/src/WebApi_ws_live.cpp +++ b/src/WebApi_ws_live.cpp @@ -235,7 +235,7 @@ void WebApiWsLiveClass::generateInverterCommonJsonResponse(JsonObject& root, std root["serial"] = inv->serialString(); root["name"] = inv->name(); root["order"] = inv_cfg->Order; - root["data_age"] = (millis() - inv->Statistics()->getLastUpdate()) / 1000; + root["data_age_ms"] = millis() - inv->Statistics()->getLastUpdate(); root["poll_enabled"] = inv->getEnablePolling(); root["reachable"] = inv->isReachable(); root["producing"] = inv->isProducing(); diff --git a/webapp/src/types/LiveDataStatus.ts b/webapp/src/types/LiveDataStatus.ts index 13f93ee7e..70035ba4f 100644 --- a/webapp/src/types/LiveDataStatus.ts +++ b/webapp/src/types/LiveDataStatus.ts @@ -35,7 +35,7 @@ export interface Inverter { serial: string; name: string; order: number; - data_age: number; + data_age_ms: number; poll_enabled: boolean; reachable: boolean; producing: boolean; diff --git a/webapp/src/views/HomeView.vue b/webapp/src/views/HomeView.vue index d1c772097..0aeb7d808 100644 --- a/webapp/src/views/HomeView.vue +++ b/webapp/src/views/HomeView.vue @@ -96,9 +96,9 @@
{{ $t('home.DataAge') }} - {{ $t('home.Seconds', { val: $n(inverter.data_age) }) }} -