diff --git a/Ansteuerung_Askoheat/README.md b/Ansteuerung_Askoheat/README.md
index 5d01198..e7322ba 100644
--- a/Ansteuerung_Askoheat/README.md
+++ b/Ansteuerung_Askoheat/README.md
@@ -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.
+
diff --git a/Energy_Pie/form.json b/Energy_Pie/form.json
index a8b8127..7e3569f 100644
--- a/Energy_Pie/form.json
+++ b/Energy_Pie/form.json
@@ -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)" }
]
diff --git a/Energy_Pie/module.html b/Energy_Pie/module.html
index e3c99b0..0b7061c 100644
--- a/Energy_Pie/module.html
+++ b/Energy_Pie/module.html
@@ -141,7 +141,7 @@ function render(data){
// Keine Daten
if(data.hasData === false){
- elHint.innerHTML = `Letzter Zeitpunkt (Keine Werte für diesen Zeitraum)`;
+ elHint.innerHTML = `${data.noDataHint || 'Keine Werte'} (Keine Werte für diesen Zeitraum)`;
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);
diff --git a/Energy_Pie/module.php b/Energy_Pie/module.php
index d5ff57c..1db55a2 100644
--- a/Energy_Pie/module.php
+++ b/Energy_Pie/module.php
@@ -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));