From 31c5a3f9f82c1dd0ed5a5c85f837db16318bb7a8 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sat, 26 Oct 2024 18:36:31 +0000 Subject: [PATCH] 76_SolarForecast: Attr flowGraphicControl new key h2consumerdist git-svn-id: https://svn.fhem.de/fhem/trunk@29300 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/76_SolarForecast.pm | 115 +++++++++++++++++++--------------- 2 files changed, 67 insertions(+), 49 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 0e318d5f5..5ea81c131 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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 + - feature: 76_SolarForecast: Attr flowGraphicControl new key h2consumerdist - feature: 74_AutomowerConnect: new statistics values upTime, downTime new setter getMessages, resetCuttingBladeUsageTime added messages to listErrorStack diff --git a/fhem/FHEM/76_SolarForecast.pm b/fhem/FHEM/76_SolarForecast.pm index 1d0e7fd8b..a260bb0e0 100644 --- a/fhem/FHEM/76_SolarForecast.pm +++ b/fhem/FHEM/76_SolarForecast.pm @@ -156,6 +156,8 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "1.37.3" => "25.10.2024 _flowGraphic: grid, dummy and battery displacement by kask ". + "Attr flowGraphicControl: new key h2consumerdist, animate=1 is default now ", "1.37.2" => "24.10.2024 _flowGraphic: show Producer Row only if more than one Producer is defined ", "1.37.1" => "23.10.2024 state: 'The setup routine is still incomplete' if setup is incomplete ". "change: 'trackFlex' && \$wcc >= 80 to \$wcc >= 70, implement Rename function ". @@ -5644,7 +5646,8 @@ sub _attrflowGraphicControl { ## no critic "not used" my $hash = $defs{$name}; for my $av ( qw( animate - consumerdist + consumerdist + h2consumerdist shift showconsumer showconsumerremaintime @@ -5664,6 +5667,7 @@ sub _attrflowGraphicControl { ## no critic "not used" my $valid = { animate => '0|1', consumerdist => '[89]\d{1}|[1234]\d{2}|500', + h2consumerdist => '\d{1,3}', shift => '-?[0-7]\d{0,1}|-?80', size => '\d+', showconsumer => '0|1', @@ -12142,13 +12146,14 @@ sub entryGraphic { sheader => AttrNum ($name, 'graphicHeaderShow', 1), # Anzeigen des Grafik Headers hdrDetail => AttrVal ($name, 'graphicHeaderDetail', 'all'), # ermöglicht den Inhalt zu begrenzen, um bspw. passgenau in ftui einzubetten flowgsize => CurrentVal ($hash, 'size', $flowGSizedef), # Größe Energieflußgrafik - flowgani => CurrentVal ($hash, 'animate', 0), # Animation Energieflußgrafik + flowgani => CurrentVal ($hash, 'animate', 1), # Animation Energieflußgrafik flowgshift => CurrentVal ($hash, 'shift', 0), # Verschiebung der Flußgrafikbox (muß negiert werden) flowgcons => CurrentVal ($hash, 'showconsumer', 1), # Verbraucher in der Energieflußgrafik anzeigen flowgconX => CurrentVal ($hash, 'showconsumerdummy', 1), # Dummyverbraucher in der Energieflußgrafik anzeigen flowgconsPower => CurrentVal ($hash, 'showconsumerpower', 1), # Verbraucher Leistung in der Energieflußgrafik anzeigen flowgconsTime => CurrentVal ($hash, 'showconsumerremaintime', 1), # Verbraucher Restlaufeit in der Energieflußgrafik anzeigen flowgconsDist => CurrentVal ($hash, 'consumerdist', $fgCDdef), # Abstand Verbrauchericons zueinander + flowgh2cDist => CurrentVal ($hash, 'h2consumerdist', 0), # Erweiterung des vertikalen Abstandes Haus -> Consumer genpvdva => AttrVal ($name, 'ctrlGenPVdeviation', 'daily'), # Methode der Abweichungsberechnung lang => getLang ($hash), debug => getDebug ($hash), # Debug Module @@ -14215,6 +14220,7 @@ sub _flowGraphic { my $flowgconsPower = $paref->{flowgconsPower}; my $flowgPrdsPower = 1; # initial Producer akt. Erzeugung anzeigen my $cdist = $paref->{flowgconsDist}; # Abstand Consumer zueinander + my $exth2cdist = $paref->{flowgh2cDist}; # vertikaler Abstand Home -> Consumer Zeile my $lang = $paref->{lang}; my $cgc = ReadingsNum ($name, 'Current_GridConsumption', 0); @@ -14229,10 +14235,10 @@ sub _flowGraphic { my $scale = $fgscaledef; my $pdist = 130; # Abstand Producer zueinander my $hasbat = 1; # initial Batterie vorhanden - my $lcp; + my ($lcp, $y_pos, $y_pos1); my $stna = $name; - $stna =~ s/([0-9])/$hrepl{$1}/ge if($name =~ /[0-9]/xs); # V 1.37.1 Ziffern eliminieren, Forum: https://forum.fhem.de/index.php?msg=1323229 + $stna =~ s/([0-9])/$hrepl{$1}/ge if($name =~ /[0-9]/xs); # V 1.37.1 Ziffern eliminieren, Forum: https://forum.fhem.de/index.php?msg=1323229 ## definierte Producer + Inverter ermitteln und zusammenfassen ################################################################ @@ -14284,9 +14290,9 @@ sub _flowGraphic { my ($togrid, $tonode, $tobat) = __sortProducer ($pdcr); # lfn Producer sortiert nach ptyp und feed my $psorted = { - '1togrid' => { xicon => -100, xchain => 350, ychain => 420, step => 70, count => scalar @{$togrid}, sorted => $togrid }, # Producer/PV nur zu Grid + '1togrid' => { xicon => -100, xchain => 150, ychain => 400, step => 30, count => scalar @{$togrid}, sorted => $togrid }, # Producer/PV nur zu Grid '2tonode' => { xicon => 350, xchain => 700, ychain => 200, step => $pdist, count => scalar @{$tonode}, sorted => $tonode }, # Producer/PV zum Knoten - '3tobat' => { xicon => 750, xchain => 1100, ychain => 430, step => 40, count => scalar @{$tobat}, sorted => $tobat }, # Producer/PV nur zu Batterie + '3tobat' => { xicon => 750, xchain => 1370, ychain => 430, step => 30, count => scalar @{$tobat}, sorted => $tobat }, # Producer/PV nur zu Batterie }; my $doproducerrow = 1; @@ -14294,10 +14300,10 @@ sub _flowGraphic { ## definierte Verbraucher ermitteln ##################################### - my $cnsmr = {}; # Hashref Consumer current power + my $cnsmr = {}; # Hashref Consumer current power - for my $c (sort{$a<=>$b} keys %{$data{$type}{$name}{consumers}}) { # definierte Verbraucher ermitteln - next if(isConsumerNoshow ($hash, $c) =~ /^[13]$/xs); # auszublendende Consumer nicht berücksichtigen + for my $c (sort{$a<=>$b} keys %{$data{$type}{$name}{consumers}}) { # definierte Verbraucher ermitteln + next if(isConsumerNoshow ($hash, $c) =~ /^[13]$/xs); # auszublendende Consumer nicht berücksichtigen $cnsmr->{$c}{p} = ReadingsNum ($name, "consumer${c}_currentPower", 0); $cnsmr->{$c}{ptyp} = 'consumer'; } @@ -14318,22 +14324,22 @@ sub _flowGraphic { $soc = 0; } - my $grid2home_style = $cgc ? "$stna active_sig" : "$stna inactive"; # cgc current GridConsumption + my $grid2home_style = $cgc ? "$stna active_sig" : "$stna inactive"; # cgc current GridConsumption my $bat2home_style = $bat2home ? "$stna active_normal" : "$stna inactive"; - my $cgc_direction = "M490,515 L670,590"; + my $cgc_direction = "M250,515 L670,590"; if ($bat2home) { # Batterie wird ins Haus entladen my $cgfo = $node2grid - $pv2node; if ($cgfo > 1) { $grid2home_style = "$stna active_normal"; - $cgc_direction = "M670,590 L490,515"; + $cgc_direction = "M670,590 L250,515"; $node2grid -= $cgfo; $cgc = $cgfo; } } - my $bat2home_direction = "M902,515 L730,590"; + my $bat2home_direction = "M1200,515 L730,590"; my $node2bat = $batin; if ($batin) { # Batterie wird geladen @@ -14342,7 +14348,7 @@ sub _flowGraphic { if ($home2bat > 1) { # Batterieladung wird anteilig aus Hausnetz geladen $node2bat -= $home2bat; $bat2home_style = "$stna active_sig"; - $bat2home_direction = "M730,590 L902,515"; + $bat2home_direction = "M730,590 L1200,515"; $bat2home = $home2bat; } } @@ -14358,14 +14364,15 @@ sub _flowGraphic { ## SVG Box initialisieren mit Grid-Icon ######################################### - my $vbwidth = 800; # width and height specify the viewBox size - my $vbminx = -10 * $flowgshift; # min-x and min-y represent the smallest X and Y coordinates that the viewBox may have - my $vbminy = $doproducerrow ? -25 : 125; # Grafik höher positionieren wenn keine Poducerreihe angezeigt - - my $vbhight = !$flowgcons ? 380 : - !$flowgconsTime ? 590 : - 610; + my $vbwidth = 800; # width and height specify the viewBox size + my $vbminx = -10 * $flowgshift; # min-x and min-y represent the smallest X and Y coordinates that the viewBox may have + my $vbminy = $doproducerrow ? -25 : 125; # Grafik höher positionieren wenn keine Poducerreihe angezeigt + my $vbhight = !$flowgcons ? 380 : + !$flowgconsTime ? 590 : + 610; + $vbhight += $exth2cdist; + if ($doproducerrow) {$vbhight += 100}; # Höhe Box vergrößern wenn Poducerreihe angezeigt my $vbox = "$vbminx $vbminy $vbwidth $vbhight"; @@ -14399,7 +14406,7 @@ sub _flowGraphic { - + END0 @@ -14438,6 +14445,7 @@ END0 my $cons_left = 0; my $consumer_start = 0; my $currentPower = 0; + $y_pos = 505 + $exth2cdist; if ($flowgcons) { if ($consumercount % 2) { @@ -14466,7 +14474,7 @@ END0 $cicon = FW_makeImage ($cicon, ''); ($scale, $cicon) = __normIconScale ($cicon, $name); - $ret .= qq{}; + $ret .= qq{}; $ret .= "$calias".$cicon; $ret .= ' '; @@ -14475,10 +14483,10 @@ END0 } ## Batterie Icon - ################## - if ($hasbat) { + ################## + if ($hasbat) { $ret .= << "END1"; - + END1 @@ -14507,7 +14515,7 @@ END1 my $dicon = FW_makeImage ($cicondef.$dumcol, ''); ($scale, $dicon) = __normIconScale ($dicon, $name); - $ret .= qq{}; + $ret .= qq{}; $ret .= "$dumtxt".$dicon; $ret .= ' '; } @@ -14520,7 +14528,7 @@ END1 $ret .= << "END2"; - + END2 @@ -14528,7 +14536,7 @@ END2 ############################################## if ($hasbat) { my $node2bat_style = $node2bat ? "$stna active_normal" : "$stna inactive"; - my $batin_direction = $node2bat < 0 ? "M910,480 L730,400" : "M730,400 L910,480"; + my $batin_direction = $node2bat < 0 ? "M1200,480 L730,400" : "M730,400 L1200,480"; $node2bat = abs $node2bat; $ret .= << "END3"; @@ -14543,13 +14551,13 @@ END3 my $consumer_style = "$stna inactive"; $consumer_style = "$stna active_sig" if($cc_dummy > 1); my $chain_color = ""; # Farbe der Laufkette Consumer-Dummy - + if ($cc_dummy > 0.5) { $chain_color = 'style="stroke: #'.substr(Color::pahColor(0,500,1000,$cc_dummy,[0,255,0, 127,255,0, 255,255,0, 255,127,0, 255,0,0]),0,6).';"'; #$chain_color = 'style="stroke: #DF0101;"'; } - $ret .= qq{}; + $ret .= qq{}; } ## Producer Laufketten - in Reihenfolge: zum Grid - zum Knoten - zur Batterie @@ -14596,6 +14604,7 @@ END3 $cons_left = $consumer_start * 2; my $cons_left_start = 0; my $distance_con = 65; + $y_pos = 880 + 2 * $exth2cdist; if ($consumercount % 2) { $cons_left_start = 700 - ($distance_con * ($consumercount -1) / 2); @@ -14624,7 +14633,7 @@ END3 $chain_color = 'style="stroke: #'.substr(Color::pahColor(0,50,100,$p,[0,255,0, 127,255,0, 255,255,0, 255,127,0, 255,0,0]),0,6).';"'; } - $ret .= qq{}; + $ret .= qq{}; $cons_left += ($cdist * 2); $cons_left_start += $distance_con; } @@ -14633,15 +14642,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{$node2home} if ($node2home); - $ret .= qq{$node2grid} if ($node2grid); - $ret .= qq{$cgc} if ($cgc); - $ret .= qq{$bat2home} if ($bat2home && $hasbat); - $ret .= qq{$node2bat} if ($node2bat && $hasbat); - $ret .= qq{$cc}; # Current_Consumption Anlage - $ret .= qq{$cc_dummy} if ($flowgconX && $flowgconsPower); # Current_Consumption Dummy + $ret .= qq{$pnodesum} if ($pnodesum > 0); + $ret .= qq{$soc %} if ($hasbat); # Lage Text Batterieladungszustand + $ret .= qq{$node2home} if ($node2home); + $ret .= qq{$node2grid} if ($node2grid); + $ret .= qq{$cgc} if ($cgc); + $ret .= qq{$bat2home} if ($bat2home && $hasbat); + $ret .= qq{$node2bat} if ($node2bat && $hasbat); + $ret .= qq{$cc}; # Current_Consumption Anlage + $ret .= qq{$cc_dummy} if ($flowgconX && $flowgconsPower); # Current_Consumption Dummy ## Textangabe Producer - in Reihenfolge: zum Grid - zum Knoten - zur Batterie ## Textangabe nur anzeigen wenn Producerzeile angezeigt werden soll @@ -14683,7 +14692,9 @@ END3 ######################## if ($flowgcons) { $cons_left = ($consumer_start * 2) - 50; # -XX -> Start Lage Consumer Beschriftung - + $y_pos = 1110 + 2 * $exth2cdist; + $y_pos1 = 1170 + 2 * $exth2cdist; + for my $c (@consumers) { $currentPower = sprintf "%.1f", $cnsmr->{$c}{p}; $currentPower = sprintf "%.0f", $currentPower if($currentPower > 10); @@ -14706,9 +14717,9 @@ END3 elsif ($lcp == 3) {$cons_left -= 5 } elsif ($lcp == 2) {$cons_left += 7 } elsif ($lcp == 1) {$cons_left += 25} - - $ret .= qq{$currentPower} if ($flowgconsPower); # Lage Consumer Consumption - $ret .= qq{$consumerTime} if ($flowgconsTime); # Lage Consumer Restlaufzeit + + $ret .= qq{$currentPower} if($flowgconsPower); # Lage Consumer Consumption + $ret .= qq{$consumerTime} if($flowgconsTime); # Lage Consumer Restlaufzeit # Verbrauchszahl wieder zurück an den Ursprungspunkt ###################################################### @@ -21111,11 +21122,14 @@ to ensure that the system configuration is correct. - + - + + + + @@ -23515,11 +23529,14 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
animate Animates the energy flow graphic if displayed. (graphicSelect)
0 - Animation off, 1 - Animation on, default: 0
0 - Animation off, 1 - Animation on, default: 1
consumerdist Controls the distance between the consumer icons in the energy flow graphic.
consumerdist Controls the distance between the consumer icons.
Value: 80 ... 500, default: 130
h2consumerdist Extension of the vertical distance between the house and the consumer icons.
Value: 0 ... 999, default: 0
shift Horizontal shift of the energy flow graph.
Value: -80 ... 80, default: 0
- + - + + + +
animate Animiert die Energieflußgrafik sofern angezeigt. (graphicSelect)
0 - Animation aus, 1 - Animation an, default: 0
0 - Animation aus, 1 - Animation an, default: 1
consumerdist Steuert den Abstand zwischen den Consumer-Icons in der Energieflußgrafik.
consumerdist Steuert den Abstand zwischen den Verbraucher-Icons.
Wert: 80 ... 500, default: 130
h2consumerdist Erweiterung des vertikalen Abstandes zwischen dem Haus und den Verbraucher-Icons.
Wert: 0 ... 999, default: 0
shift Horizontale Verschiebung der Energieflußgrafik.
Wert: -80 ... 80, default: 0