diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 61238e680..b53e2b127 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -160,7 +160,9 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "1.49.1" => "25.03.2025 fix batteryPreferredCharge: https://forum.fhem.de/index.php?msg=1337802 ", + "1.49.2" => "26.03.2025 ___enableSwitchByBatPrioCharge: fix usage of rusulting SOC of all batteries ", + "1.49.1" => "25.03.2025 fix batteryPreferredCharge: https://forum.fhem.de/index.php?msg=1337802, Attr ctrlBackupFilesKeep is ". + "obsolete and replaced by plantControl->backupFilesKeep ", "1.49.0" => "23.03.2025 _listDataPoolApiData: fix warning item1, new option OpenMeteoDWD_D2-API with preparation for satellite support ". "add Attr graphicBeamHeightLevel3, Compatibility of Rad1h data between DWD and OpenMeteo established ". "set reset aiData deletes raw data also, _transferAPIRadiationValues: AI PV estimate limited to inverter capacity summary ". @@ -573,7 +575,6 @@ my @aconfigs = qw( affectConsForecastIdentWeekdays affectConsForecastLastDays affectSolCastPercentile aiControl consumerLegend consumerAdviceIcon consumerLink - ctrlBackupFilesKeep ctrlConsRecommendReadings ctrlGenPVdeviation ctrlInterval ctrlLanguage ctrlNextDayForecastReadings ctrlNextHoursSoCForecastReadings ctrlSolCastAPImaxReq @@ -1536,7 +1537,6 @@ sub Initialize { "consumerLegend:none,icon_top,icon_bottom,text_top,text_bottom ". "consumerAdviceIcon ". "consumerLink:0,1 ". - "ctrlBackupFilesKeep ". "ctrlConsRecommendReadings:multiple-strict,$allcs ". "ctrlDebug:multiple-strict,$dm,#10 ". "ctrlGenPVdeviation:daily,continuously ". @@ -1594,7 +1594,7 @@ sub Initialize { ### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !! ########################################################################################################################## my $av = 'obsolete#-#use#attr#plantControl#instead'; - $hash->{AttrList} .= " affectBatteryPreferredCharge:$av affectConsForecastInPlanning:$av ctrlShowLink:$av"; # 22.03.2025 + $hash->{AttrList} .= " affectBatteryPreferredCharge:$av affectConsForecastInPlanning:$av ctrlShowLink:$av ctrlBackupFilesKeep:$av"; # 22.03.2025 ########################################################################################################################## $hash->{FW_hideDisplayName} = 1; # Forum 88667 @@ -5874,7 +5874,7 @@ sub Attr { ### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !! ###################################################################################################################### - if ($cmd eq 'set' && $aName =~ /^affectBatteryPreferredCharge|affectConsForecastInPlanning|ctrlShowLink$/) { # 22.03.2025 + if ($cmd eq 'set' && $aName =~ /^affectBatteryPreferredCharge|affectConsForecastInPlanning|ctrlShowLink|ctrlBackupFilesKeep$/) { # 22.03.2025 #my $msg = "The attribute $aName is obsolete and will be deleted soon. Please press 'save config' when restart is finished."; my $msg = "The attribute $aName is replaced by 'plantControl'."; if (!$init_done) { @@ -5937,7 +5937,7 @@ sub Attr { } if ($cmd eq 'set') { - if ($aName eq 'ctrlInterval' || $aName eq 'ctrlBackupFilesKeep') { + if ($aName eq 'ctrlInterval') { unless ($aVal =~ /^[0-9]+$/x) { return qq{Invalid value for $aName. Use only figures 0-9!}; } @@ -7270,7 +7270,7 @@ sub deleteOldBckpFiles { my $name = shift; my $file = shift; - my $dfk = AttrVal ($name, 'ctrlBackupFilesKeep', 3); + my $dfk = CurrentVal ($name, 'backupFilesKeep', 3); my $bfform = $file.'_.*'; if (!opendir (DH, $cachedir)) { @@ -8014,6 +8014,16 @@ sub centralTask { } ###### + my $cbk = AttrVal ($name, 'ctrlBackupFilesKeep', undef); # 25.03.2025 + my $pc3 = AttrVal ($name, 'plantControl', ''); + + if (defined $cbk) { + my $newval = $pc3." backupFilesKeep=$cbk"; + CommandAttr (undef, "$name plantControl $newval"); + ::CommandDeleteAttr (undef, "$name ctrlBackupFilesKeep"); + } + ###### + my $n = 0; # 01.02.25 -> Datenmigration pvrlsum, pvfcsum, dnumsum in pvrl_*, pvfc_* for my $hh (1..24) { $hh = sprintf "%02d", $hh; @@ -8655,8 +8665,8 @@ sub _specialActivities { Log3 ($name, 4, "$name - Daily special tasks - Task 5 started"); - if (AttrVal ($name, 'ctrlBackupFilesKeep', 3)) { - periodicWriteMemcache ($hash, 'bckp'); # Backup Files erstellen und alte Versionen löschen (unterbleibt bei ctrlBackupFilesKeep == 0) + if (CurrentVal ($name, 'backupFilesKeep', 3)) { + periodicWriteMemcache ($hash, 'bckp'); # Backup Files erstellen und alte Versionen löschen (unterbleibt bei 'backupFilesKeep' == 0) } Log3 ($name, 4, "$name - Daily special tasks - Task 5 finished"); @@ -10250,8 +10260,12 @@ sub _transferBatteryValues { } if ($num) { - my $soctotal = sprintf "%.0f", ($socwhsum / $bcapsum * 100) if($bcapsum); # resultierender SoC (%) aller Batterien als "eine" - push @{$data{$name}{current}{batsocslidereg}}, $soctotal; # Schieberegister average SOC aller Batterien + if ($bcapsum) { + my $soctotal = sprintf "%.0f", ($socwhsum / $bcapsum * 100); # resultierender SoC (%) aller Batterien als "eine" + $data{$name}{current}{batsoctotal} = $soctotal; + push @{$data{$name}{current}{batsocslidereg}}, $soctotal; # Schieberegister average SOC aller Batterien + } + limitArray ($data{$name}{current}{batsocslidereg}, SLIDENUMMAX); $data{$name}{current}{batpowerinsum} = $pbisum; # summarische laufende Batterieladung @@ -12452,7 +12466,7 @@ sub ___enableSwitchByBatPrioCharge { return $ena if(!$pcb || !$badev); # Freigabe Schalten Consumer wenn kein Prefered Battery/Soll-Ladung 0 oder keine Batterie installiert - my $bcharge = BatteryVal ($name, '01', 'bcharge', 0); # aktuelle Ladung in % + my $bcharge = CurrentVal ($name, 'batsoctotal', 0); # resultierender SoC (%) aller Batterien als Cluster $ena = 0 if($bcharge < $pcb); # keine Freigabe wenn Batterieladung kleiner Soll-Ladung return $ena; @@ -16162,10 +16176,8 @@ sub _flowGraphic { ## definierte Batterien ermitteln und zusammenfassen ###################################################### my ($batin, $bat2home); - my $socwhsum = 0; - my $soc = 0; - for my $bn (1..MAXBATTERIES) { # für jede definierte Batterie + for my $bn (1..MAXBATTERIES) { # für jede definierte Batterie $bn = sprintf "%02d", $bn; my ($err, $badev, $h) = isDeviceValid ( { name => $name, obj => 'setupBatteryDev'.$bn, method => 'attr' } ); next if($err); @@ -16174,12 +16186,9 @@ sub _flowGraphic { my $bat2homepow = ReadingsNum ($name, 'Current_PowerBatOut_'.$bn, undef); $batin += $batinpow if(defined $batinpow); $bat2home += $bat2homepow if(defined $bat2homepow); - - $socwhsum += BatteryVal ($name, $bn, 'bchargewh', 0); # Batterie SoC in Wh } - - my $batcapsum = CurrentVal ($hash, 'batcapsum', 0); # Summe installierte Batterie Kapazität - $soc = sprintf "%.0f", ($socwhsum / $batcapsum * 100) if($batcapsum); # resultierender SoC (%) aller Batterien als Cluster + + my $soc = CurrentVal ($hash, 'batsoctotal', 0); # resultierender SoC (%) aller Batterien als Cluster if (!defined $batin && !defined $bat2home) { $hasbat = 0; @@ -16187,7 +16196,7 @@ sub _flowGraphic { $bat2home = 0; $soc = 0; } - + debugLog ($paref, 'graphic', "Battery initial summary - batin: $batin, bat2home: $bat2home"); ## Resultierende von Laden und Entladen berechnen @@ -23191,16 +23200,16 @@ to ensure that the system configuration is correct.
@@ -24239,16 +24248,6 @@ to ensure that the system configuration is correct.
- -
  • ctrlBackupFilesKeep <Integer>
    - Defines the number of generations of backup files - (see also set <name> operatingMemory backup).
    - If ctrlBackupFilesKeep explit is set to '0', no automatic generation and cleanup of backup files takes place.
    - Manual execution with the aforementioned set command is still possible.
    - (default: 3) -
  • -
    -
  • ctrlBatSocManagementXX lowSoc=<Value> upSoC=<Value> [maxSoC=<Value>] [careCycle=<Value>]

    If a battery device (setupBatteryDevXX) is installed, this attribute activates the battery SoC management for this @@ -24920,12 +24919,18 @@ to ensure that the system configuration is correct. showLink Display of a link to the detailed view of the device above the graphics area 0 - Display off, 1 - Display on, default: 0 + backupFilesKeep Defines the number of generations of backup files. + (see set <name> operatingMemory backup) + If ctrlBackupFilesKeep explit is set to '0', no automatic generation and cleanup of backup files takes place. + Manual execution with the aforementioned set command is still possible. + Wert: Integer, default: 3 +
  • @@ -25695,16 +25700,16 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
    @@ -26750,16 +26755,6 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
    - -
  • ctrlBackupFilesKeep <Ganzzahl>
    - Legt die Anzahl der Generationen von Sicherungsdateien - (siehe set <name> operatingMemory backup) fest.
    - Ist ctrlBackupFilesKeep explit auf '0' gesetzt, erfolgt keine automatische Generierung und Bereinigung von Sicherungsdateien.
    - Eine manuelle Ausführung mit dem genannten Set-Kommando ist weiterhin möglich.
    - (default: 3) -
  • -
    -
  • ctrlBatSocManagementXX lowSoc=<Wert> upSoC=<Wert> [maxSoC=<Wert>] [careCycle=<Wert>]

    Sofern ein Batterie Device (setupBatteryDevXX) installiert ist, aktiviert dieses Attribut das Batterie @@ -27413,28 +27408,34 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.