2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

76_SolarForecast: contrib 1.0.7

git-svn-id: https://svn.fhem.de/fhem/trunk@28077 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2023-10-21 07:28:55 +00:00
parent abdfd2fdcc
commit 17be09785e

View File

@ -144,6 +144,7 @@ BEGIN {
# Versions History intern
my %vNotesIntern = (
"1.0.7" => "21.10.2023 more design options for graphicHeaderOwnspec and a possible line title ",
"1.0.6" => "19.10.2023 new attr ctrlGenPVdeviation ",
"1.0.5" => "11.10.2023 new sub _aiGetSpread for estimate AI results stepwise, allow key 'noshow' values 0,1,2,3 ".
"calculate conForecastTillNextSunrise accurate to the minute ",
@ -7759,15 +7760,6 @@ sub _calcTodayPVdeviation {
my $pvfc = ReadingsNum ($name, 'Today_PVforecast', 0);
my $pvre = ReadingsNum ($name, 'Today_PVreal', 0);
#my $hsr = (split ":", ReadingsVal ($name, 'Today_SunRise', '03:00'))[0]; # die Stunde des Sonnenaufgangs
#my $ehsr = HistoryVal ($hash, $day, $hsr, 'etotal', 0); # gespeichertes etotal vor Sonnenaufgang
#if ($ehsr) {
# my $esset = CurrentVal ($hash, 'etotal', 0); # Erzeugung total (Wh) nach Sonnenuntergang
# $pvre = $esset - $ehsr;
# $pvre = 0 if($pvre <= 0);
#}
return if(!$pvre);
my $dp;
@ -7788,7 +7780,6 @@ sub _calcTodayPVdeviation {
$data{$type}{$name}{circular}{99}{tdayDvtn} = $dp;
push @$daref, "Today_PVdeviation<>". $dp.' %';
#push @$daref, "Today_PVreal<>". $pvre.' Wh';
return;
}
@ -9094,8 +9085,20 @@ sub __createOwnSpec {
return if(!$spec || !$show);
my @fields = split (/\s+/sx, $spec);
my (@cats, @vals);
for my $f (@fields) {
if ($f =~ /^\#(.*)/xs) {
push @cats, $1;
next;
}
push @vals, $f;
}
my $ownv;
my @vals = split (/\s+/sx, $spec);
my $rows = ceil (scalar(@vals) / $vinr);
my $col = 0;
@ -9108,11 +9111,11 @@ sub __createOwnSpec {
}
$ownv .= "<tr>";
$ownv .= "<td $dstyle></td>";
$ownv .= "<td $dstyle><b>".$h->{0}{label}.":</b></td> <td align=right $dstyle>".ReadingsVal ($name,$h->{0}{rdg},'')."</td>" if(exists $h->{0}{label});
$ownv .= "<td $dstyle><b>".$h->{1}{label}.":</b></td> <td align=right $dstyle>".ReadingsVal ($name,$h->{1}{rdg},'')."</td>" if(exists $h->{1}{label});
$ownv .= "<td $dstyle><b>".$h->{2}{label}.":</b></td> <td align=right $dstyle>".ReadingsVal ($name,$h->{2}{rdg},'')."</td>" if(exists $h->{2}{label});
$ownv .= "<td $dstyle><b>".$h->{3}{label}.":</b></td> <td align=right $dstyle>".ReadingsVal ($name,$h->{3}{rdg},'')."</td>" if(exists $h->{3}{label});
$ownv .= "<td $dstyle>".($cats[$i-1] ? '<b>'.$cats[$i-1].'</b>' : '')."</td>";
$ownv .= "<td $dstyle><b>".$h->{0}{label}.":</b></td> <td align=right $dstyle>".ReadingsVal ($name,$h->{0}{rdg},'')."</td>" if($h->{0}{label});
$ownv .= "<td $dstyle><b>".$h->{1}{label}.":</b></td> <td align=right $dstyle>".ReadingsVal ($name,$h->{1}{rdg},'')."</td>" if($h->{1}{label});
$ownv .= "<td $dstyle><b>".$h->{2}{label}.":</b></td> <td align=right $dstyle>".ReadingsVal ($name,$h->{2}{rdg},'')."</td>" if($h->{2}{label});
$ownv .= "<td $dstyle><b>".$h->{3}{label}.":</b></td> <td align=right $dstyle>".ReadingsVal ($name,$h->{3}{rdg},'')."</td>" if($h->{3}{label});
$ownv .= "</tr>";
}
@ -15921,23 +15924,34 @@ to ensure that the system configuration is correct.
<a id="SolarForecast-attr-graphicHeaderOwnspec"></a>
<li><b>graphicHeaderOwnspec &lt;Label&gt;:&lt;Reading&gt; &lt;Label&gt;:&lt;Reading&gt; ... </b><br>
Display of any reading values of the device. The values to be displayed are separated by spaces.
Each value is to be defined by a label and the corresponding reading connected by ":".
The input can be multiline. Spaces in the label are to be inserted by "&amp;nbsp;", a line break
by "&lt;br&gt;".
Display of any reading values of the device. <br>
The values to be displayed are separated by spaces.
Four values (fields) are displayed per line. <br>
The input can be made in multiple lines. <br><br>
Each value is to be defined by a label and the corresponding reading connected by ":". <br>
Spaces in the label are to be inserted by "&amp;nbsp;", a line break by "&lt;br&gt;". <br>
An empty field in a line is created by ":". <br>
A line title can be inserted by specifying "#:&lt;Text&gt;", an empty title by entering "#".
<br><br>
<ul>
<b>Example: </b> <br>
<table>
<colgroup> <col width="30%"> <col width="70%"> </colgroup>
<tr><td> attr &lt;name&gt; graphicHeaderOwnspec </td><td>AutarkyRate:Current_AutarkyRate </td></tr>
<colgroup> <col width="33%"> <col width="67%"> </colgroup>
<tr><td> attr &lt;name&gt; graphicHeaderOwnspec </td><td># </td></tr>
<tr><td> </td><td>AutarkyRate:Current_AutarkyRate </td></tr>
<tr><td> </td><td>Surplus:Current_Surplus </td></tr>
<tr><td> </td><td>current&amp;nbsp;Gridconsumption:Current_GridConsumption </td></tr>
<tr><td> </td><td>: </td></tr>
<tr><td> </td><td># </td></tr>
<tr><td> </td><td>CO&amp;nbsp;until&amp;nbsp;sunset:statistic_todayConForecastTillSunset </td></tr>
<tr><td> </td><td>PV&amp;nbsp;the&amp;nbsp;day&amp;nbsp;after&amp;nbsp;tomorrow:statistic_dayAfterTomorrowPVforecast </td></tr>
<tr><td> </td><td>BAT&amp;nbsp;in&amp;nbsp;today:statistic_todayBatIn </td></tr>
<tr><td> </td><td>BAT&amp;nbsp;out&amp;nbsp;today:statistic_todayBatOut </td></tr>
<tr><td> </td><td>PV&amp;nbsp;Day&amp;nbsp;after&amp;nbsp;tomorrow:statistic_dayAfterTomorrowPVforecast </td></tr>
<tr><td> </td><td>: </td></tr>
<tr><td> </td><td>: </td></tr>
<tr><td> </td><td>#Battery </td></tr>
<tr><td> </td><td>in&amp;nbsp;today:statistic_todayBatIn </td></tr>
<tr><td> </td><td>out&amp;nbsp;today:statistic_todayBatOut </td></tr>
</table>
</ul>
</li>
@ -17748,23 +17762,34 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
<a id="SolarForecast-attr-graphicHeaderOwnspec"></a>
<li><b>graphicHeaderOwnspec &lt;Label&gt;:&lt;Reading&gt; &lt;Label&gt;:&lt;Reading&gt; ... </b><br>
Anzeige beliebiger Readingswerte des Devices. Die anzuzeigenden Werte werden durch Leerzeichen getrennt.
Jeder Wert ist jeweils durch ein Label und das dazugehörige Reading verbunden durch ":" zu definieren.
Die Eingabe kann mehrzeilig erfolgen. Leerzeichen im Label sind durch "&amp;nbsp;" einzufügen, ein Zeilenumbruch
durch "&lt;br&gt;".
Anzeige beliebiger Readingswerte des Devices. <br>
Die anzuzeigenden Werte werden durch Leerzeichen getrennt.
Es werden vier Werte (Felder) pro Zeile dargestellt. <br>
Die Eingabe kann mehrzeilig erfolgen. <br><br>
Jeder Wert ist jeweils durch ein Label und das dazugehörige Reading verbunden durch ":" zu definieren. <br>
Leerzeichen im Label sind durch "&amp;nbsp;" einzufügen, ein Zeilenumbruch durch "&lt;br&gt;". <br>
Ein leeres Feld in einer Zeile wird durch ":" erzeugt. <br>
Ein Zeilentitel kann durch Angabe von "#:&lt;Text&gt;" eingefügt werden, ein leerer Titel durch die Eingabe von "#".
<br><br>
<ul>
<b>Beispiel: </b> <br>
<table>
<colgroup> <col width="35%"> <col width="65%"> </colgroup>
<tr><td> attr &lt;name&gt; graphicHeaderOwnspec </td><td>AutarkyRate:Current_AutarkyRate </td></tr>
<tr><td> attr &lt;name&gt; graphicHeaderOwnspec </td><td># </td></tr>
<tr><td> </td><td>AutarkyRate:Current_AutarkyRate </td></tr>
<tr><td> </td><td>Überschuß:Current_Surplus </td></tr>
<tr><td> </td><td>aktueller&amp;nbsp;Netzbezug:Current_GridConsumption </td></tr>
<tr><td> </td><td>: </td></tr>
<tr><td> </td><td># </td></tr>
<tr><td> </td><td>CO&amp;nbsp;bis&amp;nbsp;Sonnenuntergang:statistic_todayConForecastTillSunset </td></tr>
<tr><td> </td><td>PV&amp;nbsp;Übermorgen:statistic_dayAfterTomorrowPVforecast </td></tr>
<tr><td> </td><td>BAT&amp;nbsp;in&amp;nbsp;heute:statistic_todayBatIn </td></tr>
<tr><td> </td><td>BAT&amp;nbsp;out&amp;nbsp;heute:statistic_todayBatOut </td></tr>
<tr><td> </td><td>: </td></tr>
<tr><td> </td><td>: </td></tr>
<tr><td> </td><td>#Batterie </td></tr>
<tr><td> </td><td>in&amp;nbsp;heute:statistic_todayBatIn </td></tr>
<tr><td> </td><td>out&amp;nbsp;heute:statistic_todayBatOut </td></tr>
</table>
</ul>
</li>