Compare commits

...
1 Commits
Author SHA1 Message Date
retr0andClaude Sonnet 5 cd5f8cb7af ShineBridge v1.12.3 — Fix: NameError SUN_THRESHOLD in /api/weather-forecast
SUN_THRESHOLD war nur lokal in adjusted_timeout_h() definiert, summary()
(genutzt vom Settings-Preview UND vom neuen Dashboard-Diagramm) griff aber
auch drauf zu -> 500-Fehler bei jedem Aufruf, Diagramm blieb leer. Als
Modul-Konstante hochgezogen.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-27 13:35:43 +02:00
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: ShineBridge
version: "1.12.2"
version: "1.12.3"
slug: shinebridge
description: Energiemanagement für Growatt/Goodwe-Wechselrichter — PV-Überschussladen, Wallbox-EMS, Tarifvergleich, Zigbee2MQTT-Überschussgeräte
url: https://gitea.bitfire.work/retr0/shinebridge
+2 -2
View File
@@ -17,6 +17,8 @@ log = logging.getLogger(__name__)
_CACHE_TTL_S = 3 * 3600 # Prognose alle 3h neu holen, nicht bei jedem Poll
_cache: dict = {} # key: (lat, lon) -> {"ts": float, "hourly": [(epoch_s, ghi_w_m2), ...]}
SUN_THRESHOLD = 80.0 # W/m² — deutlich mehr als Daemmerung, aber kein voller Sonnentag noetig
def _fetch(lat: float, lon: float) -> Optional[List[Tuple[int, float]]]:
url = (
@@ -74,8 +76,6 @@ def adjusted_timeout_h(base_timeout_h: float, lat: Optional[float], lon: Optiona
# kommende Vormittagssonne ab, falls schon frueh am Morgen geprueft wird)
horizon = [ghi for ts, ghi in hourly if now <= ts < now + 12 * 3600]
SUN_THRESHOLD = 80.0 # W/m² — deutlich mehr als Daemmerung, aber kein voller Sonnentag noetig
if near and max(near) >= SUN_THRESHOLD:
# Bald noch nennenswerte Sonne zu erwarten -> mehr Geduld, gedeckelt
return min(base_timeout_h * 1.75, base_timeout_h + 4.0)