Einige kleine verbesserungen #1

Open
Scarriffle wants to merge 115 commits from beta into master
Showing only changes of commit f970276b91 - Show all commits

View File

@@ -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"] e = data["end"].replace("Z", "+00:00") if data["end"].endswith("Z") else data["end"]
body["start_date_time"] = s body["start_date_time"] = s
body["end_date_time"] = e body["end_date_time"] = e
logger.info("HA update_event body: %s", body)
resp = http_requests.post( resp = http_requests.post(
f"{base}/api/services/calendar/update_event", f"{base}/api/services/calendar/update_event",
headers=headers, json=body, timeout=15, verify=False, headers=headers, json=body, timeout=15, verify=False,
) )
if not resp.ok: if not resp.ok:
try:
detail = resp.json().get("message", resp.text[:500])
except Exception:
detail = resp.text[:500] if resp.text else f"HTTP {resp.status_code}" detail = resp.text[:500] if resp.text else f"HTTP {resp.status_code}"
raise Exception(f"HA update_event: {resp.status_code} {detail}") raise Exception(f"HA update_event ({resp.status_code}): {detail}")
return resp return resp