From f8b601f871067a010997a347fc5098d54a6bfcc7 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sun, 20 Nov 2022 15:08:36 +0100 Subject: [PATCH] Show several hints and tips at Live View This contains the following information: * No connection to the NRF module possible * No time set * Default password used --- src/WebApi_ws_live.cpp | 11 +++++++ webapp/src/components/HintView.vue | 50 ++++++++++++++++++++++++++++++ webapp/src/types/LiveDataStatus.ts | 7 +++++ webapp/src/views/HomeView.vue | 3 ++ 4 files changed, 71 insertions(+) create mode 100644 webapp/src/components/HintView.vue diff --git a/src/WebApi_ws_live.cpp b/src/WebApi_ws_live.cpp index 91dc62c8..35f94d51 100644 --- a/src/WebApi_ws_live.cpp +++ b/src/WebApi_ws_live.cpp @@ -5,6 +5,7 @@ #include "WebApi_ws_live.h" #include "AsyncJson.h" #include "Configuration.h" +#include "defaults.h" WebApiWsLiveClass::WebApiWsLiveClass() : _ws("/livedata") @@ -150,6 +151,16 @@ void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root) addTotalField(totalObj, "Power", totalPower, "W", 1); addTotalField(totalObj, "YieldDay", totalYieldDay, "Wh", 0); addTotalField(totalObj, "YieldTotal", totalYieldTotal, "kWh", 2); + + JsonObject hintObj = root.createNestedObject("hints"); + struct tm timeinfo; + hintObj[F("time_sync")] = !getLocalTime(&timeinfo, 5); + hintObj[F("radio_problem")] = (!Hoymiles.getRadio()->isConnected() || !Hoymiles.getRadio()->isPVariant()); + if (!strcmp(Configuration.get().Security_Password, ACCESS_POINT_PASSWORD)) { + hintObj[F("default_password")] = true; + } else { + hintObj[F("default_password")] = false; + } } void WebApiWsLiveClass::addField(JsonObject& root, uint8_t idx, std::shared_ptr inv, uint8_t channel, uint8_t fieldId, String topic) diff --git a/webapp/src/components/HintView.vue b/webapp/src/components/HintView.vue new file mode 100644 index 00000000..c684a0c8 --- /dev/null +++ b/webapp/src/components/HintView.vue @@ -0,0 +1,50 @@ + + + \ No newline at end of file diff --git a/webapp/src/types/LiveDataStatus.ts b/webapp/src/types/LiveDataStatus.ts index 4079a382..68d106a5 100644 --- a/webapp/src/types/LiveDataStatus.ts +++ b/webapp/src/types/LiveDataStatus.ts @@ -38,7 +38,14 @@ export interface Total { YieldTotal: ValueObject; }; +export interface Hints { + time_sync: boolean; + default_password: boolean; + radio_problem: boolean; +}; + export interface LiveData { inverters: Inverter[]; total: Total; + hints: Hints; } \ No newline at end of file diff --git a/webapp/src/views/HomeView.vue b/webapp/src/views/HomeView.vue index 1c56a455..0d5c65fa 100644 --- a/webapp/src/views/HomeView.vue +++ b/webapp/src/views/HomeView.vue @@ -1,5 +1,6 @@