From 4ee372ecbe13210001fb950784f64f0fdbad76cc Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Mon, 22 Dec 2025 13:54:09 +0100 Subject: [PATCH] =?UTF-8?q?letztes=20mal=20probiern.=20Habe=20hier=20mit?= =?UTF-8?q?=20N=C3=A4f=20probiert,=20schon=20l=C3=A4nger=20Z=C3=A4hler=20w?= =?UTF-8?q?ertten=20aufzeichned?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Energy_Pie/module.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Energy_Pie/module.php b/Energy_Pie/module.php index 1e962de..86a8a96 100644 --- a/Energy_Pie/module.php +++ b/Energy_Pie/module.php @@ -176,7 +176,14 @@ class Energy_Pie extends IPSModule if (empty($values)) { return 0.0; } - usort($values, static fn($a, $b) => (int)$a['TimeStamp'] <=> (int)$b['TimeStamp']); + //usort($values, static fn($a, $b) => (int)$a['TimeStamp'] <=> (int)$b['TimeStamp']); + + $firstTs = (int)$values[0]['TimeStamp']; + $lastTs = (int)$values[count($values) - 1]['TimeStamp']; + if ($firstTs > $lastTs) { + $values = array_reverse($values); + } + $dbg['count'] = count($values); $dbg['first'] = (float)$values[0]['Value']; $dbg['last'] = (float)$values[count($values) - 1]['Value'];