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>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
name: ShineBridge
|
name: ShineBridge
|
||||||
version: "1.12.2"
|
version: "1.12.3"
|
||||||
slug: shinebridge
|
slug: shinebridge
|
||||||
description: Energiemanagement für Growatt/Goodwe-Wechselrichter — PV-Überschussladen, Wallbox-EMS, Tarifvergleich, Zigbee2MQTT-Überschussgeräte
|
description: Energiemanagement für Growatt/Goodwe-Wechselrichter — PV-Überschussladen, Wallbox-EMS, Tarifvergleich, Zigbee2MQTT-Überschussgeräte
|
||||||
url: https://gitea.bitfire.work/retr0/shinebridge
|
url: https://gitea.bitfire.work/retr0/shinebridge
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ log = logging.getLogger(__name__)
|
|||||||
_CACHE_TTL_S = 3 * 3600 # Prognose alle 3h neu holen, nicht bei jedem Poll
|
_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), ...]}
|
_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]]]:
|
def _fetch(lat: float, lon: float) -> Optional[List[Tuple[int, float]]]:
|
||||||
url = (
|
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)
|
# kommende Vormittagssonne ab, falls schon frueh am Morgen geprueft wird)
|
||||||
horizon = [ghi for ts, ghi in hourly if now <= ts < now + 12 * 3600]
|
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:
|
if near and max(near) >= SUN_THRESHOLD:
|
||||||
# Bald noch nennenswerte Sonne zu erwarten -> mehr Geduld, gedeckelt
|
# Bald noch nennenswerte Sonne zu erwarten -> mehr Geduld, gedeckelt
|
||||||
return min(base_timeout_h * 1.75, base_timeout_h + 4.0)
|
return min(base_timeout_h * 1.75, base_timeout_h + 4.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user