Files
Smart-Dashboard/ajax/heater.php
T
adminandClaude Opus 5 6e805678d4 Heizstab- und Bewaesserungsfenster im neuen Look, Bewaesserungszeilen enger
Beide Fenster lesen den Zustand live aus MQTT und uebernehmen jede Wahl
sofort (bedienfenster.js). submitFormAjax entfaellt.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 21:26:16 +02:00

109 lines
4.7 KiB
PHP
Raw 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)
*
* 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";
} 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 zwei" 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="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>