no message

This commit is contained in:
2026-06-16 10:54:16 +02:00
parent 7983833831
commit bc50640a6f
4 changed files with 24 additions and 21 deletions
+1 -3
View File
@@ -141,6 +141,4 @@ Die Temperaturgrenzen sowie die Prioritäten werden über folgende Variablen ein
## 8. Zukünftige Erweiterungen
* Konfigurierbare Schwellenwerte für die Legionellenschutz-Zeitlogik.
* Frei wählbare Anzahl an Askoheat-Leistungsstufen.
* Eigene Variablenprofile für Temperatur, Leistung und Prioritäten.
-1
View File
@@ -1,7 +1,6 @@
{
"elements": [
{ "type": "SelectVariable", "name": "VarProduction", "caption": "Produktion (kWh)" },
{ "type": "SelectVariable", "name": "VarConsumption", "caption": "Verbrauch (kWh)" },
{ "type": "SelectVariable", "name": "VarFeedIn", "caption": "Einspeisung (kWh)" },
{ "type": "SelectVariable", "name": "VarGrid", "caption": "Bezug Netz (kWh)" }
]
+1 -2
View File
@@ -141,7 +141,7 @@ function render(data){
// Keine Daten
if(data.hasData === false){
elHint.innerHTML = `<b>Letzter Zeitpunkt</b> <span style="opacity:.7">(Keine Werte für diesen Zeitraum)</span>`;
elHint.innerHTML = `<b>${data.noDataHint || 'Keine Werte'}</b> <span style="opacity:.7">(Keine Werte für diesen Zeitraum)</span>`;
elGrid.innerHTML = '';
return;
}
@@ -194,7 +194,6 @@ function render(data){
};
const prod = v.Produktion || 0;
const cons = v.Hausverbrauch || 0;
const grid = v.Netz || 0;
const feed = v.Einspeisung || 0;
const eigen = Math.max(cons - grid, 0);
+22 -15
View File
@@ -35,7 +35,7 @@ class Energy_Pie extends IPSModule
}
// Fullscreen-Fix: push periodically (adjust as you like)
// 2000ms = alle 2 Sekunden (stabil, aber nicht ganz so brutal wie 1000ms)
$this->SetTimerInterval('AutoPush', 2000);
$this->SetTimerInterval('AutoPush', 60000);
$this->RecalculateAndPush();
}
public function GetVisualizationTile(): string
@@ -59,7 +59,7 @@ class Energy_Pie extends IPSModule
break;
case 'SetDate':
$date = (string)$Value;
if (!$this->isValidDate($date)) {
if (!$this->isValidDate($date) || strtotime($date . ' 00:00:00') > time()) {
return;
}
$this->WriteAttributeString(self::ATTR_DATE, $date);
@@ -91,7 +91,16 @@ class Energy_Pie extends IPSModule
$feed = $this->readDelta($this->ReadPropertyInteger('VarFeedIn'), $tStart, $tEnd, $dbgFeed);
$grid = $this->readDelta($this->ReadPropertyInteger('VarGrid'), $tStart, $tEnd, $dbgGrid);
$hasData = (($dbgProd['count'] ?? 0) > 0) || (($dbgFeed['count'] ?? 0) > 0) || (($dbgGrid['count'] ?? 0) > 0);
$noDataHint = (!$hasData && $range !== 'total') ? 'Letzter Zeitpunkt' : '';
$lastLogTs = 0;
if (!$hasData && $range !== 'total') {
$lastLogTs = max(
$this->getLastLogTimestamp($this->ReadPropertyInteger('VarProduction')),
$this->getLastLogTimestamp($this->ReadPropertyInteger('VarFeedIn')),
$this->getLastLogTimestamp($this->ReadPropertyInteger('VarGrid'))
);
}
$noDataHint = ($lastLogTs > 0) ? 'Letzter Zeitpunkt: ' . date('d.m.Y H:i', $lastLogTs) : '';
// House = Prod - Feed + Grid
@@ -109,13 +118,8 @@ class Energy_Pie extends IPSModule
'Einspeisung' => (float)$feed,
'Netz' => (float)$grid,
'Hausverbrauch' => (float)$house
],
// kannst du später entfernen
'debug' => [
'prod' => $dbgProd,
'feed' => $dbgFeed,
'grid' => $dbgGrid
]
];
$this->UpdateVisualizationValue(json_encode($payload, JSON_THROW_ON_ERROR));
}
@@ -128,11 +132,13 @@ class Energy_Pie extends IPSModule
$base = strtotime($dateYmd . ' 00:00:00') ?: strtotime(date('Y-m-d') . ' 00:00:00');
switch ($range) {
case 'day':
return [$base, $base + 86400];
$end = strtotime('+1 day', $base);
return [$base, $end];
case 'week':
$dow = (int)date('N', $base); // 1=Mon..7=Sun
$start = $base - (($dow - 1) * 86400);
return [$start, $start + 7 * 86400];
$start = strtotime('-' . ($dow - 1) . ' days', $base);
$end = strtotime('+7 days', $start);
return [$start, $end];
case 'month':
$start = strtotime(date('Y-m-01 00:00:00', $base));
$end = strtotime(date('Y-m-01 00:00:00', strtotime('+1 month', $start)));
@@ -144,7 +150,8 @@ class Energy_Pie extends IPSModule
return [$start, $end];
default:
return [$base, $base + 86400];
$end = strtotime('+1 day', $base);
return [$base, $end];
}
}
public function GetVisualizationPopup(): string
@@ -235,10 +242,10 @@ class Energy_Pie extends IPSModule
$base = strtotime(($sign === -1 ? '-7 day' : '+7 day'), $base);
break;
case 'month':
$base = strtotime(($sign === -1 ? '-1 month' : '+1 month'), $base);
$base = strtotime(($sign === -1 ? 'first day of previous month' : 'first day of next month'), $base);
break;
case 'year':
$base = strtotime(($sign === -1 ? '-1 year' : '+1 year'), $base);
$base = strtotime(($sign === -1 ? 'first day of january previous year' : 'first day of january next year'), $base);
break;
}
$this->WriteAttributeString(self::ATTR_DATE, date('Y-m-d', $base));