34_panStamp.pm: added dummy mode for fhem2fhem

git-svn-id: https://svn.fhem.de/fhem/trunk@7888 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2015-02-05 21:18:57 +00:00
parent 8d6eb0411a
commit ab5bfdf751

View File

@ -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 <name> panStamp {devicename[\@baudrate] ".
my $msg = "wrong syntax: define <name> panStamp {none | devicename[\@baudrate] ".
"| devicename\@directio} [<address> [<channel> [<syncword>]]]";
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();