no message
This commit is contained in:
@@ -637,19 +637,29 @@ foreach ($meters as $name => $mm) {
|
||||
|
||||
private function getDeltaFromArchive(int $varId, int $tStart, int $tEnd): float
|
||||
{
|
||||
// Beide Werte: immer letzter geloggter Wert VOR/GENAU zum Zeitpunkt
|
||||
// Werte holen
|
||||
$startValue = $this->GetValueAt($varId, $tStart, false);
|
||||
$endValue = $this->GetValueAt($varId, $tEnd, false);
|
||||
|
||||
// --- Logging ---
|
||||
IPS_LogMessage("KostenModul", "getDeltaFromArchive(varId=$varId)");
|
||||
IPS_LogMessage("KostenModul", " Startzeit: " . date('Y-m-d H:i:s', $tStart) . " | Startwert: " . var_export($startValue, true));
|
||||
IPS_LogMessage("KostenModul", " Endzeit: " . date('Y-m-d H:i:s', $tEnd) . " | Endwert: " . var_export($endValue, true));
|
||||
|
||||
if ($startValue === null || $endValue === null) {
|
||||
IPS_LogMessage("KostenModul", " -> Einer der Werte ist NULL, Delta = 0.0");
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// Delta berechnen
|
||||
$diff = $endValue - $startValue;
|
||||
|
||||
if ($diff < 0) {
|
||||
// Sicherheitsnetz bei Zähler-Reset
|
||||
IPS_LogMessage("KostenModul", " WARNUNG: Negatives Delta erkannt! Zähler wurde vermutlich zurückgesetzt. Delta wird auf 0 gesetzt.");
|
||||
$diff = 0.0;
|
||||
}
|
||||
|
||||
IPS_LogMessage("KostenModul", " Delta = $diff");
|
||||
return (float)$diff;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user