From fa90a6d26b74a0fcea53fa2cb99e63bb1ba85369 Mon Sep 17 00:00:00 2001 From: neubert Date: Tue, 9 Jun 2009 19:55:28 +0000 Subject: [PATCH] - feature: lazy attribute for FHT devices (Boris 2009-06-09) git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@387 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- CHANGED | 3 ++- FHEM/11_FHT.pm | 28 ++++++++++++++++++++++------ HISTORY | 3 +++ docs/commandref.html | 11 ++++++++++- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/CHANGED b/CHANGED index 333350623..199962555 100644 --- a/CHANGED +++ b/CHANGED @@ -501,4 +501,5 @@ - bugfix: sunrise stuff fixed, doc missing - feature: CUL FHT sending added - bugfix: workaround to make M232 counter wraparound - - feature: Google Weather API support form FHEM (Boris 2009-06-01) \ No newline at end of file + - feature: Google Weather API support form FHEM (Boris 2009-06-01) + - feature: lazy attribute for FHT devices (Boris 2009-06-09) \ No newline at end of file diff --git a/FHEM/11_FHT.pm b/FHEM/11_FHT.pm index 953edd79e..31ac31696 100755 --- a/FHEM/11_FHT.pm +++ b/FHEM/11_FHT.pm @@ -144,7 +144,7 @@ FHT_Initialize($) $hash->{UndefFn} = "FHT_Undef"; $hash->{ParseFn} = "FHT_Parse"; $hash->{AttrList} = "IODev do_not_notify:0,1 model;fht80b dummy:0,1 " . - "showtime:0,1 loglevel:0,1,2,3,4,5,6 retrycount minfhtbuffer"; + "showtime:0,1 loglevel:0,1,2,3,4,5,6 retrycount minfhtbuffer lazy"; } @@ -175,19 +175,22 @@ FHT_Set($@) my $arg = "020183" . $hash->{CODE}; my ($cmd, $allcmd, $val) = ("", "", ""); + my $lazy= defined($attr{$name}) && + defined($attr{$name}{"lazy"}) && + ($attr{$name}{"lazy"}>0); + my $readings= $hash->{READINGS}; + + while(@a) { $cmd = shift(@a); - $allcmd .=" " if($allcmd); - $allcmd .= $cmd; - return "Unknown argument $cmd, choose one of " . join(" ",sort keys %c2bset) if(!defined($c2b{$cmd})); return "Readonly parameter $cmd" if(defined($cantset{$cmd})); return "\"set $name $cmd\" needs a parameter" if(@a < 1); - $ncmd++; + $val = shift(@a); $arg .= $c2b{$cmd}; @@ -231,12 +234,25 @@ FHT_Set($@) $arg .= sprintf("%02x", $val) if(defined($val)); } - $allcmd .= " $val" if($val); + + + if($lazy && defined($readings->{$cmd}) && $readings->{$cmd}{VAL} eq $val) { + $ret .= "Lazy mode ignores $cmd"; + Log GetLogLevel($name,2), "Lazy mode ignores $cmd $val"; + + } else { + $ncmd++; + $allcmd .=" " if($allcmd); + $allcmd .= $cmd; + $allcmd .= " $val" if($val); + } } return "Too many commands specified, an FHT only supports up to 8" if($ncmd > 8); + return $ret if(!$ncmd); + my $ioname = ""; $ioname = $hash->{IODev}->{NAME} if($hash->{IODev}); if($attr{$ioname} && $attr{$ioname}{fhtsoftbuffer}) { diff --git a/HISTORY b/HISTORY index 2682be50e..ae8b3e2f0 100644 --- a/HISTORY +++ b/HISTORY @@ -407,3 +407,6 @@ - Mon Jun 01 2009 (Boris) - 59_Weather.pm: new virtual device for weather forecasts, documentation updated. + +- Tue Jun 09 2009 (Boris) + - 11_FHT.pm: lazy attribute for FHT devices \ No newline at end of file diff --git a/docs/commandref.html b/docs/commandref.html index 2f860f6d6..4a68fbe06 100644 --- a/docs/commandref.html +++ b/docs/commandref.html @@ -1439,12 +1439,21 @@ A line ending with \ will be concatenated with the next one, so long lines
  • minfhtbuffer
    Can be applied to FHT devices.
    - FHEM wont send commands to the FHZ if its fhtbuffer is below + FHEM won't send commands to the FHZ if its fhtbuffer is below this value, default is 0. If this value is low, then the ordering of fht commands (see the note in the FHT section of set) has little effect, as only commands in the softbuffer can be prioritized. The maximum value should be 7 below the hardware maximum (see fhtbuf). +

  • + + +
  • lazy
    + Can be applied to FHT devices.
    + If the lazy attribute is set, FHEM won't send commands to the FHT if + the current reading and the value to be set are already identical. This + may help avoiding violations of the max-1%-time-on-air rule in large + installations. Not set per default.