diff --git a/haos-addon/config.yaml b/haos-addon/config.yaml index ed25b74..266bf1d 100644 --- a/haos-addon/config.yaml +++ b/haos-addon/config.yaml @@ -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 diff --git a/haos-addon/src/weather_forecast.py b/haos-addon/src/weather_forecast.py index dbe268c..fa78483 100644 --- a/haos-addon/src/weather_forecast.py +++ b/haos-addon/src/weather_forecast.py @@ -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)