From a80ce095ab1d6c6aa149574dc999529fefd25cd0 Mon Sep 17 00:00:00 2001 From: DS_Starter Date: Wed, 27 Oct 2021 16:43:44 +0000 Subject: [PATCH] 76_SolarForecast.pm: contrib 0.56.9 git-svn-id: https://svn.fhem.de/fhem/trunk@25132 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 60 ++++++++++++++------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index eb9fb6efa..505b0bc12 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -120,6 +120,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "0.56.9" => "27.10.2021 change sub _flowGraphic (Max) ", "0.56.8" => "25.10.2021 change func ___csmSpecificEpieces as proposed from Max : https://forum.fhem.de/index.php/topic,117864.msg1180452.html#msg1180452 ", "0.56.7" => "18.10.2021 new attr flowGraphicShowConsumerDummy ", "0.56.6" => "19.09.2021 bug fix ", @@ -5263,23 +5264,20 @@ sub _flowGraphic { my $css = $paref->{css}; my $style = 'width:'.$flowgh.'px; height:'.$flowgh.'px;'; + my $animation = $flowgani ? '@keyframes dash { to { stroke-dashoffset: 0; } }' : ''; # Animation Ja/Nein my $cpv = ReadingsNum($name, 'Current_PV', 0); - my $sun_color = $cpv ? 'flowg sun_active' : 'flowg sun_inactive'; my $cgc = ReadingsNum($name, 'Current_GridConsumption', 0); - my $cgc_style = $cgc ? 'flowg active_in' : 'flowg inactive_in'; my $cgfi = ReadingsNum($name, 'Current_GridFeedIn', 0); - my $cgfi_style = $cgfi ? 'flowg active_out' : 'flowg inactive_out'; my $csc = ReadingsNum($name, 'Current_SelfConsumption', 0); - my $csc_style = $csc ? 'flowg active_out' : 'flowg inactive_out'; my $cc = ReadingsNum($name, 'Current_Consumption', 0); my $cc_dummy = $cc; - + my $batin = ReadingsNum($name, 'Current_PowerBatIn', undef); my $batout = ReadingsNum($name, 'Current_PowerBatOut', undef); my $soc = ReadingsNum($name, 'Current_BatCharge', 100); @@ -5297,15 +5295,41 @@ sub _flowGraphic { $soc = 0; } - if($batout) { - $csc -= $batout; - $csc_style = $csc ? 'flowg active_out' : 'flowg inactive_out'; - } + my $grid_color = $cgfi ? 'flowg grid_color1' : 'flowg grid_color2'; + $grid_color = 'flowg grid_color3' if (!$cgfi && !$cgc && $batout); # dritte Farbe + my $cgc_style = $cgc ? 'flowg active_in' : 'flowg inactive_in'; + my $batout_style = $batout ? 'flowg active_out active_bat_out' : 'flowg inactive_in'; + + my $cgc_direction = 'M490,305 L670,510'; # Batterientladung ins Netz + + if($batout) { + my $cgfo = $cgfi - $cpv; - my $batin_style = $batin ? 'flowg active_in active_bat_in' : 'flowg inactive_out'; - my $batout_style = $batout ? 'flowg active_out active_bat_out' : 'flowg inactive_in'; - my $grid_color = $cgfi ? 'flowg grid_color1' : 'flowg grid_color2'; - $grid_color = 'flowg grid_color3' if (!$cgfi && !$cgc && $batout); # dritte Farbe + if($cgfo > 1) { + $cgc_style = 'flowg active_out'; + $cgc_direction = 'M670,510 L490,305'; + $cgfi -= $cgfo; + $cgc = $cgfo; + } + } + + my $batout_direction = 'M902,305 L730,510'; # Batterientladung aus Netz + + if($batin) { + my $gbi = $batin - $cpv; + + if($gbi > 1) { + $batin -= $gbi; + $batout_style = 'flowg active_in'; + $batout_direction = 'M730,510 L902,305'; + $batout = $gbi; + } + } + + my $sun_color = $cpv ? 'flowg sun_active' : 'flowg sun_inactive'; + my $batin_style = $batin ? 'flowg active_in active_bat_in' : 'flowg inactive_out'; + my $csc_style = $csc && $cpv ? 'flowg active_out' : 'flowg inactive_out'; + my $cgfi_style = $cgfi ? 'flowg active_out' : 'flowg inactive_out'; my $ret = << "END0";