mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 12:58:13 +00:00
91_notify.pm: add disabledAfterTrigger (Forum #90663)
git-svn-id: https://svn.fhem.de/fhem/trunk@17225 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
11461a3606
commit
35254c7a86
@ -15,8 +15,20 @@ notify_Initialize($)
|
|||||||
$hash->{DefFn} = "notify_Define";
|
$hash->{DefFn} = "notify_Define";
|
||||||
$hash->{NotifyFn} = "notify_Exec";
|
$hash->{NotifyFn} = "notify_Exec";
|
||||||
$hash->{AttrFn} = "notify_Attr";
|
$hash->{AttrFn} = "notify_Attr";
|
||||||
$hash->{AttrList} ="disable:1,0 disabledForIntervals forwardReturnValue:1,0 ".
|
no warnings 'qw';
|
||||||
"readLog:1,0 showtime:1,0 addStateEvent:1,0 ignoreRegexp";
|
my @attrList = qw(
|
||||||
|
addStateEvent:1,0
|
||||||
|
disable:1,0
|
||||||
|
disabledForIntervals
|
||||||
|
disabledAfterTrigger
|
||||||
|
forwardReturnValue:1,0
|
||||||
|
ignoreRegexp
|
||||||
|
readLog:1,0
|
||||||
|
showtime:1,0
|
||||||
|
);
|
||||||
|
use warnings 'qw';
|
||||||
|
$hash->{AttrList} = join(" ", @attrList);
|
||||||
|
|
||||||
$hash->{SetFn} = "notify_Set";
|
$hash->{SetFn} = "notify_Set";
|
||||||
$hash->{StateFn} = "notify_State";
|
$hash->{StateFn} = "notify_State";
|
||||||
$hash->{FW_detailFn} = "notify_fhemwebFn";
|
$hash->{FW_detailFn} = "notify_fhemwebFn";
|
||||||
@ -70,6 +82,10 @@ notify_Exec($$)
|
|||||||
my $ln = $ntfy->{NAME};
|
my $ln = $ntfy->{NAME};
|
||||||
return "" if(IsDisabled($ln));
|
return "" if(IsDisabled($ln));
|
||||||
|
|
||||||
|
my $now = gettimeofday();
|
||||||
|
my $dat = AttrVal($ln, "disabledAfterTrigger", 0);
|
||||||
|
return "" if($ntfy->{TRIGGERTIME} && $now < $ntfy->{TRIGGERTIME}+$dat);
|
||||||
|
|
||||||
my $n = $dev->{NAME};
|
my $n = $dev->{NAME};
|
||||||
my $re = $ntfy->{REGEXP};
|
my $re = $ntfy->{REGEXP};
|
||||||
my $iRe = AttrVal($ln, "ignoreRegexp", undef);
|
my $iRe = AttrVal($ln, "ignoreRegexp", undef);
|
||||||
@ -104,6 +120,7 @@ notify_Exec($$)
|
|||||||
my $r = AnalyzeCommandChain(undef, $exec);
|
my $r = AnalyzeCommandChain(undef, $exec);
|
||||||
Log3 $ln, 3, "$ln return value: $r" if($r);
|
Log3 $ln, 3, "$ln return value: $r" if($r);
|
||||||
$ret .= " $r" if($r);
|
$ret .= " $r" if($r);
|
||||||
|
$ntfy->{TRIGGERTIME} = $now;
|
||||||
$ntfy->{STATE} =
|
$ntfy->{STATE} =
|
||||||
AttrVal($ln,'showtime',1) ? $dev->{NTFY_TRIGGERTIME} : 'active';
|
AttrVal($ln,'showtime',1) ? $dev->{NTFY_TRIGGERTIME} : 'active';
|
||||||
}
|
}
|
||||||
@ -504,6 +521,11 @@ END
|
|||||||
<li><a href="#disable">disable</a></li>
|
<li><a href="#disable">disable</a></li>
|
||||||
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
||||||
|
|
||||||
|
<a name="disabledAfterTrigger"></a>
|
||||||
|
<li>disabledAfterTrigger someSeconds<br>
|
||||||
|
disable the execution for someSeconds after it triggered.
|
||||||
|
</li>
|
||||||
|
|
||||||
<a name="addStateEvent"></a>
|
<a name="addStateEvent"></a>
|
||||||
<li>addStateEvent<br>
|
<li>addStateEvent<br>
|
||||||
The event associated with the state Reading is special, as the "state: "
|
The event associated with the state Reading is special, as the "state: "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user