From f8d14e9392724146eeef6b6066b667ee60ea265d Mon Sep 17 00:00:00 2001 From: grompo <> Date: Thu, 3 Dec 2015 17:21:21 +0000 Subject: [PATCH] statistics: specialPeriod bugfix git-svn-id: https://svn.fhem.de/fhem/trunk@10075 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_statistics.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/98_statistics.pm b/fhem/FHEM/98_statistics.pm index 4d494ed9f..7cf99c2c5 100644 --- a/fhem/FHEM/98_statistics.pm +++ b/fhem/FHEM/98_statistics.pm @@ -369,6 +369,7 @@ sub statistics_DoStatisticsAll($$) } } +# To avoid data loose, store all readings once a day in the state file if ($periodSwitch < -1 || $periodSwitch > 1 ) { WriteStatefile(); } } @@ -810,9 +811,9 @@ sub statistics_doStatisticSpecialPeriod ($$$$$) unshift @hidden, $value; statistics_Log $hash, 4, "Add $value to $hiddenReadingName"; - while ( $#hidden > $specialPeriod ) { + while ( $#hidden >= $specialPeriod ) { my $lastValue = pop @hidden; - statistics_Log $hash, 4, "Remove last value '$lastValue' from '$hiddenReadingName'"; + statistics_Log $hash, 4, "Remove last (".$#hidden.") value '$lastValue' from '$hiddenReadingName'"; } # Calculate specialPeriodValue