############################################## # $Id$ package main; use strict; use warnings; use SetExtensions; sub dummy_Initialize($) { my ($hash) = @_; $hash->{SetFn} = "dummy_Set"; $hash->{DefFn} = "dummy_Define"; no warnings 'qw'; my @attrList = qw( disable disabledForIntervals readingList setExtensionsEvent:1,0 setList useSetExtensions ); use warnings 'qw'; $hash->{AttrList} = join(" ", @attrList)." $readingFnAttributes"; } ################################### sub dummy_Set($@) { my ($hash, @a) = @_; my $name = shift @a; return "no set value specified" if(int(@a) < 1); my $setList = AttrVal($name, "setList", " "); $setList =~ s/\n/ /g; if(AttrVal($name,"useSetExtensions",undef)) { my $a0 = $a[0]; $a0 =~ s/([.?*])/\\$1/g; if($setList !~ m/\b$a0\b/) { unshift @a, $name; return SetExtensions($hash, $setList, @a) } SetExtensionsCancel($hash); } else { return "Unknown argument ?, choose one of $setList" if($a[0] eq "?"); } return undef if($attr{$name} && # Avoid checking it if only STATE is inactive ($attr{$name}{disable} || $attr{$name}{disabledForIntervals}) && IsDisabled($name)); my @rl = split(" ", AttrVal($name, "readingList", "")); my $doRet; eval { if(@rl && grep /^$a[0]$/, @rl) { my $v = shift @a; readingsSingleUpdate($hash, $v, join(" ",@a), 1); $doRet = 1; } }; return if($doRet); my $v = join(" ", @a); Log3 $name, 4, "dummy set $name $v"; $v = $hash->{SetExtensionsCommand} if($hash->{SetExtensionsCommand} && AttrVal($name, "setExtensionsEvent", undef)); readingsSingleUpdate($hash,"state",$v,1); return undef; } sub dummy_Define($$) { my ($hash, $def) = @_; my @a = split("[ \t][ \t]*", $def); return "Wrong syntax: use define dummy" if(int(@a) != 2); return undef; } 1; =pod =item helper =item summary dummy device =item summary_DE dummy Gerät =begin html

dummy

=end html =begin html_DE

dummy

=end html_DE =cut