2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 13:24:56 +00:00

Supoprt for combined readings

git-svn-id: https://svn.fhem.de/fhem/trunk@2629 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-02-02 12:35:44 +00:00
parent e0fac77583
commit e662866be0
2 changed files with 11 additions and 3 deletions

View File

@ -66,6 +66,7 @@
via the new notice command (M. Fischer)
- change: BS, USF1000, dummy migrated to readingsFN (Boris)
- feature: added new set commands and basicauth to 49_IPCAM.pm (M. Fischer)
- feature: average supports more than one value in combined readings (T:x H:y)
- 2012-10-28 (5.3)

View File

@ -64,6 +64,10 @@ average_Notify($$)
next if($devName !~ m/^$re$/ && "$devName:$s" !~ m/^$re$/ || $s =~ m/_avg_/);
if(defined($1)) {
my $reArg = $1;
if(defined($2)) {
$evName = $1;
$reArg = $2;
}
$val = $reArg if(defined($reArg) && $reArg =~ m/^(-?\d+\.?\d*)/);
}
next if(!defined($val) || $val !~ m/^(-?\d+\.?\d*)/);
@ -214,10 +218,13 @@ average_Notify($$)
# ws1 humidity: 67.4
define avg_temp_ws1 average .*:(temperature|humidity).*
# Hunt only for the humidity: take the value from the first
# parenthesis ($1 in perl regexp) if it is a number
# Compute the same from a combined event. Note: we need two average
# definitions here, each of them defining the name with the first
# paranthesis, and the value with the second.
#
# Event: ws1 T: 52.3 H: 67.4
define avg_temp_ws1 average ws1:.*H:.([-\d\.]+)
define avg_temp_ws1_t average ws1:(T):.([-\d\.]+).*
define avg_temp_ws1_h average ws1:.*(H):.([-\d\.]+).*
</PRE>
</ul>