From cb5f23d4862b997fc6836c6afe8a23f3a558e0d6 Mon Sep 17 00:00:00 2001 From: retr0 <42kdesigners@gmail.com> Date: Wed, 6 May 2026 08:18:17 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Finanzen-Tab=20bleibt=20bei=20'Lade...'?= =?UTF-8?q?=20h=C3=A4ngen=20(v1.8.21)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fEur/fKwh waren lokale Funktionen in renderEnergy() — loadFinance() konnte sie nicht aufrufen (ReferenceError außerhalb des Scopes). Beide Funktionen in den globalen Scope verschoben, lokale Kopien entfernt. loadFinance() Rendering-Block in try/catch gewrappt. Co-Authored-By: Claude Sonnet 4.6 --- ROADMAP.md | 2 ++ haos-addon/config.yaml | 2 +- haos-addon/src/web/index.html | 20 +++++++++++--------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index fd1689d..531a54b 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -94,3 +94,5 @@ | v1.8.17 | 2026-05-04 | Fix: Atomarer Config-Write + Backup-Fallback | | v1.8.18 | 2026-05-05 | Feature: Flash-Wizard, Setup-Wizard, NuttX OTA, MQTT rc=5, Port-Sicherheit | | v1.8.19 | 2026-05-05 | Fix: Mobile-Layout — Tabs scrollen, kein horizontaler Overflow | +| v1.8.20 | 2026-05-05 | Fix: Eigenversorgungskarte bei PV offline, Stromtarif-Einstellungen gehen nicht verloren | +| v1.8.21 | 2026-05-05 | Fix: Finanzen-Tab bleibt nicht bei "Lade..." hängen (fEur/fKwh Scope-Bug) | diff --git a/haos-addon/config.yaml b/haos-addon/config.yaml index f890ec6..642fba1 100644 --- a/haos-addon/config.yaml +++ b/haos-addon/config.yaml @@ -1,5 +1,5 @@ name: ShineBridge -version: "1.8.20" +version: "1.8.21" slug: shinebridge description: Growatt Wechselrichter lokal in Home Assistant — Modbus TCP via ShineLAN-X, MQTT Discovery, Web UI url: https://gitea.bitfire.work/retr0/shinebridge diff --git a/haos-addon/src/web/index.html b/haos-addon/src/web/index.html index 4eb41b3..099c76c 100644 --- a/haos-addon/src/web/index.html +++ b/haos-addon/src/web/index.html @@ -713,6 +713,15 @@ function renderSpotChart(spotData) { `; } +function fEur(v) { + if (v == null) return null; + return v >= 100 ? v.toFixed(0) + ' €' : v.toFixed(2) + ' €'; +} +function fKwh(v) { + if (v == null) return null; + return (v >= 100 ? v.toFixed(0) : v.toFixed(1)) + ' kWh'; +} + function renderEnergy(inverters, aggregates, period, spotData) { const el = document.getElementById("energy-content"); if (!aggregates || !Object.keys(aggregates).length) { @@ -848,15 +857,6 @@ function renderEnergy(inverters, aggregates, period, spotData) { const pi = period.price_import || 0.30; const pe = period.price_export || 0.08; - function fEur(v) { - if (v == null) return null; - return v >= 100 ? v.toFixed(0) + ' €' : v.toFixed(2) + ' €'; - } - function fKwh(v) { - if (v == null) return null; - return (v >= 100 ? v.toFixed(0) : v.toFixed(1)) + ' kWh'; - } - function periodCard(label, kwh, cost, col, sub) { if (kwh == null) return ''; return `
@@ -937,6 +937,7 @@ async function loadFinance() { try { data = await fetchJSON(api("api/finance")); } catch(e) { el.innerHTML = '
Fehler beim Laden
'; return; } + try { const { days, fixed_total_eur, spot_total_eur, savings_eur, period_start, spot_days, total_days } = data; if (!days || days.length === 0) { @@ -1033,6 +1034,7 @@ async function loadFinance() {
`; el.innerHTML = empfehlung + cards + chart; + } catch(e) { el.innerHTML = '
Fehler beim Laden
'; console.error('loadFinance:', e); } } // ── Live Data ─────────────────────────────────────────────────