debug: surplus_w in API + Live-Tab anzeigen

This commit is contained in:
retr0
2026-05-04 11:31:06 +02:00
parent 06bc030b07
commit 58a33f966d
2 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -522,7 +522,8 @@ def api_get_surplus_devices():
devices = State.surplus_devices_cfg
z2m_base = State.z2m_base
states = _surplus_ctrl.get_states() if _surplus_ctrl else {}
return jsonify({"devices": devices, "z2m_base": z2m_base, "states": states})
surplus_w = _get_pv_surplus()
return jsonify({"devices": devices, "z2m_base": z2m_base, "states": states, "surplus_w": surplus_w})
@app.post("/api/surplus-devices")
def api_save_surplus_devices():
+5
View File
@@ -1079,10 +1079,15 @@ function renderSurplusStatus(surplusData) {
</div>`;
}).join('');
if (!rows) return '';
const surplusW = surplusData.surplus_w ?? null;
const surplusInfo = surplusW !== null
? `<span style="font-size:11px;color:var(--text-dim);margin-left:auto">${surplusW >= 0 ? '+' : ''}${Math.round(surplusW)} W Überschuss</span>`
: '';
return `<div class="inv-section">
<div class="inv-header">
<div class="inv-title">Überschuss-Geräte</div>
<div class="inv-badge ok">Z2M</div>
${surplusInfo}
</div>
<div style="padding:0 2px">${rows}</div>
</div>`;