mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 08:03:40 +00:00
bugfix
git-svn-id: https://svn.fhem.de/fhem/trunk@6188 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2bf5aadc24
commit
8f4854f54e
@ -421,6 +421,18 @@ statistics_DoStatistics($$$)
|
|||||||
statistics_doStatisticMinMax ($hash, $dev, $readingName, 1, $periodSwitch);
|
statistics_doStatisticMinMax ($hash, $dev, $readingName, 1, $periodSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($periodSwitch>=1) {
|
||||||
|
@specialReadings = split /,/, AttrVal($hashName, "tendencyReadings", "");
|
||||||
|
foreach $readingName (@specialReadings)
|
||||||
|
{
|
||||||
|
my $completeReadingName = $devName.":".$readingName;
|
||||||
|
next if ($completeReadingName =~ m/^($exclReadings)$/ );
|
||||||
|
next if not exists ($dev->{READINGS}{$readingName});
|
||||||
|
$statisticDone = 1;
|
||||||
|
statistics_doStatisticTendency ($hash, $dev, $readingName, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($statisticDone != 1) {
|
if ($statisticDone != 1) {
|
||||||
if ( exists ($dev->{READINGS}{state}) && $dev->{READINGS}{state}{VAL} ne "defined" ) {
|
if ( exists ($dev->{READINGS}{state}) && $dev->{READINGS}{state}{VAL} ne "defined" ) {
|
||||||
statistics_doStatisticDuration $hash, $dev, "state", $periodSwitch;
|
statistics_doStatisticDuration $hash, $dev, "state", $periodSwitch;
|
||||||
@ -589,7 +601,7 @@ statistics_doStatisticTendency ($$$$)
|
|||||||
my $result = $value;
|
my $result = $value;
|
||||||
Log3 $name,4,"$name: Add $value to $hiddenReadingName";
|
Log3 $name,4,"$name: Add $value to $hiddenReadingName";
|
||||||
if (exists ($hash->{READINGS}{$hiddenReadingName}{VAL})) { $result .= " " . $hash->{READINGS}{$hiddenReadingName}{VAL}; }
|
if (exists ($hash->{READINGS}{$hiddenReadingName}{VAL})) { $result .= " " . $hash->{READINGS}{$hiddenReadingName}{VAL}; }
|
||||||
my @hidden = split / /, $result; # Internal values
|
@hidden = split / /, $result; # Internal values
|
||||||
if ( exists($hidden[7]) ) {
|
if ( exists($hidden[7]) ) {
|
||||||
Log3 $name,4,"$name: Remove last value ".$hidden[7]." from '$hiddenReadingName'";
|
Log3 $name,4,"$name: Remove last value ".$hidden[7]." from '$hiddenReadingName'";
|
||||||
delete $hidden[7];
|
delete $hidden[7];
|
||||||
@ -602,6 +614,16 @@ statistics_doStatisticTendency ($$$$)
|
|||||||
$result = "1h: " . $stat[1] ." 2h: ". $stat[3] ." 3h: ". $stat[5] ." 6h: ". $stat[7];
|
$result = "1h: " . $stat[1] ." 2h: ". $stat[3] ." 3h: ". $stat[5] ." 6h: ". $stat[7];
|
||||||
readingsBulkUpdate($dev, $statReadingName, $result, 1);
|
readingsBulkUpdate($dev, $statReadingName, $result, 1);
|
||||||
|
|
||||||
|
# Store single readings
|
||||||
|
my $singularReadings = AttrVal($name, "singularReadings", "");
|
||||||
|
if ($singularReadings ne "") {
|
||||||
|
# statistics_storeSingularReadings $hashName,$singularReadings,$dev,$statReadingName,$readingName,$statType,$period,$statValue,$lastValue,$saveLast
|
||||||
|
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Tendency","1h",$stat[1],0,0);
|
||||||
|
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Tendency","2h",$stat[1],0,0);
|
||||||
|
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Tendency","3h",$stat[1],0,0);
|
||||||
|
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Tendency","6h",$stat[1],0,0);
|
||||||
|
}
|
||||||
|
|
||||||
$result = join( " ", @hidden );
|
$result = join( " ", @hidden );
|
||||||
readingsSingleUpdate($hash, $hiddenReadingName, $result, 0);
|
readingsSingleUpdate($hash, $hiddenReadingName, $result, 0);
|
||||||
Log3 $name,4,"$name: Set '$hiddenReadingName = $result'";
|
Log3 $name,4,"$name: Set '$hiddenReadingName = $result'";
|
||||||
@ -884,7 +906,7 @@ statistics_storeSingularReadings ($$$$$$$$$$)
|
|||||||
my ($hashName,$singularReadings,$dev,$statReadingName,$readingName,$statType,$period,$statValue,$lastValue,$saveLast) = @_;
|
my ($hashName,$singularReadings,$dev,$statReadingName,$readingName,$statType,$period,$statValue,$lastValue,$saveLast) = @_;
|
||||||
return if $singularReadings eq "";
|
return if $singularReadings eq "";
|
||||||
|
|
||||||
if ($statType eq "Delta") { $statReadingName .= $period;}
|
if ($statType =~ /Delta|Tendency/) { $statReadingName .= $period;}
|
||||||
else { $statReadingName .= $statType;}
|
else { $statReadingName .= $statType;}
|
||||||
my $devName=$dev->{NAME};
|
my $devName=$dev->{NAME};
|
||||||
if ("$devName:$readingName:$statType:$period" =~ /^($singularReadings)$/) {
|
if ("$devName:$readingName:$statType:$period" =~ /^($singularReadings)$/) {
|
||||||
@ -1022,7 +1044,11 @@ statistics_FormatDuration($)
|
|||||||
Allows the correct timely assignment within plots, can be adapted to the cpu load.
|
Allows the correct timely assignment within plots, can be adapted to the cpu load.
|
||||||
<br>
|
<br>
|
||||||
</li><br>
|
</li><br>
|
||||||
<li><code>singularReadings <DeviceRegExp:ReadingRegExp>:statTypes<i>(Min|Avg|Max|Delta)</i>:period<i>(Hour|Day|Month|Year)</i></code>
|
<li><code>singularReadings <DeviceRegExp:ReadingRegExp>:statTypes:period</i></code>
|
||||||
|
<ul>
|
||||||
|
<li>statTypes: Min|Avg|Max|Delta|Duration|Tendency</li>
|
||||||
|
<li>period: Hour|Day|Month|Year|1h|2h|3h|6h</li>
|
||||||
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
Regulare expression of statistic values, which shall not be shown in summary but also in singular readings. Eases the creation of plots.
|
Regulare expression of statistic values, which shall not be shown in summary but also in singular readings. Eases the creation of plots.
|
||||||
<br>
|
<br>
|
||||||
@ -1033,6 +1059,10 @@ statistics_FormatDuration($)
|
|||||||
<br>
|
<br>
|
||||||
Adds for readings of delta statistics a singular reading for the given period of hours (e.g. for the rain of the last 72 hours)
|
Adds for readings of delta statistics a singular reading for the given period of hours (e.g. for the rain of the last 72 hours)
|
||||||
</li><br>
|
</li><br>
|
||||||
|
<li><code>tendencyReadings <Gerätewerte></code>
|
||||||
|
<br>
|
||||||
|
Comma separated list of reading names for which a min/average/max statistic shall be calculated.
|
||||||
|
</li><br>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -1126,8 +1156,8 @@ statistics_FormatDuration($)
|
|||||||
</li><br>
|
</li><br>
|
||||||
<li><code>singularReadings <GeräteNameRegExp:GeräteWertRegExp:StatistikTypen:ZeitPeriode></code>
|
<li><code>singularReadings <GeräteNameRegExp:GeräteWertRegExp:StatistikTypen:ZeitPeriode></code>
|
||||||
<ul>
|
<ul>
|
||||||
<li>StatistikTypen: Min|Avg|Max|Delta|Duration</li>
|
<li>StatistikTypen: Min|Avg|Max|Delta|Duration|Tendency</li>
|
||||||
<li>ZeitPeriode: Hour|Day|Month|Year</li>
|
<li>ZeitPeriode: Hour|Day|Month|Year|1h|2h|3h|6h</li>
|
||||||
</ul>
|
</ul>
|
||||||
Regulärer Ausdruck statistischer Werte, die nicht nur in zusammengefassten sondern auch als einzelne Werte gespeichert werden sollen.
|
Regulärer Ausdruck statistischer Werte, die nicht nur in zusammengefassten sondern auch als einzelne Werte gespeichert werden sollen.
|
||||||
Erleichtert die Erzeugung von Plots.
|
Erleichtert die Erzeugung von Plots.
|
||||||
@ -1138,6 +1168,10 @@ statistics_FormatDuration($)
|
|||||||
<br>
|
<br>
|
||||||
Fügt den Delta-Statistiken einen singulären Gerätewert für die angegebenen Stunden hinzu (z.b. für den Regen in den letzten 72 Stunden)
|
Fügt den Delta-Statistiken einen singulären Gerätewert für die angegebenen Stunden hinzu (z.b. für den Regen in den letzten 72 Stunden)
|
||||||
</li><br>
|
</li><br>
|
||||||
|
<li><code>tendencyReadings <Gerätewerte></code>
|
||||||
|
<br>
|
||||||
|
Durch Kommas getrennte Liste von Gerätewerten
|
||||||
|
</li><br>
|
||||||
<li><a href="#readingFnAttributes">readingFnAttributes</a>
|
<li><a href="#readingFnAttributes">readingFnAttributes</a>
|
||||||
</li><br>
|
</li><br>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user