FIX-DEEPSLEEP: wifi_off in api_power + wake ohne auth + forecast-validierung
- admin.py: wifi_off field in /api/power Response ergaenzt (wurde gespeichert aber nie zurueckgegeben, JS konnte Toggle-Status nie lesen) - admin.py: /api/wake braucht kein HTTP-Basic-Auth mehr Unix-Socket ist die Sicherheitsgrenze, nicht HTTP-Auth - plugins/netatmo.py: _get_forecast() validiert Response: gibt None zurueck wenn daily.time leer/antwortpendig ist verhindert leere Forecast-Sektion auf dem Display
This commit is contained in:
+8
-1
@@ -121,7 +121,14 @@ def _get_forecast(lat: float, lon: float, days: int = 3) -> dict | None:
|
||||
f"weather_code&forecast_days={min(days, 7)}&timezone=auto")
|
||||
req = urllib.request.Request(url, headers={"Accept": "application/json"})
|
||||
with urllib.request.urlopen(req, timeout=8) as r:
|
||||
return json.loads(r.read())
|
||||
data = json.loads(r.read())
|
||||
# Nur gueltige Antwort mit daily.time zurueckgeben
|
||||
if not isinstance(data, dict) or "daily" not in data:
|
||||
return None
|
||||
daily = data.get("daily", {})
|
||||
if not isinstance(daily, dict) or not daily.get("time"):
|
||||
return None
|
||||
return data
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user