From 9ae247c7c56e1cb04881bbf1015839ba331e9bfb Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Wed, 29 Apr 2026 18:52:32 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20HA=20update=5Fevent=20=E2=80=93=20besser?= =?UTF-8?q?e=20Fehlermeldung=20mit=20JSON-Response-Details=20Liest=20messa?= =?UTF-8?q?ge-Feld=20aus=20HA=20JSON-Response=20und=20loggt=20den=20Reques?= =?UTF-8?q?t-Body=20f=C3=BCr=20Debugging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/routers/homeassistant_router.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/routers/homeassistant_router.py b/backend/routers/homeassistant_router.py index b697add..76d4bb9 100644 --- a/backend/routers/homeassistant_router.py +++ b/backend/routers/homeassistant_router.py @@ -129,13 +129,17 @@ def _ha_update_event(url: str, token: str, entity_id: str, uid: str, data: dict) e = data["end"].replace("Z", "+00:00") if data["end"].endswith("Z") else data["end"] body["start_date_time"] = s body["end_date_time"] = e + logger.info("HA update_event body: %s", body) resp = http_requests.post( f"{base}/api/services/calendar/update_event", headers=headers, json=body, timeout=15, verify=False, ) if not resp.ok: - detail = resp.text[:500] if resp.text else f"HTTP {resp.status_code}" - raise Exception(f"HA update_event: {resp.status_code} — {detail}") + try: + detail = resp.json().get("message", resp.text[:500]) + except Exception: + detail = resp.text[:500] if resp.text else f"HTTP {resp.status_code}" + raise Exception(f"HA update_event ({resp.status_code}): {detail}") return resp