From ab5bfdf751d6a9c62e3147fc10d95efafd2b9cf8 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Thu, 5 Feb 2015 21:18:57 +0000 Subject: [PATCH] 34_panStamp.pm: added dummy mode for fhem2fhem git-svn-id: https://svn.fhem.de/fhem/trunk@7888 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/34_panStamp.pm | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/fhem/FHEM/34_panStamp.pm b/fhem/FHEM/34_panStamp.pm index 207324ece..02347ad54 100755 --- a/fhem/FHEM/34_panStamp.pm +++ b/fhem/FHEM/34_panStamp.pm @@ -43,7 +43,7 @@ panStamp_Initialize($) #$hash->{GetFn} = "panStamp_Get"; $hash->{SetFn} = "panStamp_Set"; #$hash->{AttrFn} = "panStamp_Attr"; - #$hash->{AttrList}= ""; + $hash->{AttrList}= "dummy:1,0"; $hash->{ShutdownFn} = "panStamp_Shutdown"; } @@ -60,7 +60,7 @@ panStamp_Define($$) my @a = split("[ \t][ \t]*", $def); if(@a < 3 || @a > 6) { - my $msg = "wrong syntax: define panStamp {devicename[\@baudrate] ". + my $msg = "wrong syntax: define panStamp {none | devicename[\@baudrate] ". "| devicename\@directio} [
[ []]]"; Log3 undef, 2, $msg; return $msg; @@ -80,22 +80,27 @@ panStamp_Define($$) DevIo_CloseDev($hash); - my $name = $a[0]; + $hash->{Clients} = $clientsPanStamp; + $hash->{MatchList} = \%matchListSWAP; + my $name = $a[0]; my $dev = $a[2]; + + if($dev eq "none") { + Log3 $name, 1, "$name device is none, commands will be echoed only"; + $attr{$name}{dummy} = 1; + return undef; + } $dev .= "\@38400" if( $dev !~ m/\@/ ); $hash->{address} = uc($address); $hash->{channel} = uc($channel); $hash->{syncword} = uc($syncword); - $hash->{Clients} = $clientsPanStamp; - $hash->{MatchList} = \%matchListSWAP; + $hash->{nonce} = 0; $hash->{DeviceName} = $dev; - $hash->{nonce} = 0; - my $ret = DevIo_OpenDev($hash, 0, "panStamp_DoInit"); return $ret; } @@ -167,6 +172,9 @@ sub panStamp_Get($@) { my ($hash, @a) = @_; + my $name = $hash->{NAME}; + + return "No $a[1] for dummies" if(IsDummy($name)); #$hash->{READINGS}{$a[1]}{VAL} = $msg; $hash->{READINGS}{$a[1]}{TIME} = TimeNow();