webapp: Add "Not Producing" indicator

This commit is contained in:
Thomas Basler 2022-10-01 12:20:31 +02:00
parent 00b1ff84be
commit bd17ca5199
2 changed files with 9 additions and 3 deletions

View File

@ -85,7 +85,8 @@ void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root)
root[i][F("serial")] = String(buffer); root[i][F("serial")] = String(buffer);
root[i][F("name")] = inv->name(); root[i][F("name")] = inv->name();
root[i][F("data_age")] = (millis() - inv->Statistics()->getLastUpdate()) / 1000; root[i][F("data_age")] = (millis() - inv->Statistics()->getLastUpdate()) / 1000;
root[i][F("reachable")] = !inv->isReachable(); root[i][F("reachable")] = inv->isReachable();
root[i][F("producing")] = inv->isProducing();
// Loop all channels // Loop all channels
for (uint8_t c = 0; c <= inv->Statistics()->getChannelCount(); c++) { for (uint8_t c = 0; c <= inv->Statistics()->getChannelCount(); c++) {

View File

@ -19,6 +19,9 @@
:id="'v-pills-' + inverter.serial + '-tab'" data-bs-toggle="pill" :id="'v-pills-' + inverter.serial + '-tab'" data-bs-toggle="pill"
:data-bs-target="'#v-pills-' + inverter.serial" type="button" role="tab" :data-bs-target="'#v-pills-' + inverter.serial" type="button" role="tab"
aria-controls="'v-pills-' + inverter.serial" aria-selected="true"> aria-controls="'v-pills-' + inverter.serial" aria-selected="true">
<BIconXCircleFill class="fs-4" v-if="!inverter.reachable" />
<BIconExclamationCircleFill class="fs-4" v-if="inverter.reachable && !inverter.producing" />
<BIconCheckCircleFill class="fs-4" v-if="inverter.reachable && inverter.producing" />
{{ inverter.name }} {{ inverter.name }}
</button> </button>
</div> </div>
@ -31,8 +34,9 @@
<div class="card"> <div class="card">
<div class="card-header text-white bg-primary d-flex justify-content-between align-items-center" <div class="card-header text-white bg-primary d-flex justify-content-between align-items-center"
:class="{ :class="{
'bg-danger': inverter.reachable, 'bg-danger': !inverter.reachable,
'bg-primary': !inverter.reachable, 'bg-warning': inverter.reachable && !inverter.producing,
'bg-primary': inverter.reachable && inverter.producing,
}"> }">
{{ inverter.name }} (Inverter Serial Number: {{ inverter.name }} (Inverter Serial Number:
{{ inverter.serial }}) (Data Age: {{ inverter.serial }}) (Data Age:
@ -241,6 +245,7 @@ declare interface Inverter {
serial: number, serial: number,
name: string, name: string,
reachable: boolean, reachable: boolean,
producing: boolean,
data_age: 0, data_age: 0,
events: 0 events: 0
} }