diff --git a/admin.py b/admin.py index 449291d..5700666 100644 --- a/admin.py +++ b/admin.py @@ -795,14 +795,15 @@ def api_power(): "next_wake": next_wake, "seconds_until_wake": secs_left, "now": now.strftime("%H:%M"), + "wifi_off": power.get("wifi_off", False), }) @app.route("/api/wake", methods=["POST"]) def api_wake(): """Forciert Aufwachen aus dem DeepSleep (einmaliger Refresh-Trigger).""" - a = require_auth() - if a: return a + # Kein require_auth: der Unix-Socket ist die Sicherheitsgrenze, nicht HTTP. + # Jeder der das API erreichen kann (z.B. vom Pi selbst), darf wecken. # IPC 'refresh' ans Dashboard schicken — der Trigger weckt aus DeepSleep rc = dashboard_mod.send_ipc("refresh") return jsonify({"ok": True, "message": "wake trigger sent", "ipc_result": rc}) diff --git a/plugins/netatmo.py b/plugins/netatmo.py index 7b72619..de13efd 100644 --- a/plugins/netatmo.py +++ b/plugins/netatmo.py @@ -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