diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 86ea1dd95..80959bcda 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -158,6 +158,8 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "1.18.0" => "07.05.2024 add secondary level of the bar chart, new attr graphicBeam3Content, graphicBeam4Content ". + "graphicBeam3Color, graphicBeam4Color, graphicBeam3FontColor, graphicBeam4FontColor ", "1.17.12"=> "06.05.2024 attr ctrlInterval: immediate impact when set ", "1.17.11"=> "04.05.2024 correction in commandref, delete attr affectMaxDayVariance ", "1.17.10"=> "19.04.2024 calcTodayPVdeviation: avoid Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1311121 ", @@ -418,6 +420,10 @@ my $b1coldef = 'FFAC63'; my $b1fontcoldef = '0D0D0D'; # default Schriftfarbe Beam 1 my $b2coldef = 'C4C4A7'; # default Farbe Beam 2 my $b2fontcoldef = '000000'; # default Schriftfarbe Beam 2 +my $b3coldef = 'BED6C0'; # default Farbe Beam 3 +my $b3fontcoldef = '000000'; # default Schriftfarbe Beam 3 +my $b4coldef = 'DBDBD0'; # default Farbe Beam 4 +my $b4fontcoldef = '000000'; # default Schriftfarbe Beam 4 my $fgCDdef = 130; # Abstand Verbrauchericons zueinander my $bPath = 'https://svn.fhem.de/trac/browser/trunk/fhem/contrib/SolarForecast/'; # Basispfad Abruf contrib SolarForecast Files @@ -1133,10 +1139,16 @@ sub Initialize { "graphicBeamWidth:slider,20,5,100 ". "graphicBeam1Color:colorpicker,RGB ". "graphicBeam2Color:colorpicker,RGB ". + "graphicBeam3Color:colorpicker,RGB ". + "graphicBeam4Color:colorpicker,RGB ". "graphicBeam1Content:pvForecast,pvReal,gridconsumption,consumptionForecast ". "graphicBeam2Content:pvForecast,pvReal,gridconsumption,consumptionForecast ". + "graphicBeam3Content:pvForecast,pvReal,gridconsumption,consumptionForecast ". + "graphicBeam4Content:pvForecast,pvReal,gridconsumption,consumptionForecast ". "graphicBeam1FontColor:colorpicker,RGB ". "graphicBeam2FontColor:colorpicker,RGB ". + "graphicBeam3FontColor:colorpicker,RGB ". + "graphicBeam4FontColor:colorpicker,RGB ". "graphicBeam1MaxVal ". "graphicEnergyUnit:Wh,kWh ". "graphicHeaderOwnspec:textField-long ". @@ -11064,6 +11076,8 @@ sub entryGraphic { fcolor2 => AttrVal ($name, 'graphicBeam2FontColor', $b2fontcoldef), beam1cont => AttrVal ($name, 'graphicBeam1Content', 'pvReal'), beam2cont => AttrVal ($name, 'graphicBeam2Content', 'pvForecast'), + beam3cont => AttrVal ($name, 'graphicBeam3Content', ''), + beam4cont => AttrVal ($name, 'graphicBeam4Content', ''), caicon => AttrVal ($name, 'consumerAdviceIcon', $caicondef), # Consumer AdviceIcon clegend => AttrVal ($name, 'consumerLegend', 'icon_top'), # Lage und Art Cunsumer Legende clink => AttrVal ($name, 'consumerLink' , 1), # Detail-Link zum Verbraucher @@ -11075,7 +11089,7 @@ sub entryGraphic { maxVal => AttrNum ($name, 'graphicBeam1MaxVal', 0), # dyn. Anpassung der Balkenhöhe oder statisch ? show_night => AttrNum ($name, 'graphicShowNight', 0), # alle Balken (Spalten) anzeigen ? show_diff => AttrVal ($name, 'graphicShowDiff', 'no'), # zusätzliche Anzeige $di{} in allen Typen - weather => AttrNum ($name, 'graphicShowWeather', 1), + weather => AttrNum ($name, 'graphicShowWeather', 1), # Wetter Icons anzeigen colorw => AttrVal ($name, 'graphicWeatherColor', $wthcolddef), # Wetter Icon Farbe Tag colorwn => AttrVal ($name, 'graphicWeatherColorNight', $wthcolndef), # Wetter Icon Farbe Nacht wlalias => AttrVal ($name, 'alias', $name), @@ -11148,20 +11162,19 @@ sub entryGraphic { $m = $paref->{modulo} % 2; - # Balkengrafik - ################ + # Balkengrafiken + ################## if ($gsel =~ /both/xs || $gsel =~ /forecast/xs) { - my %hfch; - my $hfcg = \%hfch; #(hfcg = hash forecast graphic) + my %hfcg1; # Werte aktuelle Stunde ########################## - $paref->{hfcg} = $hfcg; + $paref->{hfcg} = \%hfcg1; # (hfcg = hash forecast graphic) $paref->{thishour} = _beamGraphicFirstHour ($paref); # get consumer list and display it in Graphics ################################################ - _showConsumerInGraphicBeam ($paref); + # _showConsumerInGraphicBeam ($paref); # keine Verwendung zur Zeit # Werte restliche Stunden ########################### @@ -11174,8 +11187,39 @@ sub entryGraphic { # Balkengrafik ################ $ret .= _beamGraphic ($paref); - } + + my $secbeam = 1; + + if ($paref->{beam3cont} || $paref->{beam4cont}) { # Balkengrafik 3. und 4. Ebene + my %hfcg2; + + $paref->{beam1cont} = $paref->{beam3cont}; + $paref->{beam2cont} = $paref->{beam4cont}; + $paref->{colorb1} = AttrVal ($name, 'graphicBeam3Color', $b3coldef); + $paref->{colorb2} = AttrVal ($name, 'graphicBeam4Color', $b4coldef); + $paref->{weather} = 0; + # Werte aktuelle Stunde + ########################## + $paref->{hfcg} = \%hfcg2; + $paref->{thishour} = _beamGraphicFirstHour ($paref); + + # Werte restliche Stunden + ########################### + my $back = _beamGraphicRemainingHours ($paref); + $paref->{maxVal} = $back->{maxVal}; # Startwert wenn kein Wert bereits via attr vorgegeben ist + $paref->{maxCon} = $back->{maxCon}; + $paref->{maxDif} = $back->{maxDif}; # für Typ diff + $paref->{minDif} = $back->{minDif}; # für Typ diff + + # Balkengrafik + ################ + $ret .= _beamGraphic ($paref); + } + + $paref->{modulo}++; + } + $m = $paref->{modulo} % 2; # Flußgrafik @@ -12537,8 +12581,19 @@ sub _beamGraphicFirstHour { } $hfcg->{0}{time_str} = sprintf('%02d', $hfcg->{0}{time}-1).$hourstyle; - $hfcg->{0}{beam1} = ($beam1cont eq 'pvForecast') ? $val1 : ($beam1cont eq 'pvReal') ? $val2 : ($beam1cont eq 'gridconsumption') ? $val3 : $val4; - $hfcg->{0}{beam2} = ($beam2cont eq 'pvForecast') ? $val1 : ($beam2cont eq 'pvReal') ? $val2 : ($beam2cont eq 'gridconsumption') ? $val3 : $val4; + $hfcg->{0}{beam1} = ($beam1cont eq 'pvForecast') ? $val1 : + ($beam1cont eq 'pvReal') ? $val2 : + ($beam1cont eq 'gridconsumption') ? $val3 : + ($beam1cont eq 'consumptionForecast') ? $val4 : + undef; + $hfcg->{0}{beam2} = ($beam2cont eq 'pvForecast') ? $val1 : + ($beam2cont eq 'pvReal') ? $val2 : + ($beam2cont eq 'gridconsumption') ? $val3 : + ($beam2cont eq 'consumptionForecast') ? $val4 : + undef; + + $hfcg->{0}{beam1} //= 0; + $hfcg->{0}{beam2} //= 0; $hfcg->{0}{diff} = $hfcg->{0}{beam1} - $hfcg->{0}{beam2}; return ($thishour); @@ -12617,8 +12672,16 @@ sub _beamGraphicRemainingHours { } $hfcg->{$i}{time_str} = sprintf('%02d', $hfcg->{$i}{time}-1).$hourstyle; - $hfcg->{$i}{beam1} = ($beam1cont eq 'pvForecast') ? $val1 : ($beam1cont eq 'pvReal') ? $val2 : ($beam1cont eq 'gridconsumption') ? $val3 : $val4; - $hfcg->{$i}{beam2} = ($beam2cont eq 'pvForecast') ? $val1 : ($beam2cont eq 'pvReal') ? $val2 : ($beam2cont eq 'gridconsumption') ? $val3 : $val4; + $hfcg->{$i}{beam1} = ($beam1cont eq 'pvForecast') ? $val1 : + ($beam1cont eq 'pvReal') ? $val2 : + ($beam1cont eq 'gridconsumption') ? $val3 : + ($beam1cont eq 'consumptionForecast') ? $val4 : + undef; + $hfcg->{$i}{beam2} = ($beam2cont eq 'pvForecast') ? $val1 : + ($beam2cont eq 'pvReal') ? $val2 : + ($beam2cont eq 'gridconsumption') ? $val3 : + ($beam2cont eq 'consumptionForecast') ? $val4 : + undef; $hfcg->{$i}{beam1} //= 0; $hfcg->{$i}{beam2} //= 0; @@ -12945,8 +13008,6 @@ sub _beamGraphic { $ret .=""; } - $paref->{modulo}++; - $ret .= ""; $ret .= ""; @@ -19513,66 +19574,89 @@ to ensure that the system configuration is correct.
  • graphicBeam1Color
    - Color selection of the primary bars. + Color selection of the primary bar of the first level.
    + (default: FFAC63)

  • graphicBeam1FontColor
    - Selection of the font color of the primary bar.
    + Selection of the font color of the primary bar of the first level.
    (default: 0D0D0D)

  • - -
  • graphicBeam1Content
    - Defines the content of the primary bars to be displayed. - - -
  • -
    -
  • graphicBeam1MaxVal <0...val>
    - Setting the maximum amount of the primary bar (hourly value) to calculate the maximum bar height. - This results in an adjustment of the total allowed height of the graphic.
    - With the value "0" a dynamic adjustment takes place.
    + Definition of the maximum amount of the primary beam of the first level for calculating the maximum beam height. + height. + This results in an adjustment of the permissible total height of the graphic.
    + The value “0” is used for dynamic adjustment.
    (default: 0)

  • graphicBeam2Color
    - Color selection of the secondary bars. The second color is only useful for the display device type "pvco" and "diff". + Color selection of the secondary bars of the first level.
    + (default: C4C4A7)

  • graphicBeam2FontColor
    - Selection of the font color of the secondary bar.
    + Selection of the font color of the secondary bars of the first level.
    (default: 000000)

  • - - -
  • graphicBeam2Content
    - Legt den darzustellenden Inhalt der sekundären Balken fest. - + + +
  • graphicBeam3Color
    + Color selection of the primary bars of the second level.
    + (default: BED6C0) +
  • +
    + + +
  • graphicBeam3FontColor
    + Selection of the font color of the primary bars of the second level.
    + (default: 000000) +
  • +
    + + +
  • graphicBeam4Color
    + Color selection of the secondary bars of the second level.
    + (default: DBDBD0) +
  • +
    + + +
  • graphicBeam4FontColor
    + Selection of the font color of the secondary bars of the second level.
    + (default: 000000) +
  • +
    + + +
  • graphicBeamXContent
    + Defines the content of the bars to be displayed in the bar charts. + The bar charts are available in two levels.
    + Level 1 is preset by default. The content is determined by the attributes graphicBeam1Content and + graphicBeam2Content.
    + Level 2 of the bar charts can be activated by setting the attributes graphicBeam3Content and + graphicBeam4Content.
    + The attributes graphicBeam1Content and graphicBeam3Content represent the primary beams, the attributes + graphicBeam2Content and graphicBeam4Content attributes represent the secondary beams of the + respective level. +
  • @@ -21753,36 +21837,22 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
  • graphicBeam1Color
    - Farbauswahl der primären Balken. + Farbauswahl des primären Balken der ersten Ebene.
    + (default: FFAC63)

  • graphicBeam1FontColor
    - Auswahl der Schriftfarbe des primären Balken.
    + Auswahl der Schriftfarbe des primären Balken der ersten Ebene.
    (default: 0D0D0D)

  • - -
  • graphicBeam1Content
    - Legt den darzustellenden Inhalt der primären Balken fest. - - -
  • -
    -
  • graphicBeam1MaxVal <0...val>
    - Festlegung des maximalen Betrags des primären Balkens (Stundenwert) zur Berechnung der maximalen Balkenhöhe. + Festlegung des maximalen Betrags des primären Balkens der ersten Ebene zur Berechnung der maximalen + Balkenhöhe. Dadurch erfolgt eine Anpassung der zulässigen Gesamthöhe der Grafik.
    Mit dem Wert "0" erfolgt eine dynamische Anpassung.
    (default: 0) @@ -21791,28 +21861,64 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
  • graphicBeam2Color
    - Farbauswahl der sekundären Balken. Die zweite Farbe ist nur sinnvoll für den Anzeigedevice-Typ "pvco" und "diff". + Farbauswahl der sekundären Balken der ersten Ebene.
    + (default: C4C4A7)

  • graphicBeam2FontColor
    - Auswahl der Schriftfarbe des sekundären Balken.
    + Auswahl der Schriftfarbe der sekundären Balken der ersten Ebene.
    (default: 000000)

  • - - -
  • graphicBeam2Content
    - Legt den darzustellenden Inhalt der sekundären Balken fest. - + + +
  • graphicBeam3Color
    + Farbauswahl für die primären Balken der zweiten Ebene.
    + (default: BED6C0) +
  • +
    + + +
  • graphicBeam3FontColor
    + Auswahl der Schriftfarbe der primären Balken der zweiten Ebene.
    + (default: 000000) +
  • +
    + + +
  • graphicBeam4Color
    + Farbauswahl für die sekundären Balken der zweiten Ebene.
    + (default: DBDBD0) +
  • +
    + + +
  • graphicBeam4FontColor
    + Auswahl der Schriftfarbe der sekundären Balken der zweiten Ebene.
    + (default: 000000) +
  • +
    + + +
  • graphicBeamXContent
    + Legt den darzustellenden Inhalt der Balken in den Balkendiagrammen fest. + Die Balkendiagramme sind in zwei Ebenen verfügbar.
    + Die Ebene 1 ist im Standard voreingestellt. Der Inhalt durch die Attribute graphicBeam1Content und + graphicBeam2Content bestimmt.
    + Die Ebene 2 der Balkendiagramme kann durch Setzen der Attribute graphicBeam3Content und + graphicBeam4Content zugeschaltet werden.
    + Die Attribute graphicBeam1Content und graphicBeam3Content stellen die primären Balken, die Attribute + graphicBeam2Content und graphicBeam4Content die sekundären Balken der jeweiligen Ebene dar. +