From 667dcbae85ace2b7aa7e01b253557427808d656d Mon Sep 17 00:00:00 2001 From: DS_Starter Date: Wed, 8 Oct 2025 09:40:38 +0000 Subject: [PATCH] 76_SolarForecast: contrib version 1.59.1 git-svn-id: https://svn.fhem.de/fhem/trunk@30366 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 80 ++++++++++----------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index f2a7be7c2..e7b314942 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -160,7 +160,8 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "1.59.1" => "07.10.2025 fixed transfer at day change, optimal SoC consideration in SoC forecast for optPower strategy ", + "1.59.1" => "08.10.2025 fixed transfer at day change, optimal SoC consideration in SoC forecast for optPower strategy ". + "__normIconInnerScale: add path color filling ", "1.59.0" => "06.10.2025 new sub __normIconInnerScale to fix problem with chromium engine > 140.x, Forum: https://forum.fhem.de/index.php?msg=1349058 ", "1.58.8" => "06.10.2025 __batChargeOptTargetPower: minor Code change ", "1.58.7" => "05.10.2025 fix negative SoC forecast when using optPower Forum: https://forum.fhem.de/index.php?msg=1348954 ", @@ -11619,7 +11620,8 @@ sub _batChargeMgmt { my $inplim = 0; my $hsurp = {}; # Hashreferenz Überschuß - my $hsoc = {}; # Hashreferenz + my $hsoc = {}; # Hashreferenz Prognose-SOC über alle Batterien + my $trans = {}; # Referenz Übertrags-Hash my $values = {}; # Hashreferenz my $progsoc; @@ -11854,14 +11856,8 @@ sub _batChargeMgmt { $speff < 0 ? $speff / $befficiency : # Verbrauch einbeziehen 0; - $socwh += $delta; - - #$socwh = $socwh < $lowSocwh ? $lowSocwh : # SoC begrenzen - # $socwh < $batoptsocwh ? $batoptsocwh : - # $socwh > $batinstcap ? $batinstcap : - # $socwh; - - $socwh = ___batClampValue ($socwh, $lowSocwh, $batoptsocwh, $batinstcap); # SoC begrenzen + $socwh += $delta; + $socwh = ___batClampValue ($socwh, $lowSocwh, $batoptsocwh, $batinstcap); # SoC begrenzen $socwh = sprintf "%.0f", $socwh; # SoC Prognose in Wh $progsoc = sprintf "%.1f", (100 * $socwh / $batinstcap); # Prognose SoC in % @@ -11908,10 +11904,8 @@ sub _batChargeMgmt { } } - # leistungsoptimierte (optPower) Beladungssteuerung - ##################################################### - my $trans = {}; # Übertrags-Hash Referenz - + ## leistungsoptimierte (optPower) Beladungssteuerung + ###################################################### for my $lfd (0..max (0, keys %{$hsurp})) { $paref->{hsurp} = $hsurp->{$lfd}; my ($hopt, $otp) = __batChargeOptTargetPower ($paref, $lfd, $trans); @@ -12091,13 +12085,7 @@ sub __batChargeOptTargetPower { $hsurp->{$hod}{$sbn}{pneedmin} = $bpinmax; $runwh += $hsurp->{$hod}{speff} / $befficiency; # um Verbrauch reduzieren - - #$runwh = $runwh < $lowSocwh ? $lowSocwh : # runwh begrenzen - # $runwh < $batoptsocwh ? $batoptsocwh : - # $runwh > $batinstcap ? $batinstcap : - # $runwh; - - $runwh = ___batClampValue ($runwh, $lowSocwh, $batoptsocwh, $batinstcap); # runwh begrenzen + $runwh = ___batClampValue ($runwh, $lowSocwh, $batoptsocwh, $batinstcap); # runwh begrenzen $hsurp->{$hod}{$sbn}{fcendwh} = sprintf "%.0f", $runwh; $hsurp->{$nexthod}{$sbn}{fcnextwh} = $hsurp->{$hod}{$sbn}{fcendwh} if(defined $nextnhr); # Startwert kommende Stunde @@ -12154,12 +12142,7 @@ sub __batChargeOptTargetPower { : $spls ) ); - - #$runwh = $runwh < $lowSocwh ? $lowSocwh : # fcendwh begrenzen - # $runwh < $batoptsocwh ? $batoptsocwh : - # $runwh > $batinstcap ? $batinstcap : - # $runwh; - + $runwh = ___batClampValue ($runwh, $lowSocwh, $batoptsocwh, $batinstcap); # fcendwh begrenzen $hsurp->{$hod}{$sbn}{fcendwh} = sprintf "%.0f", $runwh; @@ -18781,9 +18764,10 @@ END0 lang => $lang } ); - - $cicon = FW_makeImage ($cicon, ''); - $cicon = __normIconInnerScale ($cicon); + + my $ccicon = (split '@', $cicon)[1]; + $cicon = FW_makeImage ($cicon, ''); + $cicon = __normIconInnerScale ($cicon, $ccicon); $ret .= qq{}; $ret .= "$calias".$cicon; @@ -18823,8 +18807,9 @@ END1 $hicon = $hicon.'@'.$pahcol; } - $hicon = FW_makeImage ($hicon, ''); - $hicon = __normIconInnerScale ($hicon); + my $chicon = (split '@', $hicon)[1]; + $hicon = FW_makeImage ($hicon, ''); + $hicon = __normIconInnerScale ($hicon, $chicon); $ret .= qq{}; # translate(X-Koordinate,Y-Koordinate) $ret .= "$hmtxt".$hicon; @@ -18844,9 +18829,9 @@ END1 } ); - - $dicon = FW_makeImage ($dicon, ''); - $dicon = __normIconInnerScale ($dicon); + my $cdicon = (split '@', $dicon)[1]; + $dicon = FW_makeImage ($dicon, ''); + $dicon = __normIconInnerScale ($dicon, $cdicon); $ret .= qq{}; $ret .= "$dumtxt".$dicon; @@ -19324,9 +19309,10 @@ sub __addInputProducerIcon { lang => $lang } ); - + + my $gcolor = (split '@', $genericon)[1]; $genericon = FW_makeImage ($genericon, ''); - $genericon = __normIconInnerScale ($genericon); + $genericon = __normIconInnerScale ($genericon, $gcolor); $ret .= qq{}; $ret .= "$genertxt".$genericon; @@ -19344,8 +19330,9 @@ sub __addInputProducerIcon { } ); - $picon = FW_makeImage ($picon, ''); - $picon = __normIconInnerScale ($picon); + my $cpicon = (split '@', $picon)[1]; + $picon = FW_makeImage ($picon, ''); + $picon = __normIconInnerScale ($picon, $cpicon); $ret .= qq{}; $ret .= "$ptxt".$picon; @@ -19379,9 +19366,10 @@ sub __addNodeIcon { lang => $lang } ); - - $nicon = FW_makeImage ($nicon, ''); - $nicon = __normIconInnerScale ($nicon); + + my $cnicon = (split '@', $nicon)[1]; + $nicon = FW_makeImage ($nicon, ''); + $nicon = __normIconInnerScale ($nicon, $cnicon); my $ret = qq{}; # translate(X-Koordinate,Y-Koordinate) $ret .= "$ntxt".$nicon; @@ -19628,6 +19616,7 @@ return $p; ################################################################ sub __normIconInnerScale { my $icon = shift; + my $fill = shift; # Füll-Frbe my $size = shift // 70; my $pad = shift // 0; @@ -19651,7 +19640,12 @@ sub __normIconInnerScale { $ox += $pad; # fügt $pad ViewBox-Einheiten Rand links bzw. oben hinzu. $oy += $pad; - my $inner = qq{}.$inner.''; # gib Inner-Content zurück, umgeben von der Transform-Gruppe + if ($fill) { + $inner =~ s{]*\bfill)}{]*\bstroke)}{}.$inner.''; # gib Inner-Content zurück, umgeben von der Transform-Gruppe return $inner; }