From 6c0864c70dd595e97c5a372ddca91d6700d46948 Mon Sep 17 00:00:00 2001 From: DS_Starter Date: Thu, 20 Nov 2025 14:00:32 +0000 Subject: [PATCH] 76_SolarForecast: contrib version 1.60.7 git-svn-id: https://svn.fhem.de/fhem/trunk@30544 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 0772209fe..8e667b533 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -12402,9 +12402,11 @@ sub __batChargeOptTargetPower { if ($nhr eq '00') { storeReading ('Battery_TargetAchievable_'.$sbn, $achievable); - $ratio = ___batRatio ($runwhneed, $remainingSurp, $befficiency); + $ratio = sprintf "%.2f", ___batRatio ($runwhneed, $remainingSurp, $befficiency); $data{$name}{current}{'batRatio'.$sbn} = $ratio; + $otp->{$sbn}{ratio} = $ratio; + $otp->{$sbn}{remainingSurp} = $remainingSurp; } $hsurp->{$hod}{$sbn}{loadrel} = $runwhneed > 0 ? 1 : 0; # Ladefreigabe abhängig von Ziel-SoC Erfüllung @@ -12518,9 +12520,6 @@ sub __batChargeOptTargetPower { $befficiency ); } - - $otp->{$sbn}{ratio} = sprintf ("%.2f", $ratio); - $otp->{$sbn}{remainingSurp} = $remainingSurp; my $gfeedin = CurrentVal ($name, 'gridfeedin', 0); # aktuelle Netzeinspeisung my $bpin = CurrentVal ($name, 'batpowerinsum', 0); # aktuelle Batterie Ladeleistung (Summe über alle Batterien) @@ -12574,9 +12573,8 @@ return ($hsurp, $otp); sub ___batRatio { my ($rwh, $surp, $beff) = @_; - return 0 if(!defined $surp || !defined $rwh || $rwh <= 0); + return 0 if($surp <= 0.0 || !defined $rwh || $rwh <= 0.0); - $surp = max (0, $surp); my $ratio = $surp * 100.0 * $beff / $rwh; # beff -> Batterie Effizienz als Anteil 0.1 .. 1 return $ratio;