Skip to content

Commit 56ecd5d

Browse files
committed
fix: show clean state label without code suffix
The state showed "Battery on-grid (16)" — the (16) suffix is noise. Drop the code from _state_label output and remove the "State 16" fallback in the frontend so the label is always the clean human-readable name. - _state_label now returns just the label (e.g. "Battery On-grid"), with "Unknown (code)" only for genuinely unmapped values. - renderMain no longer falls back to "State N"; if state_label is missing it shows the raw number only.
1 parent c8512bb commit 56ecd5d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎api/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _state_label(value) -> str:
119119
label = _STATE_LABELS.get(code)
120120
if label is None:
121121
return f"Unknown ({code})"
122-
return f"{label} ({code})"
122+
return label
123123

124124

125125
def _fault_label(value) -> str:

‎api/static/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ <h3>Timer Schedule</h3>
521521

522522
const state = val(r,'state',0);
523523
const stateLabel = val(r,'state_label', null);
524-
setText('sa-inv-state', stateLabel || ('State '+state));
524+
setText('sa-inv-state', stateLabel !== null && stateLabel !== undefined ? stateLabel : state);
525525
const invTemp = val(r,'temp_inverter');
526526
setText('sa-inv-temp', invTemp !== undefined ? fmt(invTemp) + ' °C' : null);
527527

0 commit comments

Comments
 (0)