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
This commit is contained in:
Thomas Basler 2022-11-20 15:08:36 +01:00
parent 854af4649c
commit f8b601f871
4 changed files with 71 additions and 0 deletions

View File

@ -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<InverterAbstract> inv, uint8_t channel, uint8_t fieldId, String topic)

View File

@ -0,0 +1,50 @@
<template>
<BootstrapAlert :show="hints.radio_problem" variant="danger">
<BIconBroadcast class="fs-4" /> Could not connect to a correct NRF24L01+ radio module. Please check the wiring.
</BootstrapAlert>
<BootstrapAlert :show="hints.time_sync" variant="danger">
<BIconClock class="fs-4" /> The clock has not yet been synchronised. Without a
correctly set clock, no requests are made to the inverter. This is normal shortly after the start. However,
after a longer runtime (>1 minute), it indicates that the NTP server is not accessible. <a
@click="gotoTimeSettings" href="#" class="alert-link">Please check your time
settings.</a>
</BootstrapAlert>
<BootstrapAlert :show="hints.default_password" variant="danger">
<BIconExclamationCircle class="fs-4" /> You are using the default password for the web interface and the
emergency access point. This is potentially insecure. <a @click="gotoPasswordSettings" href="#"
class="alert-link">Please change the password.</a>
</BootstrapAlert>
</template>
<script lang="ts">
import { defineComponent, type PropType } from 'vue';
import type { Hints } from '@/types/LiveDataStatus';
import BootstrapAlert from '@/components/BootstrapAlert.vue';
import {
BIconClock,
BIconExclamationCircle,
BIconBroadcast,
} from 'bootstrap-icons-vue';
export default defineComponent({
components: {
BootstrapAlert,
BIconClock,
BIconExclamationCircle,
BIconBroadcast,
},
props: {
hints: { type: Object as PropType<Hints>, required: true },
},
methods: {
gotoTimeSettings() {
this.$router.push("/settings/ntp");
},
gotoPasswordSettings() {
this.$router.push("/settings/security");
}
}
});
</script>

View File

@ -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;
}

View File

@ -1,5 +1,6 @@
<template>
<BasePage :title="'Live Data'" :isLoading="dataLoading" :isWideScreen="true">
<HintView :hints="liveData.hints" />
<InverterTotalInfo :totalData="liveData.total" /><br />
<div class="row gy-3">
<div class="col-sm-3 col-md-2" :style="[inverterData.length == 1 ? { 'display': 'none' } : {}]">
@ -335,6 +336,7 @@ import DevInfo from '@/components/DevInfo.vue';
import BootstrapAlert from '@/components/BootstrapAlert.vue';
import InverterChannelInfo from "@/components/InverterChannelInfo.vue";
import InverterTotalInfo from '@/components/InverterTotalInfo.vue';
import HintView from '@/components/HintView.vue';
import type { DevInfoStatus } from '@/types/DevInfoStatus';
import type { EventlogItems } from '@/types/EventlogStatus';
import type { LiveData, Inverter } from '@/types/LiveDataStatus';
@ -348,6 +350,7 @@ export default defineComponent({
BasePage,
InverterChannelInfo,
InverterTotalInfo,
HintView,
EventLog,
DevInfo,
BootstrapAlert,