mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-16 10:46:03 +00:00
average bug fixed
git-svn-id: https://svn.fhem.de/fhem/trunk@1129 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8015a55996
commit
33efb8f7f6
@ -60,9 +60,11 @@ average_Notify($$)
|
|||||||
next if(!defined($s));
|
next if(!defined($s));
|
||||||
my ($evName, $val) = split(" ", $s, 2); # resets $1
|
my ($evName, $val) = split(" ", $s, 2); # resets $1
|
||||||
next if($devName !~ m/^$re$/ && "$devName:$s" !~ m/^$re$/ || $s =~ m/_avg_/);
|
next if($devName !~ m/^$re$/ && "$devName:$s" !~ m/^$re$/ || $s =~ m/_avg_/);
|
||||||
$val = $1 if(defined($1));
|
if(defined($1)) {
|
||||||
next if(!defined($val) || $val !~ m/^(\d+\.?\d*)/);
|
my $reArg = $1;
|
||||||
$val = $1;
|
$val = $reArg if(defined($reArg) && $reArg =~ m/^(-?\d+\.?\d*)/);
|
||||||
|
}
|
||||||
|
next if(!defined($val) || $val !~ m/^(-?\d+\.?\d*)/);
|
||||||
|
|
||||||
################
|
################
|
||||||
# Avg computing
|
# Avg computing
|
||||||
@ -96,7 +98,6 @@ average_Notify($$)
|
|||||||
my $cum = $r->{$cumName}{VAL} + ($secNow-$secLast) * $val;
|
my $cum = $r->{$cumName}{VAL} + ($secNow-$secLast) * $val;
|
||||||
$r->{$cumName}{VAL} = $cum;
|
$r->{$cumName}{VAL} = $cum;
|
||||||
$r->{$avgName}{VAL} = sprintf("%0.1f", $cum/$secNow);
|
$r->{$avgName}{VAL} = sprintf("%0.1f", $cum/$secNow);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$trigger .= " $avgName:".$r->{$avgName}{VAL};
|
$trigger .= " $avgName:".$r->{$avgName}{VAL};
|
||||||
$r->{$cumName}{VAL} = $secNow*$val;
|
$r->{$cumName}{VAL} = $secNow*$val;
|
||||||
|
@ -571,7 +571,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
"room": "Server",
|
"room": "Server",
|
||||||
"statefile": "/var/cache/fhem/fhem.save",
|
"statefile": "/var/cache/fhem/fhem.save",
|
||||||
"verbose": "4",
|
"verbose": "4",
|
||||||
"version": "=VERS= from =DATE= ($Id: fhem.pl,v 1.150 2011-08-16 18:06:38 rudolfkoenig Exp $)"
|
"version": "=VERS= from =DATE= ($Id: fhem.pl,v $)"
|
||||||
},
|
},
|
||||||
"READINGS": []
|
"READINGS": []
|
||||||
}
|
}
|
||||||
@ -2262,7 +2262,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
<a name="CULdefine"></a>
|
<a name="CULdefine"></a>
|
||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> CUL <device> <housecode></code> <br>
|
<code>define <name> CUL <device> <FHTID></code> <br>
|
||||||
<br>
|
<br>
|
||||||
USB-connected devices (CUL/CUR/CUN):<br><ul>
|
USB-connected devices (CUL/CUR/CUN):<br><ul>
|
||||||
<device> specifies the serial port to communicate with the CUL or
|
<device> specifies the serial port to communicate with the CUL or
|
||||||
@ -2292,8 +2292,9 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
If the device is called none, then no device will be opened, so you
|
If the device is called none, then no device will be opened, so you
|
||||||
can experiment without hardware attached.<br>
|
can experiment without hardware attached.<br>
|
||||||
|
|
||||||
The housecode is a 4 digit hex number, and it is used when the CUL/CUR
|
The FHTID is a 4 digit hex number, and it is used when the CUL/CUR talks to
|
||||||
talks to FHT devices or when CUR requests data.
|
FHT devices or when CUR requests data. Set it to 0000 to avoid answering
|
||||||
|
any FHT80b request by the CUL.
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -6810,7 +6811,7 @@ href="http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=29870">U
|
|||||||
define a4 at *17:00:00 set lamp on # every day
|
define a4 at *17:00:00 set lamp on # every day
|
||||||
|
|
||||||
# relative ones
|
# relative ones
|
||||||
define a5 at +00:00:10 set lamp on # switch the lamp on in 10 seconds
|
define a5 at +00:00:10 set lamp on # switch on in 10 seconds
|
||||||
define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 seconds
|
define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 seconds
|
||||||
define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times
|
define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times
|
||||||
|
|
||||||
@ -7022,7 +7023,15 @@ href="http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=29870">U
|
|||||||
define avg_temp_ws1 average .*:temperature.*
|
define avg_temp_ws1 average .*:temperature.*
|
||||||
|
|
||||||
# Compute the average for all temperature and humidity events
|
# Compute the average for all temperature and humidity events
|
||||||
|
# Events:
|
||||||
|
# ws1 temperature: 22.3
|
||||||
|
# ws1 humidity: 67.4
|
||||||
define avg_temp_ws1 average .*:(temperature|humidity).*
|
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
|
||||||
|
# Event: ws1 T: 52.3 H: 67.4
|
||||||
|
define avg_temp_ws1 average ws1:.*H:.([-\d\.]+)
|
||||||
</PRE>
|
</PRE>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -1580,6 +1580,7 @@ GlobalAttr($$)
|
|||||||
return "$!" if($init_done);
|
return "$!" if($init_done);
|
||||||
die "Can't open server port at $port: $!\n";
|
die "Can't open server port at $port: $!\n";
|
||||||
}
|
}
|
||||||
|
Log 2, "Telnet port $port opened";
|
||||||
close($server) if($server);
|
close($server) if($server);
|
||||||
$server = $server2;
|
$server = $server2;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user