diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm
index 8e08bee3d..8b5769c8d 100644
--- a/fhem/contrib/DS_Starter/76_SolarForecast.pm
+++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm
@@ -153,7 +153,7 @@ BEGIN {
# Versions History intern
my %vNotesIntern = (
- "1.6.0" => "12.12.2023 store daily batmaxsoc in pvHistory, new attr ctrlBatSocManagement, reading Battery_OptimumTargetSoC ".
+ "1.6.0" => "18.12.2023 store daily batmaxsoc in pvHistory, new attr ctrlBatSocManagement, reading Battery_OptimumTargetSoC ".
"currentBatteryDev: new optional key 'cap', adapt cloud2bin,temp2bin,rain2bin ".
"minor internal changes, isAddSwitchOffCond: change hysteresis algo, ctrlDebug: new entry batteryManagement ",
"1.5.1" => "07.12.2023 function _getftui can now process arguments (compatibility to new ftui widgets), plant check ".
@@ -712,6 +712,14 @@ my %hqtxt = (
DE => qq{Auto} },
lupt => { EN => qq{last update:},
DE => qq{Stand:} },
+ object => { EN => qq{Object},
+ DE => qq{Prüfobjekt} },
+ state => { EN => qq{Status},
+ DE => qq{Status} },
+ result => { EN => qq{Result},
+ DE => qq{Ergebnis} },
+ note => { EN => qq{Note},
+ DE => qq{Hinweis} },
wfmdcf => { EN => qq{Wait for more days with a consumption figure},
DE => qq{Warte auf weitere Tage mit einer Verbrauchszahl} },
autoct => { EN => qq{Autocorrection:},
@@ -1005,6 +1013,7 @@ my %hcsr = (
todayGridConsumption => { fnr => 4, fn => \&CircularVal, par => 99, unit => '', def => 0 },
todayBatIn => { fnr => 4, fn => \&CircularVal, par => 99, unit => '', def => 0 },
todayBatOut => { fnr => 4, fn => \&CircularVal, par => 99, unit => '', def => 0 },
+ daysUntilBatteryCare => { fnr => 4, fn => \&CircularVal, par => 99, unit => '', def => '-' },
todayConsumptionForecast => { fnr => 4, fn => \&NexthoursVal, par => 'confc', unit => ' Wh', def => '-' },
conForecastTillNextSunrise => { fnr => 4, fn => \&NexthoursVal, par => 'confc', unit => ' Wh', def => 0 },
);
@@ -2603,7 +2612,7 @@ sub __getSolCastData {
## (solCastAPIcallMultiplier, todayMaxAPIcalls) berechnen
##########################################################
my %mx;
- my $maxcnt;
+ my $maxcnt = 1;
my $type = $paref->{type};
@@ -2617,7 +2626,7 @@ sub __getSolCastData {
my $apimaxreq = AttrVal ($name, 'ctrlSolCastAPImaxReq', $apimaxreqdef);
my $madc = sprintf "%.0f", ($apimaxreq / $maxcnt); # max. tägliche Anzahl API Calls
- my $mpk = $maxcnt // 1; # Requestmultiplikator
+ my $mpk = $maxcnt; # Requestmultiplikator
$data{$type}{$name}{solcastapi}{'?All'}{'?All'}{solCastAPIcallMultiplier} = $mpk;
$data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayMaxAPIcalls} = $madc;
@@ -5873,13 +5882,15 @@ sub ___readCandQ {
($hc, $hq) = CircularAutokorrVal ($hash, sprintf("%02d",$fh1), $range, undef); # Korrekturfaktor/Qualität der Stunde des Tages (complex)
$hq //= '-';
$hc //= 1; # Korrekturfaktor = 1 (keine Korrektur) # keine Qualität definiert
-
+ $hc = 1 if(1 * $hc == 0); # 0.0-Werte ignorieren (Schleifengefahr)
+
$data{$type}{$name}{nexthours}{"NextHour".sprintf("%02d",$num)}{cloudrange} = $range;
}
elsif ($acu =~ /on_simple/xs) {
($hc, $hq) = CircularAutokorrVal ($hash, sprintf("%02d",$fh1), 'percentile', undef); # Korrekturfaktor/Qualität der Stunde des Tages (simple)
$hq //= '-';
$hc //= 1; # Korrekturfaktor = 1
+ $hc = 1 if(1 * $hc == 0); # 0.0-Werte ignorieren (Schleifengefahr)
}
else { # keine Autokorrektur
($hc, $hq) = CircularAutokorrVal ($hash, sprintf("%02d",$fh1), 'percentile', undef); # Korrekturfaktor/Qualität der Stunde des Tages (simple)
@@ -6424,9 +6435,9 @@ sub _batSocTarget {
return if(!isBatteryUsed ($name));
- my $oldd2care = CircularVal ($hash, 99, 'days2care', 0);
+ my $oldd2care = CircularVal ($hash, 99, 'days2care', 0);
my $ltsmsr = CircularVal ($hash, 99, 'lastTsMaxSocRchd', undef);
- my $batcharge = CurrentVal ($hash, 'batcharge', 0); # aktuelle Ladung in %
+ my $batcharge = CurrentVal ($hash, 'batcharge', 0); # aktuelle Ladung in %
__batSaveSocKeyFigures ($paref) if(!$ltsmsr || $batcharge >= $maxSoCdef || $oldd2care < 0);
@@ -6483,9 +6494,17 @@ sub _batSocTarget {
my $careSoc = $maxsoc - ($days2care * $batSocChgDay); # Pflege-SoC um rechtzeitig den $maxsoc zu erreichen bei 5% Steigerung pro Tag
$target = $careSoc < $target ? $target : $careSoc; # resultierender Target-SoC unter Berücksichtigung $caresoc
- $target = sprintf "%.0f", $target;
- debugLog ($paref, 'batteryManagement', "SoC calc Step4 - note remaining days until care SoC -> Target: $target %");
+ debugLog ($paref, 'batteryManagement', "SoC calc Step4 - note remaining days >$days2care< until care SoC -> Target: $target %");
+
+ ## auf 5er Schritte anpassen (40,45,50,...)
+ #############################################
+ my $flo = floor ($target / 5);
+ my $rmn = $target - ($flo * 5);
+ my $add = $rmn <= 2.5 ? 0 : 5;
+ $target = ($flo * 5) + $add;
+
+ debugLog ($paref, 'batteryManagement', "SoC calc Step5 - rounding the SoC to steps of 5 -> Target: $target %");
## pvHistory/Readings schreiben
#################################
@@ -8368,6 +8387,12 @@ sub genStatisticReadings {
storeReading ('statistic_'.$kpi, $rtaitr);
}
+
+ if ($kpi eq 'daysUntilBatteryCare') {
+ my $d2c = &{$hcsr{$kpi}{fn}} ($hash, $hcsr{$kpi}{par}, 'days2care', $def);
+
+ storeReading ('statistic_'.$kpi, $d2c);
+ }
if ($kpi eq 'todayGridFeedIn') {
my $idfi = &{$hcsr{$kpi}{fn}} ($hash, $hcsr{$kpi}{par}, 'initdayfeedin', $def); # initialer Tagesstartwert
@@ -13348,18 +13373,17 @@ sub checkPlantConfig {
## Ausgabe
############
-
my $out = qq{};
$out .= qq{}.$hqtxt{plntck}{$lang}.qq{
};
$out .= qq{