Rename age_critical to rechable in web api

Also use new method to determine whether the inverter is reachable
This commit is contained in:
Thomas Basler 2022-10-01 10:48:17 +02:00
parent 4fe2111173
commit 00b1ff84be
2 changed files with 4 additions and 4 deletions

View File

@ -85,7 +85,7 @@ 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("age_critical")] = ((millis() - inv->Statistics()->getLastUpdate()) / 1000) > Configuration.get().Dtu_PollInterval * 5; root[i][F("reachable")] = !inv->isReachable();
// 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

@ -31,8 +31,8 @@
<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.age_critical, 'bg-danger': inverter.reachable,
'bg-primary': !inverter.age_critical, 'bg-primary': !inverter.reachable,
}"> }">
{{ inverter.name }} (Inverter Serial Number: {{ inverter.name }} (Inverter Serial Number:
{{ inverter.serial }}) (Data Age: {{ inverter.serial }}) (Data Age:
@ -240,7 +240,7 @@ import BootstrapAlert from '@/components/partials/BootstrapAlert.vue';
declare interface Inverter { declare interface Inverter {
serial: number, serial: number,
name: string, name: string,
age_critical: boolean, reachable: boolean,
data_age: 0, data_age: 0,
events: 0 events: 0
} }