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

bugfix: Avg Div 0

git-svn-id: https://svn.fhem.de/fhem/trunk@5806 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tpoitzsch 2014-05-10 08:07:03 +00:00
parent accff07f4c
commit b7415b42b3
3 changed files with 4 additions and 4 deletions

View File

@ -48,7 +48,7 @@ sub LUXTRONIK2_doStatisticDelta ($$$$$) ;
sub LUXTRONIK2_doStatisticDeltaSingle ($$$$$$); sub LUXTRONIK2_doStatisticDeltaSingle ($$$$$$);
# Modul Version for remote debugging # Modul Version for remote debugging
my $modulVersion = "2014-05-03"; my $modulVersion = "2014-05-10";
#List of firmware versions that are known to be compatible with this modul #List of firmware versions that are known to be compatible with this modul
my $testedFirmware = "#V1.51#V1.54C#V1.60#V1.69#V1.70#"; my $testedFirmware = "#V1.51#V1.54C#V1.60#V1.69#V1.70#";
@ -1509,7 +1509,7 @@ LUXTRONIK2_doStatisticMinMaxSingle ($$$$)
$a[1]++; # Count $a[1]++; # Count
$a[3] += $value; # Sum $a[3] += $value; # Sum
if ($value < $b[1]) { $b[1]=$value; } # Min if ($value < $b[1]) { $b[1]=$value; } # Min
$b[3] = sprintf "%.1f" , $a[3] / $a[1]; # Avg if ($a[1]>0) {$b[3] = sprintf "%.1f" , $a[3] / $a[1];} # Avg
if ($value > $b[5]) { $b[5]=$value; } # Max if ($value > $b[5]) { $b[5]=$value; } # Max
# in case of period change, save "last" values and reset counters # in case of period change, save "last" values and reset counters

View File

@ -702,7 +702,7 @@ JSONMETER_doStatisticMinMaxSingle ($$$$)
$a[1]++; # Count $a[1]++; # Count
$a[3] += $value; # Sum $a[3] += $value; # Sum
if ($value < $b[1]) { $b[1]=$value; } # Min if ($value < $b[1]) { $b[1]=$value; } # Min
$b[3] = sprintf "%.0f" , $a[3] / $a[1]; # Avg if ($a[1]>0) {$b[3] = sprintf "%.0f" , $a[3] / $a[1];} # Avg
if ($value > $b[5]) { $b[5]=$value; } # Max if ($value > $b[5]) { $b[5]=$value; } # Max
# in case of period change, save "last" values and reset counters # in case of period change, save "last" values and reset counters

View File

@ -378,7 +378,7 @@ statistics_doStatisticMinMaxSingle ($$$$$$)
$hidden[1] += $hidden[5] * $timeDiff; # sum $hidden[1] += $hidden[5] * $timeDiff; # sum
$hidden[3] += $timeDiff; # time $hidden[3] += $timeDiff; # time
if ($value < $stat[1]) { $stat[1]=$value; } # Min if ($value < $stat[1]) { $stat[1]=$value; } # Min
$stat[3] = $hidden[1] / $hidden[3]; # Avg if ($hidden[3]>0) {$stat[3] = $hidden[1] / $hidden[3];} # Avg
if ($value > $stat[5]) { $stat[5]=$value; } # Max if ($value > $stat[5]) { $stat[5]=$value; } # Max
} }