diff --git a/FHEM/09_BS.pm b/FHEM/09_BS.pm index 579c55105..06d182818 100644 --- a/FHEM/09_BS.pm +++ b/FHEM/09_BS.pm @@ -22,7 +22,8 @@ BS_Initialize($) $hash->{DefFn} = "BS_Define"; $hash->{UndefFn} = "BS_Undef"; $hash->{ParseFn} = "BS_Parse"; - $hash->{AttrList} = "IODev do_not_notify:1,0 showtime:0,1 dummy:1,0 model:BS loglevel:0,1,2,3,4,5,6"; + $hash->{AttrList} = "do_not_notify:1,0 showtime:0,1 ". + "ignore:1,0 model:BS loglevel:0,1,2,3,4,5,6"; } @@ -88,6 +89,7 @@ BS_Parse($$) } my $name= $def->{NAME}; + return "" if(IsIgnored($name)); my $t= TimeNow(); diff --git a/FHEM/09_CUL_FHTTK.pm b/FHEM/09_CUL_FHTTK.pm index cfab6212a..0d968301e 100644 --- a/FHEM/09_CUL_FHTTK.pm +++ b/FHEM/09_CUL_FHTTK.pm @@ -112,7 +112,8 @@ CUL_FHTTK_Initialize($) $hash->{DefFn} = "CUL_FHTTK_Define"; $hash->{UndefFn} = "CUL_FHTTK_Undef"; $hash->{ParseFn} = "CUL_FHTTK_Parse"; - $hash->{AttrList} = "IODev do_not_notify:1,0 showtime:0,1 dummy:1,0 model:FHT80TF loglevel:0,1,2,3,4,5,6"; + $hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 showtime:0,1 " . + "model:FHT80TF loglevel:0,1,2,3,4,5,6"; } @@ -168,6 +169,8 @@ CUL_FHTTK_Parse($$) my $self = $def->{NAME}; my $state = lc(substr($msg, 7, 2)); + return "" if(IsIgnored($self)); + if(!defined($fhttfk_translatedcodes{$state})) { Log 3, sprintf("FHTTK $def Unknown state $state"); $defs{$self}{READINGS}{"Unknown"}{VAL} = $state; diff --git a/FHEM/09_USF1000.pm b/FHEM/09_USF1000.pm index 21b657519..2319080e7 100644 --- a/FHEM/09_USF1000.pm +++ b/FHEM/09_USF1000.pm @@ -24,7 +24,8 @@ USF1000_Initialize($) $hash->{DefFn} = "USF1000_Define"; $hash->{UndefFn} = "USF1000_Undef"; $hash->{ParseFn} = "USF1000_Parse"; - $hash->{AttrList} = "IODev do_not_notify:1,0 showtime:0,1 dummy:1,0 model:usf1000s loglevel:0,1,2,3,4,5,6"; + $hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 showtime:0,1 " . + "model:usf1000s loglevel:0,1,2,3,4,5,6"; } @@ -97,6 +98,8 @@ USF1000_Parse($$) my $def= $modules{USF1000}{defptr}{$dev}; my $name= $def->{NAME}; + return "" if(IsIgnored($name)); + my $t= TimeNow(); # Msg format: diff --git a/FHEM/10_FS20.pm b/FHEM/10_FS20.pm index e6b3c2c9a..88aeac374 100755 --- a/FHEM/10_FS20.pm +++ b/FHEM/10_FS20.pm @@ -106,7 +106,7 @@ FS20_Initialize($) $hash->{DefFn} = "FS20_Define"; $hash->{UndefFn} = "FS20_Undef"; $hash->{ParseFn} = "FS20_Parse"; - $hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 dummy:1,0 showtime:1,0 model;fs20hgs,fs20hgs,fs20pira,fs20piri,fs20s20,fs20s8,fs20s4,fs20s4a,fs20s4m,fs20s4u,fs20s4ub,fs20sd,fs20sn,fs20sr,fs20ss,fs20str,fs20tfk,fs20tfk,fs20tk,fs20uts,fs20ze,fs20as1,fs20as4,fs20di,fs20du,fs20ls,fs20ms2,fs20rst,fs20sa,fs20sig,fs20st,fs20sv,fs20usr loglevel:0,1,2,3,4,5,6"; + $hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 ignore:0,1 dummy:1,0 showtime:1,0 model;fs20hgs,fs20hgs,fs20pira,fs20piri,fs20s20,fs20s8,fs20s4,fs20s4a,fs20s4m,fs20s4u,fs20s4ub,fs20sd,fs20sn,fs20sr,fs20ss,fs20str,fs20tfk,fs20tfk,fs20tk,fs20uts,fs20ze,fs20as1,fs20as4,fs20di,fs20du,fs20ls,fs20ms2,fs20rst,fs20sa,fs20sig,fs20st,fs20sv,fs20usr loglevel:0,1,2,3,4,5,6"; } @@ -206,8 +206,7 @@ FS20_Set($@) return "Specified timeout too large, max is 15360" if(length($c) == 2); } - IOWrite($hash, "04", "010101" . $hash->{XMIT} . $hash->{BTN} . $c) - if(!IsDummy($a[0])); + IOWrite($hash, "04", "010101" . $hash->{XMIT} . $hash->{BTN} . $c); ########################################### # Set the state of a device to off if on-for-timer is called @@ -356,6 +355,8 @@ FS20_Parse($$) my $lh = $def->{$n}; $n = $lh->{NAME}; # It may be renamed + return "" if(IsIgnored($n)); # Little strange. + $lh->{CHANGED}[0] = $v; $lh->{STATE} = $v; $lh->{READINGS}{state}{TIME} = TimeNow(); diff --git a/FHEM/11_FHT.pm b/FHEM/11_FHT.pm index c53323fbb..afe678e50 100755 --- a/FHEM/11_FHT.pm +++ b/FHEM/11_FHT.pm @@ -144,7 +144,7 @@ FHT_Initialize($) $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 lazy tmpcorr"; + "minfhtbuffer lazy tmpcorr ignore:0,1"; } @@ -267,7 +267,7 @@ FHT_Set($@) } else { - IOWrite($hash, "04", $arg) if(!IsDummy($name)); + IOWrite($hash, "04", $arg); Log GetLogLevel($name,2), "FHT set $name $allcmd"; } @@ -343,6 +343,7 @@ FHT_Parse($$) my $def = $modules{FHT}{defptr}{$dev}; my $name = $def->{NAME}; + return "" if(IsIgnored($name)); # Short message if(length($msg) < 26) { @@ -502,7 +503,7 @@ doSoftBuffer($) my $arglen = length($h->{ARG})/2 - 2; # Length in bytes next if($fhzbuflen < $arglen || $fhzbuflen < getFhtMin($io)); - IOWrite($h->{HASH}, "04", $h->{ARG}) if(!IsDummy($name)); + IOWrite($h->{HASH}, "04", $h->{ARG}); Log GetLogLevel($name,2), "FHT set $name $h->{CMD}"; $fhzbuflen -= $arglen; diff --git a/FHEM/12_HMS.pm b/FHEM/12_HMS.pm index 1a7923e76..2c045f560 100755 --- a/FHEM/12_HMS.pm +++ b/FHEM/12_HMS.pm @@ -37,7 +37,7 @@ HMS_Initialize($) $hash->{DefFn} = "HMS_Define"; $hash->{UndefFn} = "HMS_Undef"; $hash->{ParseFn} = "HMS_Parse"; - $hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model;hms100-t,hms100-tf,hms100-wd,hms100-mg,hms100-tfk,rm100-2,hms100-co,hms100-fit loglevel:0,1,2,3,4,5,6"; + $hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model;hms100-t,hms100-tf,hms100-wd,hms100-mg,hms100-tfk,rm100-2,hms100-co,hms100-fit loglevel:0,1,2,3,4,5,6 ignore:0,1"; } ##################################### @@ -106,6 +106,8 @@ HMS_Parse($$) } my $def = $modules{HMS}{defptr}{$dev}; + my $name = $def->{NAME}; + return "" if(IsIgnored($name)); my (@v, @txt); @@ -209,7 +211,7 @@ HMS_Parse($$) } my $now = TimeNow(); - Log GetLogLevel($def->{NAME},4), "HMS Device $dev ($type: $val)"; + Log GetLogLevel($name,4), "HMS Device $dev ($type: $val)"; my $max = int(@txt); for( my $i = 0; $i < $max; $i++) { @@ -224,7 +226,7 @@ HMS_Parse($$) $def->{CHANGED}[$max++] = $val; $def->{CHANGED}[$max++] = "ExactId: $odev" if($odev ne $dev); - return $def->{NAME}; + return $name; } 1; diff --git a/FHEM/13_KS300.pm b/FHEM/13_KS300.pm index 29123057a..2e22a844a 100755 --- a/FHEM/13_KS300.pm +++ b/FHEM/13_KS300.pm @@ -19,7 +19,7 @@ KS300_Initialize($) $hash->{DefFn} = "KS300_Define"; $hash->{UndefFn} = "KS300_Undef"; $hash->{ParseFn} = "KS300_Parse"; - $hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:ks300 loglevel:0,1 rainadjustment:0,1"; + $hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:ks300 loglevel:0,1 rainadjustment:0,1 ignore:0,1"; } ##################################### @@ -87,6 +87,7 @@ KS300_Parse($$) my $def = $modules{KS300}{defptr}{$dev}; my $haverain = 0; my $name= $def->{NAME}; + return "" if(IsIgnored($name)); my @v; my @txt = ( "rain_raw", "rain", "wind", "humidity", "temperature", diff --git a/FHEM/14_CUL_WS.pm b/FHEM/14_CUL_WS.pm index f18a13fa5..5f0bc6685 100755 --- a/FHEM/14_CUL_WS.pm +++ b/FHEM/14_CUL_WS.pm @@ -24,7 +24,7 @@ CUL_WS_Initialize($) $hash->{UndefFn} = "CUL_WS_Undef"; $hash->{AttrFn} = "CUL_WS_Attr"; $hash->{ParseFn} = "CUL_WS_Parse"; - $hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:S300TH,KS300 loglevel"; + $hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:S300TH,KS300 loglevel ignore:0,1"; } @@ -94,6 +94,8 @@ CUL_WS_Parse($$) my $tm=TimeNow(); $hash = $def; + my $name = $hash->{NAME}; + return "" if(IsIgnored($name)); my $typbyte = hex($a[2]) & 7; my $sfirstbyte = $firstbyte & 7; @@ -217,7 +219,6 @@ CUL_WS_Parse($$) } - my $name = $hash->{NAME}; if(!$val) { Log GetLogLevel($name,1), "CUL_WS Cannot decode $msg"; return ""; diff --git a/FHEM/15_CUL_EM.pm b/FHEM/15_CUL_EM.pm index 915ae2c6c..33f7319cc 100755 --- a/FHEM/15_CUL_EM.pm +++ b/FHEM/15_CUL_EM.pm @@ -20,7 +20,8 @@ CUL_EM_Initialize($) $hash->{DefFn} = "CUL_EM_Define"; $hash->{UndefFn} = "CUL_EM_Undef"; $hash->{ParseFn} = "CUL_EM_Parse"; - $hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:EMEM,EMWZ,EMGZ loglevel"; + $hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 " . + "model:EMEM,EMWZ,EMGZ loglevel ignore:0,1"; } ##################################### @@ -106,14 +107,14 @@ CUL_EM_Parse($$) if($modules{CUL_EM}{defptr}{$cde}) { my $def = $modules{CUL_EM}{defptr}{$cde}; - $hash = $def; + my $n = $hash->{NAME}; + return "" if(IsIgnored($n)); my $tn = TimeNow(); # current time my $c= 0; # count changes my %readings; - my $n = $hash->{NAME}; Log GetLogLevel($n,5), "CUL_EM $n: $val"; $readings{RAW} = $val; diff --git a/FHEM/16_CUL_RFR.pm b/FHEM/16_CUL_RFR.pm index c1d1bfc76..0cacc2829 100755 --- a/FHEM/16_CUL_RFR.pm +++ b/FHEM/16_CUL_RFR.pm @@ -22,7 +22,8 @@ CUL_RFR_Initialize($) $hash->{DefFn} = "CUL_RFR_Define"; $hash->{UndefFn} = "CUL_RFR_Undef"; $hash->{ParseFn} = "CUL_RFR_Parse"; - $hash->{AttrList} = "IODev do_not_notify:0,1 model:CUL,CUN,CUR loglevel"; + $hash->{AttrList} = "IODev do_not_notify:0,1 model:CUL,CUN,CUR " . + "loglevel:0,1,2,3,4,5,6 ignore:0,1"; $hash->{WriteFn} = "CUL_RFR_Write"; $hash->{GetFn} = "CUL_Get"; @@ -87,6 +88,7 @@ CUL_RFR_Parse($$) } my $hash = $modules{CUL_RFR}{defptr}{$cde}; my $name = $hash->{NAME}; + return "" if(IsIgnored($name)); if($smsg =~ m/^T/) { $hash->{NR_TMSG}++ } elsif($smsg =~ m/^F/) { $hash->{NR_FMSG}++ } diff --git a/FHEM/20_OWFS.pm b/FHEM/20_OWFS.pm index 4de233735..2556fb77c 100644 --- a/FHEM/20_OWFS.pm +++ b/FHEM/20_OWFS.pm @@ -67,9 +67,8 @@ OWFS_Initialize($) $hash->{UndefFn} = "OWFS_Undef"; $hash->{GetFn} = "OWFS_Get"; #$hash->{SetFn} = "OWFS_Set"; - $hash->{AttrList} = "do_not_notify:1,0 dummy:1,0 temp-scale:C,F,K,R " . - "showtime:1,0 loglevel:0,1,2,3,4,5,6"; -} + $hash->{AttrList} = "IODev do_not_notify:1,0 dummy:1,0 temp-scale:C,F,K,R ". + "showtime:1,0 loglevel:0,1,2,3,4,5,6"; } ##################################### sub diff --git a/FHEM/20_X10.pm b/FHEM/20_X10.pm index c59eade8c..c303fca0f 100755 --- a/FHEM/20_X10.pm +++ b/FHEM/20_X10.pm @@ -102,7 +102,9 @@ X10_Initialize($) $hash->{DefFn} = "X10_Define"; $hash->{UndefFn} = "X10_Undef"; $hash->{ParseFn} = "X10_Parse"; - $hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 dummy:1,0 showtime:1,0 model:lm12,lm15,am12,tm13 loglevel:0,1,2,3,4,5,6"; + $hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 " . + "dummy:1,0 showtime:1,0 model:lm12,lm15,am12,tm13 " . + "loglevel:0,1,2,3,4,5,6"; } diff --git a/FHEM/99_XmlList.pm b/FHEM/99_XmlList.pm index 72a8c42a2..beff4e0fc 100644 --- a/FHEM/99_XmlList.pm +++ b/FHEM/99_XmlList.pm @@ -45,6 +45,7 @@ CommandXmlList($$) $modules{$defs{$b}{TYPE}}{ORDER}; $x = ($a cmp $b) if($x == 0); $x; } keys %defs) { + next if(IsIgnored($d)); my $p = $defs{$d}; my $t = $p->{TYPE}; diff --git a/HISTORY b/HISTORY index 573175bd1..0991bf8cd 100644 --- a/HISTORY +++ b/HISTORY @@ -464,3 +464,4 @@ - my %defptr is no $modules{modname}{defptr} in order for CommandReload to work. There is also a second parameter $modules{modname}{ldata} which will be saved over a Reload, used by the FS20 for the follow feature. + - ignore attribute added to ignore devices of the neighbour diff --git a/docs/commandref.html b/docs/commandref.html index 45f625223..1134a11a7 100644 --- a/docs/commandref.html +++ b/docs/commandref.html @@ -1249,6 +1249,16 @@ A line ending with \ will be concatenated with the next one, so long lines
+ +
  • ignore
    + Ignore this device, e.g. if it belongs to your neighbour. The device + won't trigger any FileLogs/notifys, issued commands will silently + ignored (no RF signal will be sent out, just like for the dummy attribute). The device won't appear in the + list command (only if it is explicitely asked for it), nor will it + appear in commands which use some wildcard/attribute as name specifiers + (see devspec). You still get them with the + "ignored=1" special devspec.
  • @@ -1449,6 +1459,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes
    @@ -3402,7 +3424,7 @@ A line ending with \ will be concatenated with the next one, so long lines
  • Title with maximum and current values of the 1st curve (FileLog)
  • @@ -4138,8 +4160,8 @@ A line ending with \ will be concatenated with the next one, so long lines Plots the measured-temp/desired-temp/actuator lines. The corresponding filelog definitions (for the FHT device named fht1) looks like:
    - define FileLog fhtlog1 fht1:.*(temp|actuator).* - /var/log/fht1-%Y-%U.log + define fhtlog1 FileLog fht1:.*(temp|actuator).* /var/log/fht1-%Y-%U.log +
  • ks300
    Plots the temperature and rain (per hour and per day) of a diff --git a/examples/sample_pgm2 b/examples/sample_pgm2 index 36a4f2696..d405c008b 100644 --- a/examples/sample_pgm2 +++ b/examples/sample_pgm2 @@ -7,7 +7,7 @@ attr global port 7072 # our TCP/IP port (localhost only) attr global statefile /tmp/fhem.save # where to save the state of the devices attr global verbose 3 # "normal" verbosity (min 1, max 5) -#define CUL CUL /dev/ttyACM0 +#define CUL CUL /dev/ttyACM0 1234 #define FHEM FHEM /dev/USB0 define WEB FHEMWEB 8083 global diff --git a/fhem.pl b/fhem.pl index 69f374add..98425c2cc 100755 --- a/fhem.pl +++ b/fhem.pl @@ -73,6 +73,8 @@ sub devspec2array($); sub doGlobalDef($); sub fhem($); sub fhz($); +sub IsDummy($); +sub IsIgnored($); sub CommandAttr($$); sub CommandDefaultAttr($$); @@ -157,7 +159,7 @@ my $nextat; # Time when next timer will be triggered. my $intAtCnt=0; my %duplicate; # Pool of received msg for multi-fhz/cul setups my $duplidx=0; # helper for the above pool -my $cvsid = '$Id: fhem.pl,v 1.95 2010-01-01 13:48:33 rudolfkoenig Exp $'; +my $cvsid = '$Id: fhem.pl,v 1.96 2010-01-01 14:53:03 rudolfkoenig Exp $'; my $namedef = "where is either:\n" . "- a single device name\n" . @@ -400,6 +402,17 @@ IsDummy($) return 0; } +sub +IsIgnored($) +{ + my $devname = shift; + return 1 if($devname && + defined($attr{$devname}) && + defined($attr{$devname}{ignore})); + return 0; +} + + ################################################ sub IsIoDummy($) @@ -472,9 +485,11 @@ IOWrite($@) { my ($hash, @a) = @_; + my $dev = $hash->{NAME}; + return if(IsDummy($dev) || IsIgnored($dev)); my $iohash = $hash->{IODev}; if(!$iohash) { - Log 5, "No IO device found for $hash->{NAME}"; + Log 5, "No IO device found for $dev"; return; } @@ -679,6 +694,8 @@ devspec2array($) } return $name if(!@ret && !$isattr); # No match, return the input + @ret = grep { !$attr{$_} || !$attr{$_}{ignore} } @ret + if($name !~ m/^ignore=/); return @ret; } @@ -1213,6 +1230,7 @@ CommandList($$) for my $d (sort { my $x = $modules{$defs{$a}{TYPE}}{ORDER} cmp $modules{$defs{$b}{TYPE}}{ORDER}; $x = ($a cmp $b) if($x == 0); $x; } keys %defs) { + next if(IsIgnored($d)); my $t = $defs{$d}{TYPE}; $str .= "\n$t:\n" if($t ne $lt); $str .= sprintf(" %-20s (%s)\n", $d, $defs{$d}{STATE}); diff --git a/webfrontend/pgm2/01_FHEMWEB.pm b/webfrontend/pgm2/01_FHEMWEB.pm index 10d3358e7..c6cff5579 100755 --- a/webfrontend/pgm2/01_FHEMWEB.pm +++ b/webfrontend/pgm2/01_FHEMWEB.pm @@ -191,8 +191,10 @@ FW_Read($) $hash->{BUF} = ""; Log($ll, "HTTP $name GET $arg"); - $hash->{INUSE} = 1; + my $pid; + return if(($arg =~ m/cmd=showlog/) && ($pid = fork)); + $hash->{INUSE} = 1; my $cacheable = FW_AnswerCall($arg); delete($hash->{INUSE}); @@ -210,6 +212,7 @@ FW_Read($) $e, "Content-Type: $__RETTYPE\r\n\r\n", $__RET; + exit if(defined($pid)); } ########################### @@ -387,6 +390,7 @@ FW_updateHashes() # Make a room hash %__rooms = (); foreach my $d (keys %defs ) { + next if(IsIgnored($d)); foreach my $r (split(",", FW_getAttr($d, "room", "Unsorted"))) { $__rooms{$r}{$d} = 1; } @@ -396,6 +400,7 @@ FW_updateHashes() # Needed for type sorting %__types = (); foreach my $d (sort keys %defs ) { + next if(IsIgnored($d)); $__types{$defs{$d}{TYPE}}{$d} = 1; }