2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 01:14:19 +00:00

98_dummy.pm: add disable/disabledForIntervals

git-svn-id: https://svn.fhem.de/fhem/trunk@12596 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-11-17 16:27:57 +00:00
parent 18e86c6588
commit 165ee7b65c
2 changed files with 11 additions and 1 deletions

View File

@ -14,6 +14,7 @@ dummy_Initialize($)
$hash->{SetFn} = "dummy_Set"; $hash->{SetFn} = "dummy_Set";
$hash->{DefFn} = "dummy_Define"; $hash->{DefFn} = "dummy_Define";
$hash->{AttrList} = "readingList setList useSetExtensions " . $hash->{AttrList} = "readingList setList useSetExtensions " .
"disable disabledForIntervals ".
$readingFnAttributes; $readingFnAttributes;
} }
@ -37,6 +38,11 @@ dummy_Set($@)
return "Unknown argument ?, choose one of $setList" if($a[0] eq "?"); 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 @rl = split(" ", AttrVal($name, "readingList", ""));
my $doRet; my $doRet;
eval { eval {
@ -110,6 +116,8 @@ dummy_Define($$)
<a name="dummyattr"></a> <a name="dummyattr"></a>
<b>Attributes</b> <b>Attributes</b>
<ul> <ul>
<li><a href="#disable">disable</a></li>
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
<li><a name="readingList">readingList</a><br> <li><a name="readingList">readingList</a><br>
Space separated list of readings, which will be set, if the first Space separated list of readings, which will be set, if the first
argument of the set command matches one of them.</li> argument of the set command matches one of them.</li>
@ -171,6 +179,8 @@ dummy_Define($$)
<a name="dummyattr"></a> <a name="dummyattr"></a>
<b>Attributes</b> <b>Attributes</b>
<ul> <ul>
<li><a href="#disable">disable</a></li>
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
<li><a name="readingList">readingList</a><br> <li><a name="readingList">readingList</a><br>
Leerzeichen getrennte Liste mit Readings, die mit "set" gesetzt werden Leerzeichen getrennte Liste mit Readings, die mit "set" gesetzt werden
k&ouml;nnen.</li> k&ouml;nnen.</li>

View File

@ -1590,7 +1590,7 @@ ReplaceSetMagic($$@) # Forum #38276
$a =~ s/\[([a-z0-9._]+):([a-z0-9._-]+)(:d)?\]/{ $a =~ s/\[([a-z0-9._]+):([a-z0-9._-]+)(:d)?\]/{
my $x = $3 ? ReadingsNum($1,$2,"") : ReadingsVal($1,$2,""); my $x = $3 ? ReadingsNum($1,$2,"") : ReadingsVal($1,$2,"");
$x eq "" ? "[$1:$2$3]" : $x $x eq "" ? "[$1:$2".($3?$3:"")."]" : $x
}/egi; }/egi;
$evalSpecials->{'%DEV'} = $hash->{NAME}; $evalSpecials->{'%DEV'} = $hash->{NAME};