Fix CalDAV event parsing, remove solar/battery/netz from BMP, remove Gemeinsamer Mensa from blacklist
This commit is contained in:
@@ -21,7 +21,7 @@ options:
|
||||
title: "Küche Dashboard"
|
||||
subtitle: "Home Assistant Status"
|
||||
refresh_seconds: 300
|
||||
calendar_blacklist: "Gemeinsame Mittagspause,Gemeinsamer Mensa,Block ZDI Jour Fixe,Terminblock ZDI,Regelmäßiger Austausch SC Würzburg"
|
||||
calendar_blacklist: "Gemeinsame Mittagspause,Block ZDI Jour Fixe,Terminblock ZDI,Regelmäßiger Austausch SC Würzburg"
|
||||
message_history_hours: 168
|
||||
message_history_limit: 50
|
||||
messages_per_page: 5
|
||||
|
||||
+13
-12
@@ -21,6 +21,7 @@ import html
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from http import HTTPStatus
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from pathlib import Path
|
||||
@@ -477,14 +478,20 @@ def build_calendar_events(states: dict[str, dict[str, Any] | None], now: dt.date
|
||||
data = json.loads(resp.read().decode("utf-8"))
|
||||
events = data.get("service_response", {}).get(cal_id, {}).get("events", [])
|
||||
for ev in events:
|
||||
start_raw = ev.get("start", "?")
|
||||
if isinstance(start_raw, dict):
|
||||
start_raw = start_raw.get("dateTime", start_raw.get("date", "?"))
|
||||
end_raw = ev.get("end", "?")
|
||||
if isinstance(end_raw, dict):
|
||||
end_raw = end_raw.get("dateTime", end_raw.get("date", "?"))
|
||||
all_events.append({
|
||||
"summary": ev.get("summary", "?"),
|
||||
"start": ev.get("start", "?"),
|
||||
"end": ev.get("end", "?"),
|
||||
"start": start_raw,
|
||||
"end": end_raw,
|
||||
"source": "caldav",
|
||||
})
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as exc:
|
||||
print(f"calendar fetch error for {cal_id}: {exc}", file=sys.stderr)
|
||||
|
||||
if local_sensor_id:
|
||||
sensor_state = states.get("local_calendar_sensor")
|
||||
@@ -941,16 +948,10 @@ def render_status_image(feed: dict[str, Any]) -> Any:
|
||||
draw.text((24, y), f"Innen: {office['temperature_c']} C", font=body_font, fill=0)
|
||||
y += 32
|
||||
draw.text((24, y), f"Aussen: {office['outside_temp_c']} C", font=body_font, fill=0)
|
||||
y += 32
|
||||
draw.text((24, y), f"Solar: {office.get('solar_daily', 'unknown')} kWh", font=body_font, fill=0)
|
||||
y += 32
|
||||
draw.text((24, y), f"Batterie: {office.get('battery_soc', 'unknown')}%", font=body_font, fill=0)
|
||||
y += 32
|
||||
draw.text((24, y), f"Netz: {office.get('power_consumption', 'unknown')} kWh", font=body_font, fill=0)
|
||||
|
||||
draw.line((24, 330, DISPLAY_WIDTH - 24, 330), fill=0, width=2)
|
||||
draw.line((24, 260, DISPLAY_WIDTH - 24, 260), fill=0, width=2)
|
||||
events = feed.get("calendar_events", [])
|
||||
y = 350
|
||||
y = 284
|
||||
if not events:
|
||||
draw.text((24, y), "Keine Termine", font=body_font, fill=0)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user