From 6aa7f2845ef7f056d0ff42e742dee2128cb17878 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sat, 19 Oct 2024 13:22:19 +0000 Subject: [PATCH] 76_SolarForecast: contrib 1.37.0 git-svn-id: https://svn.fhem.de/fhem/trunk@29264 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 64 +++++++++++---------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index ff89dfcfe..f44538fad 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -14199,7 +14199,7 @@ sub _flowGraphic { my $node2grid = ReadingsNum ($name, 'Current_GridFeedIn', 0); # vom Knoten zum Grid my $cself = ReadingsNum ($name, 'Current_SelfConsumption', 0); my $cc = CurrentVal ($hash, 'consumption', 0); - my $wr2bat = ReadingsNum ($name, 'Current_PowerBatIn', undef); + my $batin = ReadingsNum ($name, 'Current_PowerBatIn', undef); my $batout = ReadingsNum ($name, 'Current_PowerBatOut', undef); my $soc = ReadingsNum ($name, 'Current_BatCharge', 100); my $cc_dummy = $cc; @@ -14248,7 +14248,7 @@ sub _flowGraphic { $pdcr->{$lfn}{p} = $p; # aktuelle PV $pv2node += $p if($feed eq 'default'); # PV-Erzeugung Inverter für das Hausnetz $pv2grid += $p if($feed eq 'grid'); # PV nur für das öffentliche Netz - $pv2bat += $p if($feed eq 'bat'); # PV nur in die Batterie + $pv2bat += $p if($feed eq 'bat'); # Direktladen PV nur in die Batterie $lfn++; } @@ -14284,16 +14284,14 @@ sub _flowGraphic { $soc < 76 ? 'flowg bat50' : 'flowg bat75'; - if (!defined $wr2bat && !defined $batout) { + if (!defined $batin && !defined $batout) { $hasbat = 0; - $wr2bat = 0; + $batin = 0; $batout = 0; $soc = 0; } - else { - $wr2bat -= $pv2bat; # abzüglich Direktladung - $wr2bat = 0 if($wr2bat < 0); - } + + my $node2bat = $batin; my $grid_color = $node2grid ? 'flowg grid_color1' : 'flowg grid_color2'; my $cgc_style = $cgc ? 'flowg active_in' : 'flowg inactive_in'; @@ -14311,19 +14309,22 @@ sub _flowGraphic { $cgc = $cgfo; } } - + my $batout_direction = 'M902,515 L730,590'; - if ($wr2bat) { # Batterie wird geladen - my $home2bat = $wr2bat - $pv2node; + if ($node2bat) { # Batterie wird geladen + my $home2bat = $node2bat - $pv2node; - if ($home2bat > 1) { # Batterieladung anteilig aus Hausnetz geladen - $wr2bat -= $home2bat; + if ($home2bat > 1) { # Batterieladung anteilig aus Hausnetz geladen + $node2bat -= $home2bat; $batout_style = 'flowg active_in'; $batout_direction = 'M730,590 L902,515'; $batout = $home2bat; } } + + $node2bat -= $pv2bat; # abzüglich Direktladung + $pnodesum += abs $node2bat if($node2bat < 0); # Batterie ist voll und SolarLader liefert an Knoten ## Werte / SteuerungVars anpassen ################################### @@ -14494,11 +14495,12 @@ END1 $ret .= ' '; } - ## Laufketten PV->Home, PV->Grid, Bat->Home - ############################################## - my $csc_style = $pv2home ? 'flowg active_out' : 'flowg inactive_out'; + ## Laufketten Node->Home, Node->Grid, Bat->Home + ################################################# + my $csc_style = $pv2home ? 'flowg active_out' : 'flowg inactive_out'; my $cgfi_style = $node2grid ? 'flowg active_out' : 'flowg inactive_out'; - $ret .= << "END2"; + + $ret .= << "END2"; @@ -14508,10 +14510,12 @@ END2 ## Laufketten PV->Batterie, Batterie->Home ############################################## if ($hasbat) { - my $wr2bat_style = $wr2bat ? 'flowg active_in active_bat_in' : 'flowg inactive_out'; - $ret .= << "END3"; - - + my $node2bat_style = $node2bat ? 'flowg active_in active_bat_in' : 'flowg inactive_out'; + my $batin_direction = $node2bat < 0 ? 'M910,480 L730,400' : 'M730,400 L910,480'; + + $ret .= << "END3"; + + END3 } @@ -14608,15 +14612,15 @@ END3 ## Textangaben an Grafikelementen ################################### $cc_dummy = sprintf("%.0f", $cc_dummy); # Verbrauch Dummy-Consumer - $ret .= qq{$pnodesum} if ($pnodesum > 0); - $ret .= qq{$soc %} if ($hasbat); # Lage Text Batterieladungszustand - $ret .= qq{$pv2home} if ($pv2home); - $ret .= qq{$node2grid} if ($node2grid); - $ret .= qq{$cgc} if ($cgc); - $ret .= qq{$batout} if ($batout && $hasbat); - $ret .= qq{$wr2bat} if ($wr2bat && $hasbat); - $ret .= qq{$cc}; # Current_Consumption Anlage - $ret .= qq{$cc_dummy} if ($flowgconX && $flowgconPower); # Current_Consumption Dummy + $ret .= qq{$pnodesum} if ($pnodesum > 0); + $ret .= qq{$soc %} if ($hasbat); # Lage Text Batterieladungszustand + $ret .= qq{$pv2home} if ($pv2home); + $ret .= qq{$node2grid} if ($node2grid); + $ret .= qq{$cgc} if ($cgc); + $ret .= qq{$batout} if ($batout && $hasbat); + $ret .= qq{$node2bat} if ($node2bat && $hasbat); + $ret .= qq{$cc}; # Current_Consumption Anlage + $ret .= qq{$cc_dummy} if ($flowgconX && $flowgconPower); # Current_Consumption Dummy ## Textangabe Producer - in Reihenfolge: zum Grid - zum Knoten - zur Batterie ###############################################################################