no message
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<body>
|
||||
<div id="pv_visu">
|
||||
<div class="bar-block">
|
||||
<div class="bar-title">Produktion (PV → Verbrauch / Netz)</div>
|
||||
<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>
|
||||
@@ -48,9 +48,9 @@
|
||||
document.getElementById('barGridText').innerText = data.consGrid + '%';
|
||||
|
||||
document.getElementById('prodValues').innerText =
|
||||
'Gesamt: ' + data.value.prod + ' kWh, davon Eigenverbrauch: ' + (data.consPV/100*data.value.cons).toFixed(2) + ' kWh, Einspeisung: ' + data.value.feed + ' kWh';
|
||||
'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, davon PV: ' + (data.consPV/100*data.value.cons).toFixed(2) + ' kWh, Netz: ' + data.value.grid + ' kWh';
|
||||
'Gesamt: ' + data.value.cons + ' kWh, PV-Anteil: ' + (data.consPV/100*data.value.cons).toFixed(2) + ' kWh, Netz: ' + data.value.grid + ' kWh';
|
||||
}
|
||||
|
||||
function handleMessage(msg) {
|
||||
@@ -65,6 +65,14 @@
|
||||
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>
|
||||
|
||||
@@ -11,7 +11,6 @@ class PV_Visu extends IPSModule
|
||||
$this->RegisterPropertyInteger('VarFeedIn', 0);
|
||||
$this->RegisterPropertyInteger('VarGrid', 0);
|
||||
|
||||
// Variable zur Übergabe der Daten an das HTML
|
||||
$this->RegisterVariableString('JSONData', 'Visualisierungsdaten', '', 0);
|
||||
IPS_SetHidden($this->GetIDForIdent('JSONData'), true);
|
||||
|
||||
@@ -49,7 +48,7 @@ class PV_Visu extends IPSModule
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
if ($Ident === 'update') {
|
||||
return $this->UpdateData(); // Rückgabe für die Visualisierung
|
||||
return $this->UpdateData(); // Rückgabe für Visualisierung
|
||||
}
|
||||
throw new \Exception("Unknown Ident: $Ident");
|
||||
}
|
||||
@@ -84,7 +83,7 @@ class PV_Visu extends IPSModule
|
||||
|
||||
$json = json_encode($data);
|
||||
SetValueString($this->GetIDForIdent('JSONData'), $json);
|
||||
return $data; // Wichtig für JS-Aufruf
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function GetDailyTotal(int $varID, int $start, int $end)
|
||||
@@ -97,4 +96,4 @@ class PV_Visu extends IPSModule
|
||||
$values = @AC_GetAggregatedValues($archiveID, $varID, 1, $start, $end, 1);
|
||||
return isset($values[0]['Avg']) ? (float)$values[0]['Avg'] : 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user