mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 04:36:36 +00:00
minsecs by Arno
git-svn-id: https://svn.fhem.de/fhem/trunk@1264 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d177703d74
commit
729e983bb5
@ -12,6 +12,7 @@
|
||||
- feature: Retaining configfile comments (not within a define statement)
|
||||
- feature: EnOcean PM101 by Ignaz
|
||||
- feature: FHEMWEB redirectCmds attribute added
|
||||
- feature: CUL_TX minsecs attribute (by Arno)
|
||||
|
||||
- 2011-12-31 (5.2)
|
||||
- bugfix: applying smallscreen attributes to firefox/opera
|
||||
|
@ -28,11 +28,14 @@ CUL_TX_Define($$)
|
||||
my ($hash, $def) = @_;
|
||||
my @a = split("[ \t][ \t]*", $def);
|
||||
|
||||
return "wrong syntax: define <name> CUL_TX <code> [corr]"
|
||||
if(int(@a) < 3 || int(@a) > 4);
|
||||
return "wrong syntax: define <name> CUL_TX <code> [corr] [minsecs]"
|
||||
if(int(@a) < 3 || int(@a) > 5);
|
||||
|
||||
$hash->{CODE} = $a[2];
|
||||
$hash->{corr} = ((int(@a) > 3) ? $a[3] : 0);
|
||||
$hash->{minsecs} = ((int(@a) > 4) ? $a[4] : 0);
|
||||
$hash->{lastT} = 0;
|
||||
$hash->{lastH} = 0;
|
||||
|
||||
$modules{CUL_TX}{defptr}{$a[2]} = $hash;
|
||||
$hash->{STATE} = "Defined";
|
||||
@ -73,6 +76,7 @@ CUL_TX_Parse($$)
|
||||
Log 2, "CUL_TX Unknown device $id3, please define it";
|
||||
return "UNDEFINED CUL_TX_$id3 CUL_TX $id3" if(!$def);
|
||||
}
|
||||
my $now = time();
|
||||
|
||||
my $name = $def->{NAME};
|
||||
|
||||
@ -83,12 +87,20 @@ CUL_TX_Parse($$)
|
||||
my $valraw = ($a[5].$a[6].".".$a[7]);
|
||||
my $type = $a[2];
|
||||
if($type eq "0") {
|
||||
if($now - $def->{lastT} < $def->{minsecs} ) {
|
||||
return "";
|
||||
}
|
||||
$def->{lastT} = $now;
|
||||
$msgtype = "temperature";
|
||||
$val = sprintf("%2.1f", ($valraw - 50 + $def->{corr}) );
|
||||
Log $ll4, "CUL_TX $msgtype $name $id3 T: $val F: $id2";
|
||||
$changedTxt = "temperature: $val";
|
||||
|
||||
} elsif ($type eq "E") {
|
||||
if($now - $def->{lastH} < $def->{minsecs} ) {
|
||||
return "";
|
||||
} else {
|
||||
$def->{lastH} = $now;
|
||||
$msgtype = "humidity";
|
||||
$val = $valraw;
|
||||
Log $ll4, "CUL_TX $msgtype $name $id3 H: $val F: $id2";
|
||||
|
@ -2497,12 +2497,18 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<a name="CUL_TXdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> CUL_TX <code> [corr]</code> <br>
|
||||
<code>define <name> CUL_TX <code> [corr] [minsecs]</code> <br>
|
||||
|
||||
<br>
|
||||
<code> is the code of the autogenerated address of the TX device (0
|
||||
to 127)<br>
|
||||
corr is a correction factor, which will be added to the value received from
|
||||
the device.
|
||||
the device.<br>
|
||||
minsecs are the minimum seconds between two log entries or notifications
|
||||
from this device. <br>E.g. if set to 300, logs of the same type will occure
|
||||
with a minimum rate of one per 5 minutes even if the device sends a message
|
||||
every minute. (Reduces the log file size and reduces the time to display
|
||||
the plots)
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user