From 986c02cadab36ee4f55c0177c9111349dea6feef Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Tue, 25 Mar 2025 21:11:15 +0000 Subject: [PATCH] 76_SolarForecast: fix batteryPreferredCharge consideration git-svn-id: https://svn.fhem.de/fhem/trunk@29788 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/76_SolarForecast.pm | 135 +++++++++++++++++----------------- 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/fhem/FHEM/76_SolarForecast.pm b/fhem/FHEM/76_SolarForecast.pm index 61238e680..7d03e8cb5 100644 --- a/fhem/FHEM/76_SolarForecast.pm +++ b/fhem/FHEM/76_SolarForecast.pm @@ -160,7 +160,8 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "1.49.1" => "25.03.2025 fix batteryPreferredCharge: https://forum.fhem.de/index.php?msg=1337802 ", + "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 +574,6 @@ my @aconfigs = qw( affectConsForecastIdentWeekdays affectConsForecastLastDays affectSolCastPercentile aiControl consumerLegend consumerAdviceIcon consumerLink - ctrlBackupFilesKeep ctrlConsRecommendReadings ctrlGenPVdeviation ctrlInterval ctrlLanguage ctrlNextDayForecastReadings ctrlNextHoursSoCForecastReadings ctrlSolCastAPImaxReq @@ -1536,7 +1536,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 +1593,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 +5873,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 +5936,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 +7269,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 +8013,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 +8664,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"); @@ -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.