Everything the register map carries, sorted the way it gets asked about
The Modbus snapshot reported about half of what one poll already brings back. The rest was read into the block and thrown away: line-to-line voltages, reactive and apparent power per phase, the PWM flag, the control-pilot voltage, and the identity block's product number, rated power and current range. All of it now decodes — no extra requests, the registers were in hand already. Added alongside it: the control block, read back over FC03. It answers a question the live registers cannot, which is what the charger is *set* to as opposed to what it is doing — a boost that was asked for reads there while the live block still reports none running. Best effort, so a charger that refuses it still reports its state. Two registers the spec leaves blank are decoded on the hardware's evidence. The control-pilot voltage reads 11873 while the CP signal register reports state A, which that enum names as 12 V, so the register is millivolts. The identity block's current range is in amps, whatever its unit column says about watts and kVA. The charging card lays this out in sections rather than a wall of forty numbers: per-phase measurements as the matrix they are, then live state, then settings, then the device itself, with alarms surfacing only when a word is non-zero. Strings in en/da/pl. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
aaa89dfe10
commit
62cb691f98
@@ -106,6 +106,62 @@
|
||||
"boost": "Boost denne session",
|
||||
"modbusHint": "Indtast laderens adresse på dette netværk og gem den. Laderen skal være tændt og på samme netværk som DriverVault."
|
||||
},
|
||||
"modbus": {
|
||||
"phases": "Pr. fase",
|
||||
"live": "Live data",
|
||||
"settings": "Indstillinger",
|
||||
"device": "Enhed",
|
||||
"alarms": "Alarmer",
|
||||
"phase": "Fase",
|
||||
"voltage": "Spænding",
|
||||
"current": "Strøm",
|
||||
"activePower": "Aktiv",
|
||||
"reactivePower": "Reaktiv",
|
||||
"apparentPower": "Tilsyneladende",
|
||||
"lineToLine": "Mellem faser",
|
||||
"power": "Samlet effekt",
|
||||
"sessionDuration": "Sessionens længde",
|
||||
"cpSignal": "Control pilot",
|
||||
"cpVoltage": "Pilotspænding",
|
||||
"phaseMode": "Kører på",
|
||||
"relayTemps": "Relætemperaturer",
|
||||
"pwm": "PWM aktiv",
|
||||
"maxCurrentSet": "Strømgrænse",
|
||||
"timeout": "Styringstimeout",
|
||||
"phaseSetting": "Faseindstilling",
|
||||
"boostSet": "Boost anmodet",
|
||||
"lastCommand": "Seneste kommando",
|
||||
"chargingMode": "Opladningstilstand",
|
||||
"loadBalancing": "Lastbalancering",
|
||||
"solarBalancing": "Solbalancering",
|
||||
"ledBrightness": "LED-lysstyrke",
|
||||
"model": "Model",
|
||||
"serial": "Serienummer",
|
||||
"firmware": "Firmware",
|
||||
"hardware": "Hardware",
|
||||
"productNumber": "Produktnummer",
|
||||
"ratedPower": "Nominel effekt",
|
||||
"currentRange": "Strømområde",
|
||||
"ocppLink": "OCPP",
|
||||
"mqttLink": "MQTT",
|
||||
"alarmWord": "Ord {n}",
|
||||
"alarmsHint": "Laderen melder en alarm. Anker offentliggør ikke, hvad de enkelte bit betyder, så ordene vises, som de kommer.",
|
||||
"phaseMode1": "Enfaset",
|
||||
"phaseMode3": "Trefaset",
|
||||
"phaseSet0": "Automatisk",
|
||||
"phaseSet1": "Fast enfaset",
|
||||
"phaseSet2": "Fast trefaset",
|
||||
"chargingMode0": "Sol + net",
|
||||
"chargingMode1": "Kun sol",
|
||||
"command0": "Ingen",
|
||||
"command1": "Start",
|
||||
"command2": "Stop",
|
||||
"ocpp0": "Ikke forbundet",
|
||||
"ocpp1": "Forbinder",
|
||||
"ocpp2": "Forbundet",
|
||||
"mqtt0": "Ikke forbundet",
|
||||
"mqtt1": "Forbundet"
|
||||
},
|
||||
"info": {
|
||||
"title": "Laderoplysninger",
|
||||
"empty": "Intet importeret endnu — en lader, du importerer, viser alt, den melder, her.",
|
||||
|
||||
@@ -92,6 +92,62 @@
|
||||
"boost": "Boost this session",
|
||||
"modbusHint": "Enter the charger's address on this network and save it. The charger must be powered on and on the same network as DriverVault."
|
||||
},
|
||||
"modbus": {
|
||||
"phases": "Per phase",
|
||||
"live": "Live data",
|
||||
"settings": "Settings",
|
||||
"device": "Device",
|
||||
"alarms": "Alarms",
|
||||
"phase": "Phase",
|
||||
"voltage": "Voltage",
|
||||
"current": "Current",
|
||||
"activePower": "Active",
|
||||
"reactivePower": "Reactive",
|
||||
"apparentPower": "Apparent",
|
||||
"lineToLine": "Line to line",
|
||||
"power": "Total power",
|
||||
"sessionDuration": "Session length",
|
||||
"cpSignal": "Control pilot",
|
||||
"cpVoltage": "Pilot voltage",
|
||||
"phaseMode": "Running on",
|
||||
"relayTemps": "Relay temperatures",
|
||||
"pwm": "PWM active",
|
||||
"maxCurrentSet": "Current limit",
|
||||
"timeout": "Control timeout",
|
||||
"phaseSetting": "Phase setting",
|
||||
"boostSet": "Boost requested",
|
||||
"lastCommand": "Last command",
|
||||
"chargingMode": "Charging mode",
|
||||
"loadBalancing": "Load balancing",
|
||||
"solarBalancing": "Solar balancing",
|
||||
"ledBrightness": "LED brightness",
|
||||
"model": "Model",
|
||||
"serial": "Serial",
|
||||
"firmware": "Firmware",
|
||||
"hardware": "Hardware",
|
||||
"productNumber": "Product number",
|
||||
"ratedPower": "Rated power",
|
||||
"currentRange": "Current range",
|
||||
"ocppLink": "OCPP",
|
||||
"mqttLink": "MQTT",
|
||||
"alarmWord": "Word {n}",
|
||||
"alarmsHint": "The charger reports an alarm. Anker does not publish what the individual bits mean, so the words are shown as they arrive.",
|
||||
"phaseMode1": "Single-phase",
|
||||
"phaseMode3": "Three-phase",
|
||||
"phaseSet0": "Automatic",
|
||||
"phaseSet1": "Fixed single-phase",
|
||||
"phaseSet2": "Fixed three-phase",
|
||||
"chargingMode0": "Solar + grid",
|
||||
"chargingMode1": "Solar only",
|
||||
"command0": "None",
|
||||
"command1": "Start",
|
||||
"command2": "Stop",
|
||||
"ocpp0": "Not connected",
|
||||
"ocpp1": "Connecting",
|
||||
"ocpp2": "Connected",
|
||||
"mqtt0": "Not connected",
|
||||
"mqtt1": "Connected"
|
||||
},
|
||||
"info": {
|
||||
"title": "Charger information",
|
||||
"empty": "Nothing imported yet — a charger you import shows everything it reports here.",
|
||||
|
||||
@@ -108,6 +108,62 @@
|
||||
"boost": "Boost w tej sesji",
|
||||
"modbusHint": "Podaj adres ładowarki w tej sieci i zapisz go. Ładowarka musi być włączona i w tej samej sieci co DriverVault."
|
||||
},
|
||||
"modbus": {
|
||||
"phases": "Na fazę",
|
||||
"live": "Dane na żywo",
|
||||
"settings": "Ustawienia",
|
||||
"device": "Urządzenie",
|
||||
"alarms": "Alarmy",
|
||||
"phase": "Faza",
|
||||
"voltage": "Napięcie",
|
||||
"current": "Prąd",
|
||||
"activePower": "Czynna",
|
||||
"reactivePower": "Bierna",
|
||||
"apparentPower": "Pozorna",
|
||||
"lineToLine": "Międzyfazowe",
|
||||
"power": "Moc całkowita",
|
||||
"sessionDuration": "Czas sesji",
|
||||
"cpSignal": "Control pilot",
|
||||
"cpVoltage": "Napięcie pilota",
|
||||
"phaseMode": "Pracuje na",
|
||||
"relayTemps": "Temperatury przekaźników",
|
||||
"pwm": "PWM aktywny",
|
||||
"maxCurrentSet": "Limit prądu",
|
||||
"timeout": "Limit czasu sterowania",
|
||||
"phaseSetting": "Ustawienie faz",
|
||||
"boostSet": "Boost zażądany",
|
||||
"lastCommand": "Ostatnie polecenie",
|
||||
"chargingMode": "Tryb ładowania",
|
||||
"loadBalancing": "Balansowanie obciążenia",
|
||||
"solarBalancing": "Balansowanie solarne",
|
||||
"ledBrightness": "Jasność LED",
|
||||
"model": "Model",
|
||||
"serial": "Numer seryjny",
|
||||
"firmware": "Firmware",
|
||||
"hardware": "Hardware",
|
||||
"productNumber": "Numer produktu",
|
||||
"ratedPower": "Moc znamionowa",
|
||||
"currentRange": "Zakres prądu",
|
||||
"ocppLink": "OCPP",
|
||||
"mqttLink": "MQTT",
|
||||
"alarmWord": "Słowo {n}",
|
||||
"alarmsHint": "Ładowarka zgłasza alarm. Anker nie publikuje znaczenia poszczególnych bitów, więc słowa pokazane są tak, jak przychodzą.",
|
||||
"phaseMode1": "Jednofazowo",
|
||||
"phaseMode3": "Trójfazowo",
|
||||
"phaseSet0": "Automatycznie",
|
||||
"phaseSet1": "Na stałe jednofazowo",
|
||||
"phaseSet2": "Na stałe trójfazowo",
|
||||
"chargingMode0": "Słońce + sieć",
|
||||
"chargingMode1": "Tylko słońce",
|
||||
"command0": "Brak",
|
||||
"command1": "Start",
|
||||
"command2": "Stop",
|
||||
"ocpp0": "Nierozłączona",
|
||||
"ocpp1": "Łączenie",
|
||||
"ocpp2": "Połączona",
|
||||
"mqtt0": "Nierozłączona",
|
||||
"mqtt1": "Połączona"
|
||||
},
|
||||
"info": {
|
||||
"title": "Informacje o ładowarce",
|
||||
"empty": "Nic jeszcze nie zaimportowano — zaimportowana ładowarka pokaże tutaj wszystko, co zgłasza.",
|
||||
|
||||
@@ -86,6 +86,127 @@ const ctlStatusLabel = computed(() => {
|
||||
return (ctlIsModbus.value ? s.statusDesc : s.connectorStatus) || "—";
|
||||
});
|
||||
|
||||
// --- The Modbus snapshot, grouped for reading ---
|
||||
//
|
||||
// The local path reports far more than the OCPP one: one poll carries metering,
|
||||
// the control settings and the charger's identity. Shown as a flat list that is
|
||||
// a wall of forty numbers, so it is sorted the way it gets asked about — what
|
||||
// the charger is doing, what it is set to, and what it is.
|
||||
const mb = computed(() => (ctlIsModbus.value && ctl.value?.status) || {});
|
||||
|
||||
const isSet = (v) => v !== undefined && v !== null;
|
||||
const unit = (v, digits, u) => (isSet(v) ? `${Number(v).toFixed(digits)} ${u}` : null);
|
||||
const yesNo = (v) => (isSet(v) ? (v ? t("common.yes") : t("common.no")) : null);
|
||||
const label = (key) => t(`charging.modbus.${key}`);
|
||||
|
||||
// An enum the charger reports as a number, named through the catalogue so it
|
||||
// translates; an unlisted value falls back to the number rather than a blank.
|
||||
const enumLabel = (prefix, v) => {
|
||||
if (!isSet(v)) return null;
|
||||
const key = `charging.modbus.${prefix}${v}`;
|
||||
const text = t(key);
|
||||
return text === key ? String(v) : text;
|
||||
};
|
||||
|
||||
function sessionLength(sec) {
|
||||
if (!isSet(sec)) return null;
|
||||
const h = Math.floor(sec / 3600);
|
||||
const m = Math.floor((sec % 3600) / 60);
|
||||
return h > 0 ? `${h} h ${m} min` : `${m} min`;
|
||||
}
|
||||
|
||||
// Pairs with no value drop out: a charger on older firmware, or one that refused
|
||||
// the control block, should show a shorter list rather than a column of dashes.
|
||||
const rows = (pairs) =>
|
||||
pairs.filter(([, v]) => isSet(v) && v !== "").map(([k, v]) => ({ label: label(k), value: v }));
|
||||
|
||||
const modbusLive = computed(() => {
|
||||
const s = mb.value;
|
||||
return rows([
|
||||
["power", unit(s.powerTotal, 0, "W")],
|
||||
["sessionDuration", sessionLength(s.sessionSeconds)],
|
||||
["cpSignal", s.cpSignalDesc],
|
||||
["cpVoltage", unit(s.cpVoltage, 2, "V")],
|
||||
["phaseMode", enumLabel("phaseMode", s.phaseMode)],
|
||||
["relayTemps",
|
||||
isSet(s.relay1TempC) && isSet(s.relay2TempC)
|
||||
? `${s.relay1TempC.toFixed(1)} / ${s.relay2TempC.toFixed(1)} °C`
|
||||
: unit(s.relay1TempC, 1, "°C")],
|
||||
["pwm", yesNo(s.pwmEnabled)],
|
||||
]);
|
||||
});
|
||||
|
||||
const modbusSettings = computed(() => {
|
||||
const s = mb.value;
|
||||
const set = s.settings || {};
|
||||
return rows([
|
||||
["maxCurrentSet", unit(set.maxCurrentA, 1, "A")],
|
||||
["timeout", isSet(set.timeoutSeconds) ? `${set.timeoutSeconds} s` : null],
|
||||
["phaseSetting", enumLabel("phaseSet", set.phaseSetting)],
|
||||
["boostSet", yesNo(set.boost)],
|
||||
["lastCommand", enumLabel("command", set.lastCommand)],
|
||||
["chargingMode", enumLabel("chargingMode", s.chargingMode)],
|
||||
["loadBalancing", yesNo(s.loadBalancing)],
|
||||
["solarBalancing", yesNo(s.solarBalancing)],
|
||||
["ledBrightness", isSet(s.ledBrightness) ? `${s.ledBrightness} %` : null],
|
||||
]);
|
||||
});
|
||||
|
||||
const modbusDevice = computed(() => {
|
||||
const s = mb.value;
|
||||
return rows([
|
||||
["model", s.model],
|
||||
["serial", s.serial],
|
||||
["firmware", s.firmware],
|
||||
["hardware", s.hardware],
|
||||
["productNumber", isSet(s.productNumber) ? String(s.productNumber) : null],
|
||||
["ratedPower", unit(s.ratedPowerW, 0, "W")],
|
||||
["currentRange",
|
||||
isSet(s.minCurrentA) && isSet(s.maxCurrentA) ? `${s.minCurrentA}–${s.maxCurrentA} A` : null],
|
||||
["ocppLink", enumLabel("ocpp", s.ocppStatus)],
|
||||
["mqttLink", enumLabel("mqtt", s.mqttStatus)],
|
||||
]);
|
||||
});
|
||||
|
||||
// The per-phase readings are a matrix, not a list: three phases against five
|
||||
// measurements. A table says that; twenty labelled pairs hide it.
|
||||
const modbusPhases = computed(() => {
|
||||
const s = mb.value;
|
||||
const cell = (v, digits, u) => (isSet(v) ? `${Number(v).toFixed(digits)} ${u}` : "—");
|
||||
const any = ["voltageL1", "currentL1", "powerL1"].some((k) => isSet(s[k]));
|
||||
if (!any) return [];
|
||||
return [1, 2, 3].map((n) => ({
|
||||
phase: `L${n}`,
|
||||
volts: cell(s[`voltageL${n}`], 1, "V"),
|
||||
amps: cell(s[`currentL${n}`], 2, "A"),
|
||||
watts: cell(s[`powerL${n}`], 0, "W"),
|
||||
reactive: cell(s[`reactiveL${n}`], 0, "var"),
|
||||
apparent: cell(s[`apparentL${n}`], 0, "VA"),
|
||||
}));
|
||||
});
|
||||
|
||||
// Line-to-line voltages only mean anything on a three-phase supply, so they are
|
||||
// shown when the charger reports one rather than as three more zeroes.
|
||||
const modbusLineVoltages = computed(() => {
|
||||
const s = mb.value;
|
||||
const pairs = [
|
||||
["L1–L2", s.voltageL1L2],
|
||||
["L2–L3", s.voltageL2L3],
|
||||
["L3–L1", s.voltageL3L1],
|
||||
].filter(([, v]) => isSet(v) && v > 10);
|
||||
return pairs.map(([name, v]) => `${name} ${v.toFixed(1)} V`);
|
||||
});
|
||||
|
||||
// The spec defers the alarm bits to a list it does not publish, so the words are
|
||||
// shown as they arrive: which one is set is still the thing to report.
|
||||
const modbusAlarms = computed(() => {
|
||||
const s = mb.value;
|
||||
if (!s.alarm || !Array.isArray(s.alarms)) return [];
|
||||
return s.alarms
|
||||
.map((w, i) => ({ n: i + 1, hex: "0x" + w.toString(16).toUpperCase().padStart(4, "0"), set: w !== 0 }))
|
||||
.filter((w) => w.set);
|
||||
});
|
||||
|
||||
async function loadCtlMode() {
|
||||
try {
|
||||
const v = await api.getAnkerSolix();
|
||||
@@ -734,6 +855,84 @@ onMounted(async () => {
|
||||
{{ t("charging.control.boost") }}
|
||||
</button>
|
||||
|
||||
<!-- Everything else the register map carries. One poll brings back
|
||||
metering, the control settings and the charger's identity, so
|
||||
they are grouped rather than listed: doing, set to, is. -->
|
||||
<div v-if="ctlIsModbus" class="mt-4 flex flex-col gap-2">
|
||||
<section v-if="modbusPhases.length" class="rounded-control bg-sunken p-3">
|
||||
<h4 class="eyebrow">{{ t("charging.modbus.phases") }}</h4>
|
||||
<div class="mt-2 overflow-x-auto">
|
||||
<table class="w-full text-xs">
|
||||
<thead>
|
||||
<tr class="text-muted">
|
||||
<th class="py-1 text-left font-medium">{{ t("charging.modbus.phase") }}</th>
|
||||
<th class="py-1 text-right font-medium">{{ t("charging.modbus.voltage") }}</th>
|
||||
<th class="py-1 text-right font-medium">{{ t("charging.modbus.current") }}</th>
|
||||
<th class="py-1 text-right font-medium">{{ t("charging.modbus.activePower") }}</th>
|
||||
<th class="py-1 text-right font-medium">{{ t("charging.modbus.reactivePower") }}</th>
|
||||
<th class="py-1 text-right font-medium">{{ t("charging.modbus.apparentPower") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="data">
|
||||
<tr v-for="p in modbusPhases" :key="p.phase" class="border-t border-subtle">
|
||||
<td class="py-1 text-left text-muted">{{ p.phase }}</td>
|
||||
<td class="py-1 text-right text-strong">{{ p.volts }}</td>
|
||||
<td class="py-1 text-right text-strong">{{ p.amps }}</td>
|
||||
<td class="py-1 text-right text-strong">{{ p.watts }}</td>
|
||||
<td class="py-1 text-right text-strong">{{ p.reactive }}</td>
|
||||
<td class="py-1 text-right text-strong">{{ p.apparent }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p v-if="modbusLineVoltages.length" class="data mt-2 text-[11px] text-muted">
|
||||
{{ t("charging.modbus.lineToLine") }}: {{ modbusLineVoltages.join(" · ") }}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section v-if="modbusLive.length" class="rounded-control bg-sunken p-3">
|
||||
<h4 class="eyebrow">{{ t("charging.modbus.live") }}</h4>
|
||||
<dl class="mt-2 grid grid-cols-2 gap-x-3 gap-y-1">
|
||||
<template v-for="r in modbusLive" :key="r.label">
|
||||
<dt class="text-xs text-muted">{{ r.label }}</dt>
|
||||
<dd class="data text-right text-xs text-strong">{{ r.value }}</dd>
|
||||
</template>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section v-if="modbusSettings.length" class="rounded-control bg-sunken p-3">
|
||||
<h4 class="eyebrow">{{ t("charging.modbus.settings") }}</h4>
|
||||
<dl class="mt-2 grid grid-cols-2 gap-x-3 gap-y-1">
|
||||
<template v-for="r in modbusSettings" :key="r.label">
|
||||
<dt class="text-xs text-muted">{{ r.label }}</dt>
|
||||
<dd class="data text-right text-xs text-strong">{{ r.value }}</dd>
|
||||
</template>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section v-if="modbusDevice.length" class="rounded-control bg-sunken p-3">
|
||||
<h4 class="eyebrow">{{ t("charging.modbus.device") }}</h4>
|
||||
<dl class="mt-2 grid grid-cols-2 gap-x-3 gap-y-1">
|
||||
<template v-for="r in modbusDevice" :key="r.label">
|
||||
<dt class="text-xs text-muted">{{ r.label }}</dt>
|
||||
<dd class="data text-right text-xs text-strong">{{ r.value }}</dd>
|
||||
</template>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<!-- Alarms, when any word is non-zero. Which register is set is
|
||||
reportable even though the bit list is not published. -->
|
||||
<section v-if="modbusAlarms.length" class="rounded-control border border-warning/40 bg-warning-soft p-3">
|
||||
<h4 class="eyebrow" style="color: var(--warning-600)">{{ t("charging.modbus.alarms") }}</h4>
|
||||
<p class="data mt-2 text-xs text-strong">
|
||||
<span v-for="a in modbusAlarms" :key="a.n" class="mr-3 inline-block">
|
||||
{{ t("charging.modbus.alarmWord", { n: a.n }) }} {{ a.hex }}
|
||||
</span>
|
||||
</p>
|
||||
<p class="mt-1 text-[11px] text-muted">{{ t("charging.modbus.alarmsHint") }}</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Reset reboots the charger over OCPP; the register map has no
|
||||
equivalent, so the button is not offered on the local path. -->
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user