79 lines
3.5 KiB
HTML
79 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
html, body { margin: 0; padding: 8px; background: transparent; font-family: sans-serif; color: #ffffff; }
|
|
.bar-block { margin-bottom: 20px; }
|
|
.bar-title { font-size: 1.2em; font-weight: bold; margin-bottom: 6px; }
|
|
.bar-container { width: 100%; background: #ddd; border-radius: 4px; overflow: hidden; height: 24px; position: relative; }
|
|
.bar { height: 100%; float: left; position: relative; }
|
|
.bar span { position: absolute; width: 100%; text-align: center; line-height: 24px; font-size: 0.8em; color: #fff; }
|
|
.bar-cons { background: #4CAF50; }
|
|
.bar-feed { background: #8BC34A; }
|
|
.bar-pv { background: #FF9800; }
|
|
.bar-grid { background: #FF5722; }
|
|
.value-text { font-size: 0.95em; margin-top: 4px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="pv_visu">
|
|
<div class="bar-block">
|
|
<div class="bar-title">Produktion (Eigenverbrauch / Einspeisung)</div>
|
|
<div class="bar-container">
|
|
<div class="bar bar-cons" id="barCons"><span id="barConsText"></span></div>
|
|
<div class="bar bar-feed" id="barFeed"><span id="barFeedText"></span></div>
|
|
</div>
|
|
<div class="value-text" id="prodValues"></div>
|
|
</div>
|
|
<div class="bar-block">
|
|
<div class="bar-title">Verbrauch (PV / Netz)</div>
|
|
<div class="bar-container">
|
|
<div class="bar bar-pv" id="barPV"><span id="barPVText"></span></div>
|
|
<div class="bar bar-grid" id="barGrid"><span id="barGridText"></span></div>
|
|
</div>
|
|
<div class="value-text" id="consValues"></div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function Apply(data) {
|
|
document.getElementById('barCons').style.width = data.prodCons + '%';
|
|
document.getElementById('barFeed').style.width = data.prodFeed + '%';
|
|
document.getElementById('barPV').style.width = data.consPV + '%';
|
|
document.getElementById('barGrid').style.width = data.consGrid + '%';
|
|
|
|
document.getElementById('barConsText').innerText = data.prodCons + '%';
|
|
document.getElementById('barFeedText').innerText = data.prodFeed + '%';
|
|
document.getElementById('barPVText').innerText = data.consPV + '%';
|
|
document.getElementById('barGridText').innerText = data.consGrid + '%';
|
|
|
|
document.getElementById('prodValues').innerText =
|
|
'Gesamt: ' + data.value.prod + ' kWh, Eigenverbrauch: ' + (data.consPV/100*data.value.cons).toFixed(2) + ' kWh, Einspeisung: ' + data.value.feed + ' kWh';
|
|
document.getElementById('consValues').innerText =
|
|
'Gesamt: ' + data.value.cons + ' kWh, PV-Anteil: ' + (data.consPV/100*data.value.cons).toFixed(2) + ' kWh, Netz: ' + data.value.grid + ' kWh';
|
|
}
|
|
|
|
function handleMessage(msg) {
|
|
try {
|
|
const data = typeof msg === 'string' ? JSON.parse(msg) : msg;
|
|
Apply(data);
|
|
} catch (e) {
|
|
console.error('Fehler beim Verarbeiten der Daten:', e, msg);
|
|
}
|
|
}
|
|
|
|
if (typeof registerMessageHandler === 'function') {
|
|
registerMessageHandler(handleMessage);
|
|
}
|
|
|
|
// Live-Aktualisierung alle 30 Sekunden
|
|
function pollData() {
|
|
if (typeof IPS !== 'undefined') {
|
|
IPS.RequestAction('update', '');
|
|
}
|
|
}
|
|
setInterval(pollData, 30000);
|
|
</script>
|
|
</body>
|
|
</html>
|