mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
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:
parent
8d6eb0411a
commit
ab5bfdf751
@ -43,7 +43,7 @@ panStamp_Initialize($)
|
|||||||
#$hash->{GetFn} = "panStamp_Get";
|
#$hash->{GetFn} = "panStamp_Get";
|
||||||
$hash->{SetFn} = "panStamp_Set";
|
$hash->{SetFn} = "panStamp_Set";
|
||||||
#$hash->{AttrFn} = "panStamp_Attr";
|
#$hash->{AttrFn} = "panStamp_Attr";
|
||||||
#$hash->{AttrList}= "";
|
$hash->{AttrList}= "dummy:1,0";
|
||||||
|
|
||||||
$hash->{ShutdownFn} = "panStamp_Shutdown";
|
$hash->{ShutdownFn} = "panStamp_Shutdown";
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ panStamp_Define($$)
|
|||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
|
|
||||||
if(@a < 3 || @a > 6) {
|
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>]]]";
|
"| devicename\@directio} [<address> [<channel> [<syncword>]]]";
|
||||||
Log3 undef, 2, $msg;
|
Log3 undef, 2, $msg;
|
||||||
return $msg;
|
return $msg;
|
||||||
@ -80,22 +80,27 @@ panStamp_Define($$)
|
|||||||
|
|
||||||
DevIo_CloseDev($hash);
|
DevIo_CloseDev($hash);
|
||||||
|
|
||||||
my $name = $a[0];
|
$hash->{Clients} = $clientsPanStamp;
|
||||||
|
$hash->{MatchList} = \%matchListSWAP;
|
||||||
|
|
||||||
|
my $name = $a[0];
|
||||||
my $dev = $a[2];
|
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/\@/ );
|
$dev .= "\@38400" if( $dev !~ m/\@/ );
|
||||||
|
|
||||||
$hash->{address} = uc($address);
|
$hash->{address} = uc($address);
|
||||||
$hash->{channel} = uc($channel);
|
$hash->{channel} = uc($channel);
|
||||||
$hash->{syncword} = uc($syncword);
|
$hash->{syncword} = uc($syncword);
|
||||||
|
|
||||||
$hash->{Clients} = $clientsPanStamp;
|
$hash->{nonce} = 0;
|
||||||
$hash->{MatchList} = \%matchListSWAP;
|
|
||||||
|
|
||||||
$hash->{DeviceName} = $dev;
|
$hash->{DeviceName} = $dev;
|
||||||
|
|
||||||
$hash->{nonce} = 0;
|
|
||||||
|
|
||||||
my $ret = DevIo_OpenDev($hash, 0, "panStamp_DoInit");
|
my $ret = DevIo_OpenDev($hash, 0, "panStamp_DoInit");
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
@ -167,6 +172,9 @@ sub
|
|||||||
panStamp_Get($@)
|
panStamp_Get($@)
|
||||||
{
|
{
|
||||||
my ($hash, @a) = @_;
|
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]}{VAL} = $msg;
|
||||||
$hash->{READINGS}{$a[1]}{TIME} = TimeNow();
|
$hash->{READINGS}{$a[1]}{TIME} = TimeNow();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user