2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

statistics: specialPeriod bugfix

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

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(); } if ($periodSwitch < -1 || $periodSwitch > 1 ) { WriteStatefile(); }
} }
@ -810,9 +811,9 @@ sub statistics_doStatisticSpecialPeriod ($$$$$)
unshift @hidden, $value; unshift @hidden, $value;
statistics_Log $hash, 4, "Add $value to $hiddenReadingName"; statistics_Log $hash, 4, "Add $value to $hiddenReadingName";
while ( $#hidden > $specialPeriod ) { while ( $#hidden >= $specialPeriod ) {
my $lastValue = pop @hidden; 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 # Calculate specialPeriodValue