Files
adminandClaude Opus 5 a50905bb6c Heizstab kann ganz aus
Dritte Betriebsart neben Automatik und Fest: Aus schickt eine feste Leistung
von null (setMode=-1). In der Automatik liefe der Heizstab beim naechsten
Ueberschuss wieder an. Erkannt wird der Zustand daran, dass das Geraet
feste Betriebsart, aber keine Leistung meldet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 10:08:13 +02:00

118 lines
5.3 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Heizstab im Pufferspeicher.
*
* GET das Bedienfenster (Werte und Logik: js/solar/bedienfenster.js)
* POST setMode=0 Automatik: der SolarManager regelt nach Überschuss
* POST setMode=1..60 feste Leistung in 100 W (60 = 6,0 kW)
* POST setMode=-1 aus: feste Leistung von 0 W, der Heizstab bleibt kalt
*
* Seit September 2026 gilt jede Änderung sofort, ohne "Save changes". Die
* Antwort ist leer, wenn der Befehl beim Heizstab ankam, sonst steht dort
* eine Meldung für das Fenster.
*/
require_once("../helper.php");
$hostname = "192.168.179.169";
if (!checkLogin()) {
exit;
}
if (isset($_POST["setMode"]) || isset($_GET["setMode"])) {
// Der Wert kommt aus dem Fenster (POST) oder von Hand aus der Adresse
// (GET) - immer nur einer von beiden.
$stufe = intval($_POST["setMode"] ?? $_GET["setMode"] ?? 0);
if ($stufe >= 1 && $stufe <= 60) {
$pfad = "/set?mode=man&pwr=" . ($stufe * 100);
} elseif ($stufe === 0) {
$pfad = "/set?mode=eco&pwr=0";
} elseif ($stufe === -1) {
// Aus ist eine feste Leistung von null: in der Automatik wuerde der
// Heizstab beim naechsten Ueberschuss wieder anlaufen.
$pfad = "/set?mode=man&pwr=0";
} else {
echo "Unbekannte Leistungsstufe.";
exit;
}
$remote = @fsockopen("tcp://" . $hostname, 80, $errno, $errstr, 5);
if ($remote) {
fwrite($remote, "GET " . $pfad . " HTTP/1.1\r\nHost: " . $hostname . "\r\nConnection: close\r\n\r\n");
stream_set_timeout($remote, 5);
fread($remote, 1024);
fclose($remote);
} else {
echo "Der Heizstab ist nicht erreichbar.";
}
exit;
}
?>
<div class="lade heiz">
<div class="lade-links">
<div class="lade-status">
<div class="heiz-tank" aria-hidden="true">
<svg viewBox="0 0 80 120">
<defs><clipPath id="heiz-innen"><rect x="14" y="8" width="52" height="100" rx="20"/></clipPath></defs>
<g clip-path="url(#heiz-innen)">
<rect x="0" y="0" width="80" height="42" data-heiz="t0"/>
<rect x="0" y="42" width="80" height="34" data-heiz="t1"/>
<rect x="0" y="76" width="80" height="44" data-heiz="t2"/>
</g>
<rect x="14" y="8" width="52" height="100" rx="20" class="heiz-huelle"/>
<path d="M26 103l4-6 4 6 4-6 4 6 4-6 4 6 4-6" class="heiz-spirale" data-heiz="spirale"/>
<path d="M26 108v7M54 108v7" class="heiz-huelle"/>
<text x="40" y="30" data-heiz="tt0"></text>
<text x="40" y="63" data-heiz="tt1"></text>
<text x="40" y="90" data-heiz="tt2" class="klein"></text>
</svg>
</div>
<div class="lade-text">
<div class="lade-auto">Pufferspeicher <span data-heiz="pille" class="lade-pille"></span></div>
<div class="lade-gross" data-heiz="leistung"></div>
<div class="lade-zeile" data-heiz="temps"></div>
</div>
</div>
<div class="lade-erklaerung" data-heiz="erklaerung"></div>
</div>
<div class="lade-rechts">
<div class="lade-abschnitt">
<h3 id="heiz-modus">Wie heizen?</h3>
<div class="lade-modi" role="radiogroup" aria-labelledby="heiz-modus">
<button type="button" class="lade-modus" role="radio" aria-checked="false" data-heiz-modus="auto" style="--c:#f7c000">
<span class="lade-sym"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg></span>
<b>Automatik</b><span>heizt mit dem Überschuss der Anlage</span>
</button>
<button type="button" class="lade-modus" role="radio" aria-checked="false" data-heiz-modus="aus" style="--c:#9aa6ad">
<span class="lade-sym"><svg viewBox="0 0 24 24"><path d="M12 3v9"/><path d="M7.5 6.5a7 7 0 1 0 9 0"/></svg></span>
<b>Aus</b><span>bleibt kalt, auch bei Überschuss</span>
</button>
<button type="button" class="lade-modus" role="radio" aria-checked="false" data-heiz-modus="fest" style="--c:#e5624f">
<span class="lade-sym"><svg viewBox="0 0 24 24"><path d="M12 3c3 4 5 6.5 5 10a5 5 0 0 1-10 0c0-2 1-3.5 2-4.5.3 1.5 1 2.5 2 3 0-3 .5-5.5 1-8.5z"/></svg></span>
<b>Fest</b><span>eingestellte Leistung, auch aus dem Netz</span>
</button>
</div>
</div>
<div class="lade-planung" data-heiz="fest" hidden>
<div>
<div class="lade-plan-zeile">
<label for="heiz-regler">Leistung</label>
<output data-heiz="reglerAusgabe"></output>
</div>
<input type="range" id="heiz-regler" data-heiz="regler" min="1" max="60" step="1" value="30" class="heiz-regler">
<div class="lade-marken"><span>0,1kW</span><span>3kW</span><span>6kW</span></div>
</div>
<div class="lade-chips" role="group" aria-label="Schnellwahl">
<button type="button" class="lade-chip" aria-pressed="false" data-heiz-stufe="10">1kW</button>
<button type="button" class="lade-chip" aria-pressed="false" data-heiz-stufe="20">2kW</button>
<button type="button" class="lade-chip" aria-pressed="false" data-heiz-stufe="30">3kW</button>
<button type="button" class="lade-chip" aria-pressed="false" data-heiz-stufe="60">6kW</button>
</div>
</div>
<div class="lade-meldung" data-heiz="meldung" aria-live="polite">Änderungen gelten sofort</div>
</div>
</div>