diff --git a/fhem/CHANGED b/fhem/CHANGED index 172e4b089..642c665ee 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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 diff --git a/fhem/FHEM/14_CUL_TX.pm b/fhem/FHEM/14_CUL_TX.pm index bc2c3d703..124990e7c 100644 --- a/fhem/FHEM/14_CUL_TX.pm +++ b/fhem/FHEM/14_CUL_TX.pm @@ -28,11 +28,14 @@ CUL_TX_Define($$) my ($hash, $def) = @_; my @a = split("[ \t][ \t]*", $def); - return "wrong syntax: define CUL_TX [corr]" - if(int(@a) < 3 || int(@a) > 4); + return "wrong syntax: define CUL_TX [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"; diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html index 142718a44..921ba5acb 100644 --- a/fhem/docs/commandref.html +++ b/fhem/docs/commandref.html @@ -2497,12 +2497,18 @@ A line ending with \ will be concatenated with the next one, so long lines Define
    - define <name> CUL_TX <code> [corr]
    + define <name> CUL_TX <code> [corr] [minsecs]
    +
    <code> is the code of the autogenerated address of the TX device (0 to 127)
    corr is a correction factor, which will be added to the value received from - the device. + the device.
    + minsecs are the minimum seconds between two log entries or notifications + from this device.
    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)