fix garage_decke MCP: Primär/Sekundär getrennt ausgeben

PWT-Grenze explizit; KD ohne Durchfluss/kW; verhindert Kreis-Vermischung.
This commit is contained in:
Homelab Cursor 2026-06-28 19:43:25 +02:00
parent edd794bb4f
commit 75efc18305

View file

@ -35,6 +35,12 @@ SENSORS = {
KD_FLUSSRICHTUNG = int(os.environ.get("KD_FLUSSRICHTUNG", "-1"))
BRUNNEN_LMIN = float(os.environ.get("BRUNNEN_DURCHFLUSS", "5.27"))
CIRCUIT_NOTE = (
"PWT trennt zwei Kreise hydraulisch. Primär-Durchfluss (Brunnen) ≠ Sekundär-Durchfluss (KD). "
"PWT-ΔT / PWT-Oberfläche = Wärmeübertragung am Tauscher — NICHT KD-Durchfluss "
"(Engpass: 6 Platten in Reihe, separat)."
)
def _query(q: str) -> dict:
last_err = None
@ -135,23 +141,33 @@ def tool_live(_args: dict) -> str:
"Garage Decke — Live (InfluxDB sensors, node=garage_decke)",
f"KD Flussrichtung: {KD_FLUSSRICHTUNG} | Brunnen angenommen: {BRUNNEN_LMIN} l/min",
"",
"Brunnenkreis (PWT):",
f"- VL Brunnen: {vals.get('vl_brunnen', 0):.1f} °C",
f"- RL Brunnen: {vals.get('rl_brunnen', 0):.1f} °C",
CIRCUIT_NOTE,
"",
"══ Primärkreis (Brunnen → PWT-Primärseite) ══",
f"- VL Brunnen (vor PWT): {vals.get('vl_brunnen', 0):.1f} °C",
f"- RL Brunnen (nach PWT): {vals.get('rl_brunnen', 0):.1f} °C",
f"- ΔT Brunnen: {calc['dt_brunnen']:.2f} K" if calc["dt_brunnen"] is not None else "- ΔT Brunnen: n/a",
f"- PWT-Oberfläche: {vals.get('pwt', 0):.1f} °C",
f"- Durchfluss (Annahme/Wasseruhr): {BRUNNEN_LMIN} l/min",
]
if calc["power_brunnen_w"] is not None:
lines.append(f"- Leistung Brunnen: {calc['power_brunnen_w']:.0f} W")
lines.append(f"- Leistung Brunnen: {calc['power_brunnen_w']:.0f} W (nur Primärkreis!)")
pwt = vals.get("pwt")
if pwt is not None:
lines += [
f"- PWT-Oberfläche: {pwt:.1f} °C (Indikator Wärmeübertragung, kein KD-Durchfluss)",
]
lines += [
"",
"Kältedecke (hydraulisch, per kd_flussrichtung):",
f"- VL KD: {calc['kd_vl_hyd']:.1f} °C" if calc["kd_vl_hyd"] is not None else "- VL KD: n/a",
f"- RL KD: {calc['kd_rl_hyd']:.1f} °C" if calc["kd_rl_hyd"] is not None else "- RL KD: n/a",
"══ Sekundärkreis (PWT-Sekundärseite → 6× Platten Reihe) ══",
f"- VL KD (hydraulisch): {calc['kd_vl_hyd']:.1f} °C" if calc["kd_vl_hyd"] is not None else "- VL KD (hydraulisch): n/a",
f"- RL KD (hydraulisch): {calc['kd_rl_hyd']:.1f} °C" if calc["kd_rl_hyd"] is not None else "- RL KD (hydraulisch): n/a",
f"- ΔT KD: {calc['dt_kd']:.2f} K" if calc["dt_kd"] is not None else "- ΔT KD: n/a",
"- Durchfluss KD: nicht gemessen",
"- Leistung KD: nicht berechenbar (ohne l/min im Sekundärkreis)",
"",
"Rohr-Fühler (Influx-Raw):",
"Rohr-Fühler (Influx-Raw, nicht direkt als VL/RL KD lesen):",
f"- rl_klimadecke: {vals.get('rl_klimadecke', 0):.1f} °C",
f"- vl_kaeltedecke: {vals.get('vl_kaeltedecke', 0):.1f} °C",
]
@ -197,19 +213,23 @@ def tool_compare(args: dict) -> str:
lines = [
f"Garage Decke — Vergleich jetzt vs. vor ~{hours:.0f} h",
"",
"Brunnen:",
CIRCUIT_NOTE,
"",
"Primärkreis (Brunnen):",
_delta("ΔT Brunnen", c_now["dt_brunnen"], c_past["dt_brunnen"]),
]
if c_now["power_brunnen_w"] is not None and c_past["power_brunnen_w"] is not None:
d = c_now["power_brunnen_w"] - c_past["power_brunnen_w"]
lines.append(
_delta("Leistung Brunnen", c_now["power_brunnen_w"], c_past["power_brunnen_w"], " W").replace("K", "W")
f"- Leistung Brunnen: jetzt {c_now['power_brunnen_w']:.0f} W, "
f"vor {hours:.0f}h {c_past['power_brunnen_w']:.0f} W (Δ {d:+.0f} W)"
)
lines += [
"",
"Kältedecke:",
"Sekundärkreis (KD — nur ΔT, kein Durchfluss):",
_delta("ΔT KD", c_now["dt_kd"], c_past["dt_kd"]),
"",
"Einzelwerte jetzt:",
"Einzelwerte jetzt (Primär):",
f"- vl_brunnen {now.get('vl_brunnen', 0):.1f} °C, rl_brunnen {now.get('rl_brunnen', 0):.1f} °C",
f"- pwt {now.get('pwt', 0):.1f} °C",
]
@ -220,9 +240,9 @@ TOOLS = [
{
"name": "garage_decke_live",
"description": (
"Aktuelle Garage-Decke/Brunnen-Sensoren aus InfluxDB (node=garage_decke): "
"vl/rl_brunnen, PWT, Kältedecke VL/RL, ΔT, Leistung Brunnen. "
"IMMER dieses Tool nutzen — nicht curl/raten."
"Garage-Decke Live: zwei getrennte Kreise (Primär Brunnen mit l/min/kW, "
"Sekundär KD nur ΔT ohne Durchfluss). PWT trennt hydraulisch — "
"IMMER dieses Tool, nicht curl/raten."
),
"inputSchema": {"type": "object", "properties": {}, "required": []},
},