2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-26 10:34:52 +00:00

76_SolarForecast: new consumer key exconfc

git-svn-id: https://svn.fhem.de/fhem/trunk@28973 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2024-06-15 19:50:24 +00:00
parent ff89837cf5
commit 5d39256a92
3 changed files with 503 additions and 476 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it
- feature: 76_SolarForecast: new consumer key exconfc
- change: 76_SolarForecast: set modulePeakString to attr setupStringPeak
!NOTE! save FHEM config after restart
- change: 76_SolarForecast: set currentRadiationAPI to attr setupRadiationAPI

View File

@ -157,6 +157,7 @@ BEGIN {
# Versions History intern
my %vNotesIntern = (
"1.28.0" => "15.06.2024 new consumer key exconfc, Forum: https://forum.fhem.de/index.php?msg=1315111 ",
"1.27.0" => "12.06.2024 __VictronVRM_ApiResponseLogin: check token not empty ".
"transformed setter modulePeakString to attr setupStringPeak ",
"1.26.0" => "10.06.2024 transformed setter currentRadiationAPI to attr setupRadiationAPI ",
@ -6887,6 +6888,11 @@ sub _collectAllRegConsumers {
$noshow = $hc->{noshow};
}
my $exconfc;
if (exists $hc->{exconfc}) { # Consumer Verbrauch von Erstelleung der Verbrauchsprognose ausschließen
$exconfc = $hc->{exconfc};
}
my ($rswstate,$onreg,$offreg);
if(exists $hc->{swstate}) {
($rswstate,$onreg,$offreg) = split ":", $hc->{swstate};
@ -6959,6 +6965,7 @@ sub _collectAllRegConsumers {
$data{$type}{$name}{consumers}{$c}{rswstate} = $rswstate // 'state'; # Schaltstatus Reading
$data{$type}{$name}{consumers}{$c}{asynchron} = $asynchron // 0; # Arbeitsweise FHEM Consumer Device
$data{$type}{$name}{consumers}{$c}{noshow} = $noshow // 0; # ausblenden in Grafik
$data{$type}{$name}{consumers}{$c}{exconfc} = $exconfc // 0; # Verbrauch von Erstelleung der Verbrauchsprognose ausschließen
$data{$type}{$name}{consumers}{$c}{locktime} = $clt // '0:0'; # Sperrzeit im Automatikmodus ('offlt:onlt')
$data{$type}{$name}{consumers}{$c}{onreg} = $onreg // 'on'; # Regex für 'ein'
$data{$type}{$name}{consumers}{$c}{offreg} = $offreg // 'off'; # Regex für 'aus'
@ -10423,7 +10430,7 @@ sub _estConsumptionForecast {
my $totcon = 0;
my $dnum = 0;
debugLog ($paref, "consumption", "################### Consumption forecast for the next day ###################");
debugLog ($paref, 'consumption', "################### Consumption forecast for the next day ###################");
for my $n (sort{$a<=>$b} keys %{$data{$type}{$name}{pvhist}}) {
next if ($n eq $day); # aktuellen (unvollständigen) Tag nicht berücksichtigen
@ -10436,7 +10443,7 @@ sub _estConsumptionForecast {
my $dcon = HistoryVal ($hash, $n, 99, 'con', 0);
next if(!$dcon);
debugLog ($paref, "consumption", "History Consumption day >$n<: $dcon");
debugLog ($paref, 'consumption', "History Consumption day >$n<: $dcon");
$totcon += $dcon;
$dnum++;
@ -10446,7 +10453,7 @@ sub _estConsumptionForecast {
my $tomavg = int ($totcon / $dnum);
$data{$type}{$name}{current}{tomorrowconsumption} = $tomavg; # prognostizierter Durchschnittsverbrauch aller (gleicher) Wochentage
debugLog ($paref, "consumption", "estimated Consumption for tomorrow: $tomavg, days for avg: $dnum");
debugLog ($paref, 'consumption', "estimated Consumption for tomorrow: $tomavg, days for avg: $dnum");
}
else {
my $lang = $paref->{lang};
@ -10471,7 +10478,7 @@ sub _estConsumptionForecast {
"21" => 0, "22" => 0, "23" => 0, "24" => 0,
};
debugLog ($paref, "consumption", "################### Consumption forecast for the next hours ###################");
debugLog ($paref, 'consumption', "################### Consumption forecast for the next hours ###################");
for my $k (sort keys %{$data{$type}{$name}{nexthours}}) {
my $nhtime = NexthoursVal ($hash, $k, "starttime", undef); # Startzeit
@ -10495,7 +10502,16 @@ sub _estConsumptionForecast {
next if(!$hcon);
for my $c (sort{$a<=>$b} keys %{$acref}) { # historischer Verbrauch aller registrierten Verbraucher aufaddieren
$consumerco += HistoryVal ($hash, $m, $nhhr, "csme${c}", 0);
my $exconfc = ConsumerVal ($hash, $c, 'exconfc', 0); # 1 -> Consumer Verbrauch von Erstelleung der Verbrauchsprognose ausschließen
my $csme = HistoryVal ($hash, $m, $nhhr, "csme${c}", 0);
if ($exconfc) {
debugLog ($paref, 'consumption', "Consumer '$c' values excluded from forecast calculation by 'exconfc' - day: $m, hour: $nhhr, csme: $csme");
$hcon -= $csme;
next;
}
$consumerco += $csme;
}
$conhex->{$nhhr} += $hcon - $consumerco if($hcon >= $consumerco); # prognostizierter Verbrauch Ex registrierter Verbraucher
@ -10513,7 +10529,7 @@ sub _estConsumptionForecast {
writeToHistory ( { paref => $paref, key => 'confc', val => $conavg, hour => $nhhr } );
}
debugLog ($paref, "consumption", "estimated Consumption for $nhday -> starttime: $nhtime, confc: $conavg, days for avg: $dnum, hist. consumption registered consumers: ".sprintf "%.2f", $consumerco);
debugLog ($paref, 'consumption', "estimated Consumption for $nhday -> starttime: $nhtime, confc: $conavg, days for avg: $dnum, hist. consumption registered consumers: ".sprintf "%.2f", $consumerco);
}
}
@ -19169,7 +19185,7 @@ to ensure that the system configuration is correct.
[notbefore=&lt;Expression&gt;] [notafter=&lt;Expression&gt;] [locktime=&lt;offlt&gt;[:&lt;onlt&gt;]] <br>
[auto=&lt;Readingname&gt;] [pcurr=&lt;Readingname&gt;:&lt;Unit&gt;[:&lt;Threshold&gt]] [etotal=&lt;Readingname&gt;:&lt;Einheit&gt;[:&lt;Threshold&gt]] <br>
[swoncond=&lt;Device&gt;:&lt;Reading&gt;:&lt;Regex&gt] [swoffcond=&lt;Device&gt;:&lt;Reading&gt;:&lt;Regex&gt] [spignorecond=&lt;Device&gt;:&lt;Reading&gt;:&lt;Regex&gt] <br>
[interruptable=&lt;Option&gt] [noshow=&lt;Option&gt] </b><br>
[interruptable=&lt;Option&gt] [noshow=&lt;Option&gt] [exconfc=&lt;Option&gt] </b><br>
<br>
Registers a consumer &lt;Device Name&gt; with the SolarForecast Device. In this case, &lt;Device Name&gt;
@ -19322,6 +19338,10 @@ to ensure that the system configuration is correct.
<tr><td> </td><td><b>[Device:]Reading</b> - Reading in the consumer or optionally an alternative device. </td></tr>
<tr><td> </td><td>If the reading has the value 0 or is not present, the consumer is displayed. </td></tr>
<tr><td> </td><td>The effect of the possible reading values 1, 2 and 3 is as described. </td></tr>
<tr><td> </td><td> </td></tr>
<tr><td> <b>exconfc</b> </td><td>Use of the consumer's recorded energy consumption to create the consumption forecast (optional). </td></tr>
<tr><td> </td><td><b>0</b> - the consumer's historical energy consumption is used to create the consumption forecast (default) </td></tr>
<tr><td> </td><td><b>1</b> - the consumer's historical energy consumption is excluded from the consumption forecast. </td></tr>
</table>
</ul>
<br>
@ -19455,7 +19475,7 @@ to ensure that the system configuration is correct.
<tr><td> <b>collectData</b> </td><td>detailed data collection </td></tr>
<tr><td> <b>consumerPlanning</b> </td><td>Consumer scheduling processes </td></tr>
<tr><td> <b>consumerSwitchingXX</b> </td><td>Operations of the internal consumer switching module of consumer XX </td></tr>
<tr><td> <b>consumption</b> </td><td>Consumption calculation and use </td></tr>
<tr><td> <b>consumption</b> </td><td>Consumption calculation, consumption forecasting and utilization </td></tr>
<tr><td> <b>dwdComm</b> </td><td>Communication with the website or server of the German Weather Service (DWD) </td></tr>
<tr><td> <b>epiecesCalc</b> </td><td>Calculation of specific energy consumption per operating hour and consumer </td></tr>
<tr><td> <b>graphic</b> </td><td>Module graphic information </td></tr>
@ -21437,7 +21457,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
[notbefore=&lt;Ausdruck&gt;] [notafter=&lt;Ausdruck&gt;] [locktime=&lt;offlt&gt;[:&lt;onlt&gt;]] <br>
[auto=&lt;Readingname&gt;] [pcurr=&lt;Readingname&gt;:&lt;Einheit&gt;[:&lt;Schwellenwert&gt]] [etotal=&lt;Readingname&gt;:&lt;Einheit&gt;[:&lt;Schwellenwert&gt]] <br>
[swoncond=&lt;Device&gt;:&lt;Reading&gt;:&lt;Regex&gt] [swoffcond=&lt;Device&gt;:&lt;Reading&gt;:&lt;Regex&gt] [spignorecond=&lt;Device&gt;:&lt;Reading&gt;:&lt;Regex&gt] <br>
[interruptable=&lt;Option&gt] [noshow=&lt;Option&gt] </b><br>
[interruptable=&lt;Option&gt] [noshow=&lt;Option&gt] [exconfc=&lt;Option&gt] </b><br>
<br>
Registriert einen Verbraucher &lt;Device Name&gt; beim SolarForecast Device. Dabei ist &lt;Device Name&gt;
@ -21589,6 +21609,10 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
<tr><td> </td><td><b>[Device:]Reading</b> - Reading im Verbraucher oder optional einem alternativen Device. </td></tr>
<tr><td> </td><td>Hat das Reading den Wert 0 oder ist nicht vorhanden, wird der Verbraucher eingeblendet. </td></tr>
<tr><td> </td><td>Die Wirkung der möglichen Readingwerte 1, 2 und 3 ist wie beschrieben. </td></tr>
<tr><td> </td><td> </td></tr>
<tr><td> <b>exconfc</b> </td><td>Verwendung des aufgezeichneten Energieverbrauchs des Verbrauchers zur Erstellung der Verbrauchsprognose (optional). </td></tr>
<tr><td> </td><td><b>0</b> - der historische Energieverbrauch des Verbrauchers wird zur Erstellung der Verbrauchsprognose verwendet (default) </td></tr>
<tr><td> </td><td><b>1</b> - der historische Energieverbrauch des Verbrauchers wird von der Verbrauchsprognose ausgeschlossen. </td></tr>
</table>
</ul>
<br>
@ -21724,7 +21748,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
<tr><td> <b>collectData</b> </td><td>detailliierte Datensammlung </td></tr>
<tr><td> <b>consumerPlanning</b> </td><td>Consumer Einplanungsprozesse </td></tr>
<tr><td> <b>consumerSwitchingXX</b> </td><td>Operationen des internen Consumer Schaltmodul für Verbraucher XX </td></tr>
<tr><td> <b>consumption</b> </td><td>Verbrauchskalkulation und -nutzung </td></tr>
<tr><td> <b>consumption</b> </td><td>Verbrauchskalkulation, Verbrauchsvorhersage und -nutzung </td></tr>
<tr><td> <b>dwdComm</b> </td><td>Kommunikation mit Webseite oder Server des Deutschen Wetterdienst (DWD) </td></tr>
<tr><td> <b>epiecesCalc</b> </td><td>Berechnung des spezifischen Energieverbrauchs je Betriebsstunde und Verbraucher </td></tr>
<tr><td> <b>graphic</b> </td><td>Informationen der Modulgrafik </td></tr>

View File

@ -10430,7 +10430,7 @@ sub _estConsumptionForecast {
my $totcon = 0;
my $dnum = 0;
debugLog ($paref, "consumption", "################### Consumption forecast for the next day ###################");
debugLog ($paref, 'consumption', "################### Consumption forecast for the next day ###################");
for my $n (sort{$a<=>$b} keys %{$data{$type}{$name}{pvhist}}) {
next if ($n eq $day); # aktuellen (unvollständigen) Tag nicht berücksichtigen
@ -10443,7 +10443,7 @@ sub _estConsumptionForecast {
my $dcon = HistoryVal ($hash, $n, 99, 'con', 0);
next if(!$dcon);
debugLog ($paref, "consumption", "History Consumption day >$n<: $dcon");
debugLog ($paref, 'consumption', "History Consumption day >$n<: $dcon");
$totcon += $dcon;
$dnum++;
@ -10453,7 +10453,7 @@ sub _estConsumptionForecast {
my $tomavg = int ($totcon / $dnum);
$data{$type}{$name}{current}{tomorrowconsumption} = $tomavg; # prognostizierter Durchschnittsverbrauch aller (gleicher) Wochentage
debugLog ($paref, "consumption", "estimated Consumption for tomorrow: $tomavg, days for avg: $dnum");
debugLog ($paref, 'consumption', "estimated Consumption for tomorrow: $tomavg, days for avg: $dnum");
}
else {
my $lang = $paref->{lang};
@ -10478,7 +10478,7 @@ sub _estConsumptionForecast {
"21" => 0, "22" => 0, "23" => 0, "24" => 0,
};
debugLog ($paref, "consumption", "################### Consumption forecast for the next hours ###################");
debugLog ($paref, 'consumption', "################### Consumption forecast for the next hours ###################");
for my $k (sort keys %{$data{$type}{$name}{nexthours}}) {
my $nhtime = NexthoursVal ($hash, $k, "starttime", undef); # Startzeit
@ -10503,13 +10503,15 @@ sub _estConsumptionForecast {
for my $c (sort{$a<=>$b} keys %{$acref}) { # historischer Verbrauch aller registrierten Verbraucher aufaddieren
my $exconfc = ConsumerVal ($hash, $c, 'exconfc', 0); # 1 -> Consumer Verbrauch von Erstelleung der Verbrauchsprognose ausschließen
my $csme = HistoryVal ($hash, $m, $nhhr, "csme${c}", 0);
if ($exconfc) {
$hcon -= $exconfc;
debugLog ($paref, 'consumption', "Consumer '$c' values excluded from forecast calculation by 'exconfc' - day: $m, hour: $nhhr, csme: $csme");
$hcon -= $csme;
next;
}
$consumerco += HistoryVal ($hash, $m, $nhhr, "csme${c}", 0);
$consumerco += $csme;
}
$conhex->{$nhhr} += $hcon - $consumerco if($hcon >= $consumerco); # prognostizierter Verbrauch Ex registrierter Verbraucher
@ -10527,7 +10529,7 @@ sub _estConsumptionForecast {
writeToHistory ( { paref => $paref, key => 'confc', val => $conavg, hour => $nhhr } );
}
debugLog ($paref, "consumption", "estimated Consumption for $nhday -> starttime: $nhtime, confc: $conavg, days for avg: $dnum, hist. consumption registered consumers: ".sprintf "%.2f", $consumerco);
debugLog ($paref, 'consumption', "estimated Consumption for $nhday -> starttime: $nhtime, confc: $conavg, days for avg: $dnum, hist. consumption registered consumers: ".sprintf "%.2f", $consumerco);
}
}
@ -19473,7 +19475,7 @@ to ensure that the system configuration is correct.
<tr><td> <b>collectData</b> </td><td>detailed data collection </td></tr>
<tr><td> <b>consumerPlanning</b> </td><td>Consumer scheduling processes </td></tr>
<tr><td> <b>consumerSwitchingXX</b> </td><td>Operations of the internal consumer switching module of consumer XX </td></tr>
<tr><td> <b>consumption</b> </td><td>Consumption calculation and use </td></tr>
<tr><td> <b>consumption</b> </td><td>Consumption calculation, consumption forecasting and utilization </td></tr>
<tr><td> <b>dwdComm</b> </td><td>Communication with the website or server of the German Weather Service (DWD) </td></tr>
<tr><td> <b>epiecesCalc</b> </td><td>Calculation of specific energy consumption per operating hour and consumer </td></tr>
<tr><td> <b>graphic</b> </td><td>Module graphic information </td></tr>
@ -21746,7 +21748,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
<tr><td> <b>collectData</b> </td><td>detailliierte Datensammlung </td></tr>
<tr><td> <b>consumerPlanning</b> </td><td>Consumer Einplanungsprozesse </td></tr>
<tr><td> <b>consumerSwitchingXX</b> </td><td>Operationen des internen Consumer Schaltmodul für Verbraucher XX </td></tr>
<tr><td> <b>consumption</b> </td><td>Verbrauchskalkulation und -nutzung </td></tr>
<tr><td> <b>consumption</b> </td><td>Verbrauchskalkulation, Verbrauchsvorhersage und -nutzung </td></tr>
<tr><td> <b>dwdComm</b> </td><td>Kommunikation mit Webseite oder Server des Deutschen Wetterdienst (DWD) </td></tr>
<tr><td> <b>epiecesCalc</b> </td><td>Berechnung des spezifischen Energieverbrauchs je Betriebsstunde und Verbraucher </td></tr>
<tr><td> <b>graphic</b> </td><td>Informationen der Modulgrafik </td></tr>