76_SolarForecast: attr ctrlInterval: immediate impact when set
git-svn-id: https://svn.fhem.de/fhem/trunk@28843 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -158,6 +158,8 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"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 ",
|
"1.17.10"=> "19.04.2024 calcTodayPVdeviation: avoid Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1311121 ",
|
||||||
"1.17.9" => "17.04.2024 _batSocTarget: fix Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1310930 ",
|
"1.17.9" => "17.04.2024 _batSocTarget: fix Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1310930 ",
|
||||||
"1.17.8" => "16.04.2024 calcTodayPVdeviation: change of calculation ",
|
"1.17.8" => "16.04.2024 calcTodayPVdeviation: change of calculation ",
|
||||||
@@ -1094,7 +1096,6 @@ sub Initialize {
|
|||||||
"affectBatteryPreferredCharge:slider,0,1,100 ".
|
"affectBatteryPreferredCharge:slider,0,1,100 ".
|
||||||
"affectConsForecastIdentWeekdays:1,0 ".
|
"affectConsForecastIdentWeekdays:1,0 ".
|
||||||
"affectConsForecastInPlanning:1,0 ".
|
"affectConsForecastInPlanning:1,0 ".
|
||||||
"affectMaxDayVariance:obsolete ".
|
|
||||||
"affectSolCastPercentile:select,10,50,90 ".
|
"affectSolCastPercentile:select,10,50,90 ".
|
||||||
"consumerLegend:none,icon_top,icon_bottom,text_top,text_bottom ".
|
"consumerLegend:none,icon_top,icon_bottom,text_top,text_bottom ".
|
||||||
"consumerAdviceIcon ".
|
"consumerAdviceIcon ".
|
||||||
@@ -5304,14 +5305,14 @@ sub Attr {
|
|||||||
|
|
||||||
### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !!
|
### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !!
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
if ($cmd eq 'set' && $aName eq 'affectMaxDayVariance') {
|
#if ($cmd eq 'set' && $aName eq 'affectMaxDayVariance') {
|
||||||
if (!$init_done) {
|
# if (!$init_done) {
|
||||||
return qq{Device "$name" -> The attribute '$aName' is obsolete and will be deleted soon. Please press "save config" when restart is finished.};
|
# return qq{Device "$name" -> The attribute '$aName' is obsolete and will be deleted soon. Please press "save config" when restart is finished.};
|
||||||
}
|
# }
|
||||||
else {
|
# else {
|
||||||
return qq{The attribute '$aName' is obsolete and will be deleted soon.};
|
# return qq{The attribute '$aName' is obsolete and will be deleted soon.};
|
||||||
}
|
# }
|
||||||
}
|
#}
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
|
|
||||||
if ($aName eq 'disable') {
|
if ($aName eq 'disable') {
|
||||||
@@ -5379,16 +5380,23 @@ sub Attr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($init_done == 1 && $aName eq "ctrlSolCastAPIoptimizeReq") {
|
if ($init_done && $aName eq 'ctrlSolCastAPIoptimizeReq') {
|
||||||
if (!isSolCastUsed ($hash)) {
|
if (!isSolCastUsed ($hash)) {
|
||||||
return qq{The attribute $aName is only valid for device model "SolCastAPI".};
|
return qq{The attribute $aName is only valid for device model "SolCastAPI".};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aName eq 'ctrlUserExitFn' && $init_done) {
|
if ($init_done && $aName eq 'ctrlUserExitFn') {
|
||||||
($err) = checkCode ($name, $aVal, 'cc1');
|
($err) = checkCode ($name, $aVal, 'cc1');
|
||||||
return $err if($err);
|
return $err if($err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($init_done && $aName eq 'ctrlInterval') {
|
||||||
|
_newCycTime ($hash, time, $aVal);
|
||||||
|
my $nct = CurrentVal ($hash, 'nextCycleTime', 0); # gespeicherte nächste CyleTime
|
||||||
|
readingsSingleUpdate ($hash, 'nextCycletime', (!$nct ? 'Manual' : FmtTime($nct)), 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $params = {
|
my $params = {
|
||||||
@@ -6149,12 +6157,7 @@ sub runTask {
|
|||||||
my $nct = CurrentVal ($hash, 'nextCycleTime', 0); # gespeicherte nächste CyleTime
|
my $nct = CurrentVal ($hash, 'nextCycleTime', 0); # gespeicherte nächste CyleTime
|
||||||
|
|
||||||
if ($t >= $nct) {
|
if ($t >= $nct) {
|
||||||
my $new = $t + $interval; # nächste Wiederholungszeit
|
_newCycTime ($hash, $t, $interval);
|
||||||
$hash->{MODE} = 'Automatic - next Cycletime: '.FmtTime($new);
|
|
||||||
|
|
||||||
$data{$hash->{TYPE}}{$name}{current}{nextCycleTime} = $new;
|
|
||||||
|
|
||||||
storeReading ('nextCycletime', FmtTime($new));
|
|
||||||
centralTask ($hash, 1);
|
centralTask ($hash, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6193,6 +6196,30 @@ sub runTask {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# neue Zykluszeit bestimmen
|
||||||
|
################################################################
|
||||||
|
sub _newCycTime {
|
||||||
|
my $hash = shift;
|
||||||
|
my $t = shift;
|
||||||
|
my $interval = shift;
|
||||||
|
|
||||||
|
if (!$interval) {
|
||||||
|
$hash->{MODE} = 'Manual';
|
||||||
|
$data{$hash->{TYPE}}{$hash->{NAME}}{current}{nextCycleTime} = 0;
|
||||||
|
storeReading ('nextCycletime', 'Manual');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $new = $t + $interval; # nächste Wiederholungszeit
|
||||||
|
$hash->{MODE} = 'Automatic - next Cycletime: '.FmtTime($new);
|
||||||
|
|
||||||
|
$data{$hash->{TYPE}}{$hash->{NAME}}{current}{nextCycleTime} = $new;
|
||||||
|
storeReading ('nextCycletime', FmtTime($new));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# neue Attribute zur Laufzeit hinzufügen
|
# neue Attribute zur Laufzeit hinzufügen
|
||||||
# Device spezifische ".AttrList" überschreibt Modul AttrList !
|
# Device spezifische ".AttrList" überschreibt Modul AttrList !
|
||||||
@@ -6257,32 +6284,8 @@ sub centralTask {
|
|||||||
|
|
||||||
### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !!
|
### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !!
|
||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
my $nscc = ReadingsVal ($name, 'nextSolCastCall', ''); # 14.03.2024
|
|
||||||
if ($nscc) {
|
|
||||||
readingsSingleUpdate ($hash, 'nextRadiationAPICall', $nscc, 0);
|
|
||||||
deleteReadingspec ($hash, 'nextSolCastCall');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keys %{$data{$type}{$name}{aidectree}{airaw}}) { # 27.03.2024
|
##########################################################################################################################
|
||||||
for my $idx (sort keys %{$data{$type}{$name}{aidectree}{airaw}}) {
|
|
||||||
my $val = AiRawdataVal ($hash, $idx, 'rad1h', undef);
|
|
||||||
|
|
||||||
if (!defined $val) {
|
|
||||||
delete $data{$type}{$name}{aidectree}{airaw}{$idx};
|
|
||||||
$val = 'aaaaaaaaaa';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($val =~ /\.[0-9]{1}$/xs) {
|
|
||||||
delete $data{$type}{$name}{aidectree}{airaw}{$idx};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($val =~ /\.00$/xs) {
|
|
||||||
my $renv = int $val;
|
|
||||||
$data{$type}{$name}{aidectree}{airaw}{$idx}{rad1h} = $renv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#######################################################################################################################
|
|
||||||
|
|
||||||
setModel ($hash); # Model setzen
|
setModel ($hash); # Model setzen
|
||||||
|
|
||||||
@@ -14078,14 +14081,6 @@ sub aiAddRawData {
|
|||||||
my $rad1h = HistoryVal ($hash, $pvd, $hod, 'rad1h', undef);
|
my $rad1h = HistoryVal ($hash, $pvd, $hod, 'rad1h', undef);
|
||||||
next if(!$rad1h || $rad1h <= 0);
|
next if(!$rad1h || $rad1h <= 0);
|
||||||
|
|
||||||
### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !!
|
|
||||||
#######################################################################################################################
|
|
||||||
next if($rad1h =~ /\.[0-9]{1}$/xs); # 29.03.2024 -> einen Monat drin lassen wegen pvHistory turn
|
|
||||||
if ($rad1h =~ /\.00$/xs) { # 29.03.2024 -> einen Monat drin lassen wegen pvHistory turn
|
|
||||||
$rad1h = int $rad1h;
|
|
||||||
}
|
|
||||||
#######################################################################################################################
|
|
||||||
|
|
||||||
my $pvrl = HistoryVal ($hash, $pvd, $hod, 'pvrl', undef);
|
my $pvrl = HistoryVal ($hash, $pvd, $hod, 'pvrl', undef);
|
||||||
next if(!$pvrl || $pvrl <= 0);
|
next if(!$pvrl || $pvrl <= 0);
|
||||||
|
|
||||||
@@ -17905,8 +17900,8 @@ to ensure that the system configuration is correct.
|
|||||||
<b>Example: </b> <br>
|
<b>Example: </b> <br>
|
||||||
set <name> currentInverterDev STP5000 pv=total_pac:kW etotal=etotal:kWh capacity=5000 <br>
|
set <name> currentInverterDev STP5000 pv=total_pac:kW etotal=etotal:kWh capacity=5000 <br>
|
||||||
<br>
|
<br>
|
||||||
# Device STP5000 provides PV values. The current generated power in the reading "total_pac" (kW) and the daily generation in the reading "etotal" (kWh).
|
# Device STP5000 provides PV values. The currently generated power in the "total_pac" reading (kW) and the total energy
|
||||||
The maximum power of the inverter is 5000 Watt.
|
generated in the reading "etotal" (kWh). The maximum output of the inverter is 5000 watts.
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -20134,7 +20129,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
|
|||||||
<b>Beispiel: </b> <br>
|
<b>Beispiel: </b> <br>
|
||||||
set <name> currentInverterDev STP5000 pv=total_pac:kW etotal=etotal:kWh capacity=5000 <br>
|
set <name> currentInverterDev STP5000 pv=total_pac:kW etotal=etotal:kWh capacity=5000 <br>
|
||||||
<br>
|
<br>
|
||||||
# Device STP5000 liefert PV-Werte. Die aktuell erzeugte Leistung im Reading "total_pac" (kW) und die tägliche Erzeugung im
|
# Device STP5000 liefert PV-Werte. Die aktuell erzeugte Leistung im Reading "total_pac" (kW) und die erzeugte Gesamtenergie im
|
||||||
Reading "etotal" (kWh). Die max. Leistung des Wechselrichters beträgt 5000 Watt.
|
Reading "etotal" (kWh). Die max. Leistung des Wechselrichters beträgt 5000 Watt.
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user