no message
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
<div style="padding:12px;font-family:system-ui;">
|
||||
<div id="out" style="font-size:14px;"></div>
|
||||
<div style="padding:12px;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;">
|
||||
<div id="out"
|
||||
style="white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
|
||||
font-size:12px;line-height:1.35;opacity:0.95;">
|
||||
Warte auf Daten…
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.handleMessage = function (data) {
|
||||
// Symcon liefert manchmal JSON als String -> sauber parsen
|
||||
if (typeof data === 'string') {
|
||||
try { data = JSON.parse(data); } catch(e) {}
|
||||
}
|
||||
|
||||
document.getElementById('out').textContent =
|
||||
JSON.stringify(data, null, 2);
|
||||
};
|
||||
|
||||
// initial anstoßen
|
||||
setTimeout(() => requestAction('Refresh', 1), 200);
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -39,6 +39,13 @@ class Energy_Pie extends IPSModule
|
||||
$this->WriteAttributeString(self::ATTR_RANGE, $this->ReadPropertyString('DefaultRange'));
|
||||
}
|
||||
|
||||
$date = $this->ReadAttributeString(self::ATTR_DATE);
|
||||
|
||||
// Wenn Datum leer/ungültig oder in der Zukunft -> heute setzen
|
||||
if ($date === '' || !$this->isValidDate($date) || strtotime($date . ' 00:00:00') > time()) {
|
||||
$this->WriteAttributeString(self::ATTR_DATE, date('Y-m-d'));
|
||||
}
|
||||
|
||||
// Push initial view data
|
||||
$this->RecalculateAndPush();
|
||||
}
|
||||
@@ -101,6 +108,8 @@ private function RecalculateAndPush(): void
|
||||
$range = $this->ReadAttributeString(self::ATTR_RANGE);
|
||||
$date = $this->ReadAttributeString(self::ATTR_DATE);
|
||||
|
||||
|
||||
|
||||
[$tStart, $tEnd] = $this->getRange($range, $date);
|
||||
|
||||
// Debug-Container initialisieren (sonst "Undefined variable")
|
||||
|
||||
Reference in New Issue
Block a user