Show custom string name in Live View

This commit is contained in:
Thomas Basler 2022-11-15 21:52:10 +01:00
parent 134db887c0
commit fec84fd048
3 changed files with 12 additions and 2 deletions

View File

@ -102,6 +102,12 @@ void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root)
// Loop all channels
for (uint8_t c = 0; c <= inv->Statistics()->getChannelCount(); c++) {
if (c > 0) {
INVERTER_CONFIG_T* inv_cfg = Configuration.getInverterConfig(inv->serial());
if (inv_cfg != nullptr) {
invObject[String(c)][F("name")]["u"] = inv_cfg->channel[c - 1].Name;
}
}
addField(invObject, i, inv, c, FLD_PAC);
addField(invObject, i, inv, c, FLD_UAC);
addField(invObject, i, inv, c, FLD_IAC);

View File

@ -1,6 +1,9 @@
<template>
<div class="card" :class="{ 'border-info': channelNumber == 0 }">
<div v-if="channelNumber >= 1" class="card-header">String {{ channelNumber }}</div>
<div v-if="channelNumber >= 1" class="card-header">
<template v-if="channelData.name.u != ''">{{ channelData.name.u }}</template>
<template v-else>String {{ channelNumber }}</template>
</div>
<div v-if="channelNumber == 0" class="card-header text-bg-info">Phase {{ channelNumber + 1 }}</div>
<div class="card-body">
<table class="table table-striped table-hover">
@ -13,7 +16,7 @@
</thead>
<tbody>
<tr v-for="(property, key) in channelData" :key="`prop-${key}`">
<template v-if="property">
<template v-if="key != 'name' && property">
<th scope="row">{{ key }}</th>
<td style="text-align: right">{{ formatNumber(property.v, property.d) }}</td>
<td>{{ property.u }}</td>

View File

@ -5,6 +5,7 @@ export interface ValueObject {
};
export interface InverterStatistics {
name: ValueObject,
Power?: ValueObject;
Voltage?: ValueObject;
Current?: ValueObject;