mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
fhem.pl: TimeSeries patch (Forum #38479)
git-svn-id: https://svn.fhem.de/fhem/trunk@10905 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
27d103ba97
commit
cac627b37b
@ -484,10 +484,10 @@ attribute list if you want to know if a device supports these attributes. <br>
|
||||
readings over time periods and to throttle the update rate of readings and thus
|
||||
the amount of data written to the logs.<p>
|
||||
|
||||
This attribute takes a comma-separated list of <code>reading:interval:method:function</code>
|
||||
quadruples. You may use regular expressions for <code>reading</code>. If set, updates for the
|
||||
This attribute takes a comma-separated list of <code>reading:interval:method:function:holdTime</code>
|
||||
quintuples. You may use regular expressions for <code>reading</code>. If set, updates for the
|
||||
listed readings are ignored and associated events are suppressed for a black-out period of at
|
||||
least <code>interval</code> seconds. After the black-out period has expired, the reading is
|
||||
least <code>interval</code> seconds (downsampling). After the black-out period has expired, the reading is
|
||||
updated with a value that is calculated from the values and timestamps of the previously ignored
|
||||
updates within the black-out period as follows:
|
||||
|
||||
@ -499,7 +499,11 @@ attribute list if you want to know if a device supports these attributes. <br>
|
||||
<tr><td>max</td><td>the largest value encountered</td></tr>
|
||||
<tr><td>mean</td><td>the arithmetic mean of all values</td></tr>
|
||||
<tr><td>sd</td><td>the standard deviation from the mean</td></tr>
|
||||
<tr><td>median</td><td>the median of all values (requires holdTime and function none)</td></tr>
|
||||
<tr><td>integral</td><td>the arithmetic sum (if not time-weighted) or integral area (if time-weighted) of all values</td></tr>
|
||||
<tr><td>n</td><td>number of samples</td></tr>
|
||||
<tr><td>t</td><td>timestamp of the last value</td></tr>
|
||||
<tr><td>t0</td><td>timestamp of the first value</td></tr>
|
||||
</table>
|
||||
<p>
|
||||
|
||||
@ -518,13 +522,25 @@ attribute list if you want to know if a device supports these attributes. <br>
|
||||
method is for discrete quantities that stay constant until the corresponding reading is updated,
|
||||
e.g. counters, switches and the like.<p>
|
||||
|
||||
If the <code>holdTime</code> in seconds is defined, the samples will be kept in memory allowing
|
||||
the calculation of floating statistics instead of blocked statistics. With <code>holdTime</code>
|
||||
defined the <code>interval</code> can be kept undefined so that the readings update rate is unchanged
|
||||
or it can be set to a value less then <code>holdTime</code> for downsampling as described above
|
||||
with a full history of the readings in memory. Note that the historic samples are not persistent
|
||||
and will be lost when restarting FHEM.<p>
|
||||
|
||||
The event aggregator only takes into consideration those updates that remain after preprocessing
|
||||
according to the <code>event-on-update-reading</code> and <code>event-on-change-reading</code>
|
||||
directives. Besides which, any update of a reading that occurs within a timespan from the preceding
|
||||
update that is smaller than the resolution of FHEM's time granularity is ditched.<p>
|
||||
|
||||
Example:<br>
|
||||
<code>attr myPowerMeter event-aggregator EP_POWER_METER:300:linear:mean,EP_ENERGY_METER:300:none:v</code>
|
||||
When more than one function should be calculated for the same reading, the original reading must be
|
||||
multiplied (e.g. by using a notify) before applying the event-aggregator to the derived readings.<p>
|
||||
|
||||
Examples:<br>
|
||||
<code>attr myPowerMeter event-aggregator EP_POWER_METER:300:linear:mean,EP_ENERGY_METER:300:none:v</code><br>
|
||||
<code>attr myBadSensor event-aggregator TEMP::none:median:300</code><br>
|
||||
<code>attr mySunMeter event-aggregator SUN_INTENSITY_24H::const:integral:86400</code>
|
||||
</li>
|
||||
<p>
|
||||
|
||||
|
@ -456,10 +456,10 @@ Gerät dokumentiert.
|
||||
readings over time periods and to throttle the update rate of readings and thus
|
||||
the amount of data written to the logs.<p>
|
||||
|
||||
This attribute takes a comma-separated list of <code>reading:interval:method:function</code>
|
||||
quadruples. You may use regular expressions for <code>reading</code>. If set, updates for the
|
||||
This attribute takes a comma-separated list of <code>reading:interval:method:function:holdTime</code>
|
||||
quintuples. You may use regular expressions for <code>reading</code>. If set, updates for the
|
||||
listed readings are ignored and associated events are suppressed for a black-out period of at
|
||||
least <code>interval</code> seconds. After the black-out period has expired, the reading is
|
||||
least <code>interval</code> seconds (downsampling). After the black-out period has expired, the reading is
|
||||
updated with a value that is calculated from the values and timestamps of the previously ignored
|
||||
updates within the black-out period as follows:
|
||||
|
||||
@ -471,7 +471,11 @@ Gerät dokumentiert.
|
||||
<tr><td>max</td><td>the largest value encountered</td></tr>
|
||||
<tr><td>mean</td><td>the arithmetic mean of all values</td></tr>
|
||||
<tr><td>sd</td><td>the standard deviation from the mean</td></tr>
|
||||
<tr><td>median</td><td>the median of all values (requires holdTime and function none)</td></tr>
|
||||
<tr><td>integral</td><td>the arithmetic sum (if not time-weighted) or integral area (if time-weighted) of all values</td></tr>
|
||||
<tr><td>n</td><td>number of samples</td></tr>
|
||||
<tr><td>t</td><td>timestamp of the last value</td></tr>
|
||||
<tr><td>t0</td><td>timestamp of the first value</td></tr>
|
||||
</table>
|
||||
<p>
|
||||
|
||||
@ -490,13 +494,25 @@ Gerät dokumentiert.
|
||||
method is for discrete quantities that stay constant until the corresponding reading is updated,
|
||||
e.g. counters, switches and the like.<p>
|
||||
|
||||
If the <code>holdTime</code> in seconds is defined, the samples will be kept in memory allowing
|
||||
the calculation of floating statistics instead of blocked statistics. With <code>holdTime</code>
|
||||
defined the <code>interval</code> can be kept undefined so that the readings update rate is unchanged
|
||||
or it can be set to a value less then <code>holdTime</code> for downsampling as described above
|
||||
with a full history of the readings in memory. Note that the historic samples are not persistent
|
||||
and will be lost when restarting FHEM.<p>
|
||||
|
||||
The event aggregator only takes into consideration those updates that remain after preprocessing
|
||||
according to the <code>event-on-update-reading</code> and <code>event-on-change-reading</code>
|
||||
directives. Besides which, any update of a reading that occurs within a timespan from the preceding
|
||||
update that is smaller than the resolution of FHEM's time granularity is ditched.<p>
|
||||
|
||||
Example:<br>
|
||||
<code>attr myPowerMeter event-aggregator EP_POWER_METER:300:linear:mean,EP_ENERGY_METER:300:none:v</code>
|
||||
When more than one function should be calculated for the same reading, the original reading must be
|
||||
multiplied (e.g. by using a notify) before applying the event-aggregator to the derived readings.<p>
|
||||
|
||||
Examples:<br>
|
||||
<code>attr myPowerMeter event-aggregator EP_POWER_METER:300:linear:mean,EP_ENERGY_METER:300:none:v</code><br>
|
||||
<code>attr myBadSensor event-aggregator TEMP::none:median:300</code><br>
|
||||
<code>attr mySunMeter event-aggregator SUN_INTENSITY_24H::const:integral:86400</code>
|
||||
</li>
|
||||
|
||||
<a name="event-min-interval"></a>
|
||||
|
@ -4056,13 +4056,13 @@ readingsBulkUpdate($$$@)
|
||||
($reading=~ m/^$l$/) ? $_ : undef} @{$hash->{".attraggr"}};
|
||||
if(@v) {
|
||||
# e.g. power:20:linear:avg
|
||||
my (undef, $duration, $method, $function) = split(":", $v[0], 4);
|
||||
my (undef, $duration, $method, $function, $holdTime) = split(":", $v[0], 5);
|
||||
my $ts;
|
||||
if(defined($readings->{".ts"})) {
|
||||
$ts= $readings->{".ts"};
|
||||
} else {
|
||||
require "TimeSeries.pm";
|
||||
$ts= TimeSeries->new( { method => $method, autoreset => $duration } );
|
||||
$ts= TimeSeries->new( { method => $method, autoreset => $duration, holdTime => $holdTime } );
|
||||
$readings->{".ts"}= $ts;
|
||||
# access from command line:
|
||||
# { $defs{"myClient"}{READINGS}{"myValue"}{".ts"}{max} }
|
||||
|
Loading…
Reference in New Issue
Block a user