diff --git a/fhem/CHANGED b/fhem/CHANGED index 0974d44a9..82e34c8f0 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it + - bugfix: 76_SolarForecast: possible Illegal division by zero if Attr + ctrlGenPVdeviation is set to continuously - feature: 74_AutomowerConnect.pm: new attribute mowerPanel - bugfix: 76_SolarForecast: possible Illegal division by zero if Battery SOC management is activated diff --git a/fhem/FHEM/76_SolarForecast.pm b/fhem/FHEM/76_SolarForecast.pm index 108a1f8bc..587e75f0f 100644 --- a/fhem/FHEM/76_SolarForecast.pm +++ b/fhem/FHEM/76_SolarForecast.pm @@ -158,6 +158,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "1.17.10"=> "19.04.2024 calcTodayPVdeviation: avoid Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1311121 ", "1.17.9" => "17.04.2024 _batSocTarget: fix Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1310930 ", "1.17.8" => "16.04.2024 calcTodayPVdeviation: change of calculation ", "1.17.7" => "09.04.2024 export pvHistory to CSV, making attr affectMaxDayVariance obsolete ", @@ -10215,9 +10216,10 @@ sub calcTodayPVdeviation { $dp = sprintf "%.2f", (100 - (100 * $pvfc / $pvre)); } else { - my $rodfc = ReadingsNum ($name, 'RestOfDayPVforecast', 0); - my $fcun = $pvfc - $rodfc; # laufende PV Prognose aus Tagesprognose - Prognose Resttag - $dp = sprintf "%.2f", (100 - (100 * $pvre / $fcun)); + my $rodfc = ReadingsNum ($name, 'RestOfDayPVforecast', 0); # PV Forecast für den Rest des Tages + my $cufc = $pvfc - $rodfc; # laufende PV Prognose aus Tagesprognose - Prognose Resttag + return if(!$cufc); # Illegal division by zero verhindern Forum: + $dp = sprintf "%.2f", (100 - (100 * $pvre / $cufc)); } $data{$type}{$name}{circular}{99}{tdayDvtn} = $dp; diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 108a1f8bc..587e75f0f 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -158,6 +158,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "1.17.10"=> "19.04.2024 calcTodayPVdeviation: avoid Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1311121 ", "1.17.9" => "17.04.2024 _batSocTarget: fix Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1310930 ", "1.17.8" => "16.04.2024 calcTodayPVdeviation: change of calculation ", "1.17.7" => "09.04.2024 export pvHistory to CSV, making attr affectMaxDayVariance obsolete ", @@ -10215,9 +10216,10 @@ sub calcTodayPVdeviation { $dp = sprintf "%.2f", (100 - (100 * $pvfc / $pvre)); } else { - my $rodfc = ReadingsNum ($name, 'RestOfDayPVforecast', 0); - my $fcun = $pvfc - $rodfc; # laufende PV Prognose aus Tagesprognose - Prognose Resttag - $dp = sprintf "%.2f", (100 - (100 * $pvre / $fcun)); + my $rodfc = ReadingsNum ($name, 'RestOfDayPVforecast', 0); # PV Forecast für den Rest des Tages + my $cufc = $pvfc - $rodfc; # laufende PV Prognose aus Tagesprognose - Prognose Resttag + return if(!$cufc); # Illegal division by zero verhindern Forum: + $dp = sprintf "%.2f", (100 - (100 * $pvre / $cufc)); } $data{$type}{$name}{circular}{99}{tdayDvtn} = $dp;