diff --git a/fhem/CHANGED b/fhem/CHANGED
index a2e1c412a..35681f428 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -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
diff --git a/fhem/FHEM/90_at.pm b/fhem/FHEM/90_at.pm
index e6a2db7e5..9c8f5f09b 100755
--- a/fhem/FHEM/90_at.pm
+++ b/fhem/FHEM/90_at.pm
@@ -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 at, the command will not be executed,
but the next time will be computed.
+
+
disabledForIntervals HH:MM-HH:MM HH:MM-HH-MM...
+ 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.:
+
+ 23:00-24:00 00:00-01:00
+
+
+
skip_next
Used for at commands: skip the execution of the command the next
@@ -457,11 +469,23 @@ at_State($$$$)
- disable
- Kann für at/watchdog/notify/FileLog Devices gesetzt werden.
- Deaktiviert das entsprechende at/notify oder FileLog Device. Hinweis:
- Wenn angewendet auf ein at, dann wird der Befehl
- nicht ausgeführt, jedoch die nächste Ausführungszeit
- berechnet.
+ Deaktiviert das entsprechende Ger&aauml;t.
+ Hinweis: Wenn angewendet auf ein at, dann wird der
+ Befehl nicht ausgeführt, jedoch die nächste
+ Ausführungszeit berechnet.
+
+
+ disabledForIntervals HH:MM-HH:MM HH:MM-HH-MM...
+ 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.:
+
+ 23:00-24:00 00:00-01:00
+
+
skip_next
diff --git a/fhem/FHEM/91_notify.pm b/fhem/FHEM/91_notify.pm
index 9aa62b962..2b4b419ae 100755
--- a/fhem/FHEM/91_notify.pm
+++ b/fhem/FHEM/91_notify.pm
@@ -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(@)
Attributes
- disable
+ - disabledForIntervals
+
- forwardReturnValue
Forward the return value of the executed command to the caller,
diff --git a/fhem/FHEM/91_watchdog.pm b/fhem/FHEM/91_watchdog.pm
index 1ec300929..9bc31f1d2 100755
--- a/fhem/FHEM/91_watchdog.pm
+++ b/fhem/FHEM/91_watchdog.pm
@@ -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($$)
Attributes
- disable
+ - disabledForIntervals
- regexp1WontReactivate
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($$)
Attributes
- disable
+ - disabledForIntervals
- regexp1WontReactivate
Wenn ein Watchdog aktiv ist, wird ein zweites Ereignis das auf regexp1
passt normalerweise den Timer zurücksetzen. Dieses Attribut wird
diff --git a/fhem/fhem.pl b/fhem/fhem.pl
index 48703a945..53e550efd 100755
--- a/fhem/fhem.pl
+++ b/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;
}