mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-12 22:56:34 +00:00
at/notify/watchdog: disabledForIntervals added
git-svn-id: https://svn.fhem.de/fhem/trunk@5179 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
85106ed069
commit
ae4796eee8
@ -1,6 +1,7 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
# Do not insert empty lines here, update check depends on it.
|
||||
- SVN
|
||||
- feature: disabledForIntervals attribute added for at/notify/watchdog
|
||||
- feature: jsonlist2 added, jsonlist is deprecated.
|
||||
- change: renamed 98_configDB to 98_configDBwrap
|
||||
- feature: DbLog: Added new function : ReadingsVal/ReadingsTimestamp
|
||||
|
@ -16,7 +16,8 @@ at_Initialize($)
|
||||
$hash->{UndefFn} = "at_Undef";
|
||||
$hash->{AttrFn} = "at_Attr";
|
||||
$hash->{StateFn} = "at_State";
|
||||
$hash->{AttrList} = "disable:0,1 skip_next:0,1 alignTime";
|
||||
$hash->{AttrList} = "disable:0,1 disabledForIntervals ".
|
||||
"skip_next:0,1 alignTime";
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +120,7 @@ at_Exec($)
|
||||
Log3 $name, 5, "exec at command $name";
|
||||
|
||||
my $skip = AttrVal($name, "skip_next", undef);
|
||||
my $disable = AttrVal($name, "disable", undef);
|
||||
my $disable = IsDisabled($name);
|
||||
|
||||
delete $attr{$name}{skip_next} if($skip);
|
||||
my (undef, $command) = split("[ \t]+", $hash->{DEF}, 2);
|
||||
@ -330,6 +331,17 @@ at_State($$$$)
|
||||
If applied to an <a href="#at">at</a>, the command will not be executed,
|
||||
but the next time will be computed.</li><br>
|
||||
|
||||
<a name="disabledForIntervals"></a>
|
||||
<li>disabledForIntervals HH:MM-HH:MM HH:MM-HH-MM...<br>
|
||||
Space separated list of HH:MM tupels. If the current time is between
|
||||
the two time specifications, the current device is disabled. Instead of
|
||||
HH:MM you can also specify HH or HH:MM:SS. To specify an interval
|
||||
spawning midnight, you have to specify two intervals, e.g.:
|
||||
<ul>
|
||||
23:00-24:00 00:00-01:00
|
||||
</ul>
|
||||
</li><br>
|
||||
|
||||
<a name="skip_next"></a>
|
||||
<li>skip_next<br>
|
||||
Used for at commands: skip the execution of the command the next
|
||||
@ -457,11 +469,23 @@ at_State($$$$)
|
||||
<ul>
|
||||
<a name="disable"></a>
|
||||
<li>disable<br>
|
||||
Kann für at/watchdog/notify/FileLog Devices gesetzt werden.<br>
|
||||
Deaktiviert das entsprechende at/notify oder FileLog Device. Hinweis:
|
||||
Wenn angewendet auf ein <a href="#at">at</a>, dann wird der Befehl
|
||||
nicht ausgeführt, jedoch die nächste Ausführungszeit
|
||||
berechnet.</li><br>
|
||||
Deaktiviert das entsprechende Ger&aauml;t.<br>
|
||||
Hinweis: Wenn angewendet auf ein <a href="#at">at</a>, dann wird der
|
||||
Befehl nicht ausgeführt, jedoch die nächste
|
||||
Ausführungszeit berechnet.</li><br>
|
||||
|
||||
<a name="disabledForIntervals"></a>
|
||||
<li>disabledForIntervals HH:MM-HH:MM HH:MM-HH-MM...<br>
|
||||
Das Argument ist eine Leerzeichengetrennte Liste von Minuszeichen-
|
||||
getrennten HH:MM Paaren. Falls die aktuelle Uhrzeit zwischen diesen
|
||||
Werten fällt, dann wird die Ausführung, wie beim disable,
|
||||
ausgesetzt. Statt HH:MM kann man auch HH oder HH:MM:SS angeben.
|
||||
Um einen Intervall um Mitternacht zu spezifizieren, muss man zwei
|
||||
einzelne angeben, z.Bsp.:
|
||||
<ul>
|
||||
23:00-24:00 00:00-01:00
|
||||
</ul>
|
||||
</li><br>
|
||||
|
||||
<a name="skip_next"></a>
|
||||
<li>skip_next<br>
|
||||
|
@ -14,7 +14,7 @@ notify_Initialize($)
|
||||
$hash->{DefFn} = "notify_Define";
|
||||
$hash->{NotifyFn} = "notify_Exec";
|
||||
$hash->{AttrFn} = "notify_Attr";
|
||||
$hash->{AttrList} = "disable:0,1 forwardReturnValue:0,1";
|
||||
$hash->{AttrList} = "disable:0,1 disabledForIntervals forwardReturnValue:0,1";
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ notify_Exec($$)
|
||||
my ($ntfy, $dev) = @_;
|
||||
|
||||
my $ln = $ntfy->{NAME};
|
||||
return "" if($attr{$ln} && $attr{$ln}{disable});
|
||||
return "" if(IsDisabled($ln));
|
||||
|
||||
my $n = $dev->{NAME};
|
||||
my $re = $ntfy->{REGEXP};
|
||||
@ -221,6 +221,8 @@ notify_Attr(@)
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<li><a href="#disable">disable</a></li>
|
||||
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
||||
|
||||
<a name="forwardReturnValue"></a>
|
||||
<li>forwardReturnValue<br>
|
||||
Forward the return value of the executed command to the caller,
|
||||
|
@ -15,7 +15,8 @@ watchdog_Initialize($)
|
||||
$hash->{DefFn} = "watchdog_Define";
|
||||
$hash->{UndefFn} = "watchdog_Undef";
|
||||
$hash->{NotifyFn} = "watchdog_Notify";
|
||||
$hash->{AttrList} = "disable:0,1 regexp1WontReactivate:0,1";
|
||||
$hash->{AttrList} = "disable:0,1 disabledForIntervals ".
|
||||
"regexp1WontReactivate:0,1";
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +66,7 @@ watchdog_Notify($$)
|
||||
my ($watchdog, $dev) = @_;
|
||||
|
||||
my $ln = $watchdog->{NAME};
|
||||
return "" if(AttrVal($ln, "disable", 0));
|
||||
return "" if(IsDisabled($ln));
|
||||
my $dontReAct = AttrVal($ln, "regexp1WontReactivate", 0);
|
||||
|
||||
my $n = $dev->{NAME};
|
||||
@ -227,6 +228,7 @@ watchdog_Undef($$)
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<li><a href="#disable">disable</a></li>
|
||||
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
||||
<li><a name="regexp1WontReactivate">regexp1WontReactivate</a><br>
|
||||
When a watchdog is active, a second event matching regexp1 will
|
||||
normally reset the timeout. Set this attribute to prevents this.
|
||||
@ -325,6 +327,7 @@ watchdog_Undef($$)
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<li><a href="#disable">disable</a></li>
|
||||
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
||||
<li><a name="regexp1WontReactivate">regexp1WontReactivate</a><br>
|
||||
Wenn ein Watchdog aktiv ist, wird ein zweites Ereignis das auf regexp1
|
||||
passt normalerweise den Timer zurücksetzen. Dieses Attribut wird
|
||||
|
18
fhem/fhem.pl
18
fhem/fhem.pl
@ -617,12 +617,20 @@ sub
|
||||
IsDisabled($)
|
||||
{
|
||||
my $devname = shift;
|
||||
if($devname &&
|
||||
defined($attr{$devname}) &&
|
||||
defined($attr{$devname}{disable})) {
|
||||
Log 4, "Disabled $devname";
|
||||
return 1;
|
||||
return 0 if(!$devname || !defined($attr{$devname}));
|
||||
|
||||
return 1 if(defined($attr{$devname}{disable}));
|
||||
|
||||
my $dfi = $attr{$devname}{disabledForIntervals};
|
||||
if(defined($dfi)) {
|
||||
my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime;
|
||||
my $hms = sprintf("%02d:%02d:%02d", $hour, $min, $sec);
|
||||
foreach my $ft (split(" ", $dfi)) {
|
||||
my ($from, $to) = split("-", $ft);
|
||||
return 1 if($from && $to && $from le $hms && $hms le $to);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user