statistics: specialPeriod bugfix

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@10075 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
grompo 2015-12-03 17:21:21 +00:00
parent c5190dc521
commit b09e7822e0

View File

@ -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