Skip to content

Commit 894edf7

Browse files
committed
fix: show working-mode label instead of raw state number
The inverter section showed a bare state number (e.g. "20") that meant nothing. The frontend had a stale hardcoded STATE_MAP that didn't even match the real LuxPower/EG4 working-mode codes. - Remove the wrong hardcoded STATE_MAP (mapped 0:Standby, 1:Self-test, etc. — completely different from the actual protocol). - Use the API's state_label (already computed via _state_label from the protocol doc) in both the summary card and the detail view. - state_label shows the meaning plus the raw code for reference, e.g. "PV + battery on-grid (20)".
1 parent 732bae7 commit 894edf7

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎api/static/index.html‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,13 @@ <h3>Timer Schedule</h3>
515515
if (el && text !== null && text !== undefined) el.textContent = text;
516516
}
517517

518-
const STATE_MAP = {0:'Standby',1:'Self-test',2:'Normal',3:'Alarm',4:'Fault',5:'Bypass',6:'Battery',7:'ECO',8:'Shutdown'};
519-
520518
function renderMain(r) {
521519
liveData = r;
522520
setText('last-updated', 'Updated ' + fmtTime(r.timestamp));
523521

524522
const state = val(r,'state',0);
525-
setText('sa-inv-state', STATE_MAP[state] || ('State '+state));
523+
const stateLabel = val(r,'state_label', null);
524+
setText('sa-inv-state', stateLabel || ('State '+state));
526525
const invTemp = val(r,'temp_inverter');
527526
setText('sa-inv-temp', invTemp !== undefined ? fmt(invTemp) + ' °C' : null);
528527

@@ -631,7 +630,7 @@ <h3>Timer Schedule</h3>
631630
${prop('Total Power','eps_power',{suffix:' W', int:1})}
632631
${prop('Apparent Power','eps_apparent_power',{suffix:' VA', int:1})}
633632
${prop('Frequency','eps_frequency',{suffix:' Hz', digits:2})}
634-
${prop('State','state',{int:1})}
633+
${prop('State','state_label')}
635634
${prop('Fault Code','fault_code',{int:1})}
636635
${prop('Fault','fault_code_text')}
637636
${prop('Warning Code','warning_code',{int:1})}

0 commit comments

Comments
 (0)