66 lines
2.0 KiB
HTML
66 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
.bar-container {
|
|
width: 100%;
|
|
background-color: #eee;
|
|
border-radius: 5px;
|
|
overflow: hidden;
|
|
height: 20px;
|
|
margin-bottom: 5px;
|
|
}
|
|
.bar {
|
|
height: 100%;
|
|
float: left;
|
|
}
|
|
.bar-cons { background-color: #4CAF50; }
|
|
.bar-feed { background-color: #8BC34A; }
|
|
.bar-pv { background-color: #FF9800; }
|
|
.bar-grid { background-color: #FF5722; }
|
|
.value-label {
|
|
font-size: 0.9em;
|
|
margin: 4px 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="value-label" id="prodLabel"></div>
|
|
<div class="bar-container">
|
|
<div class="bar bar-cons" id="barCons"></div>
|
|
<div class="bar bar-feed" id="barFeed"></div>
|
|
</div>
|
|
|
|
<div class="value-label" id="consLabel"></div>
|
|
<div class="bar-container">
|
|
<div class="bar bar-pv" id="barPV"></div>
|
|
<div class="bar bar-grid" id="barGrid"></div>
|
|
</div>
|
|
|
|
<script>
|
|
// Daten in die Balken und Beschriftungen einfüllen
|
|
function Apply(data) {
|
|
document.getElementById('prodLabel').innerText =
|
|
"Produktion: " + data.value.prod + " kWh";
|
|
document.getElementById('barCons').style.width = data.prodCons + "%";
|
|
document.getElementById('barFeed').style.width = data.prodFeed + "%";
|
|
|
|
document.getElementById('consLabel').innerText =
|
|
"Verbrauch: " + data.value.cons + " kWh";
|
|
document.getElementById('barPV').style.width = data.consPV + "%";
|
|
document.getElementById('barGrid').style.width = data.consGrid + "%";
|
|
}
|
|
|
|
// HTML-SDK: hier kommen die Nachrichten vom Modul an
|
|
function handleMessage(msg) {
|
|
if (msg) {
|
|
Apply(msg);
|
|
}
|
|
}
|
|
|
|
// beim Laden gleich initial Daten anfordern
|
|
requestAction('update', true);
|
|
</script>
|
|
</body>
|
|
</html>
|