diff --git a/fhem/FHEM/90_at.pm b/fhem/FHEM/90_at.pm
index a1803a2b7..c964ed045 100755
--- a/fhem/FHEM/90_at.pm
+++ b/fhem/FHEM/90_at.pm
@@ -110,8 +110,9 @@ at_Define($$)
RemoveInternalTimer($hash);
InternalTimer($nt, "at_Exec", $hash, 0);
$hash->{NTM} = $ntm if($rel eq "+" || $fn);
- my $val = AttrVal($name, "disable", undef) ?
- "disabled" : ("Next: ".FmtTime($nt));
+ my $val = IsDisabled($name) ?
+ (AttrVal($name, "disable", undef) ? "disabled" : "inactive") :
+ ("Next: ".FmtTime($nt));
readingsSingleUpdate($hash, "state", $val, 1);
}
@@ -206,22 +207,36 @@ at_Set($@)
{
my ($hash, @a) = @_;
- my $cmd = ($at_detailFnCalled ? "modifyTimeSpec" : "modifyTimeSpec:time");
+ my %sets = (modifyTimeSpec=>1, inactive=>0, active=>0);
+ my $cmd = join(" ", sort keys %sets);
+ $cmd =~ s/modifyTimeSpec/modifyTimeSpec:time/ if($at_detailFnCalled);
$at_detailFnCalled = 0;
return "no set argument specified" if(int(@a) < 2);
return "Unknown argument $a[1], choose one of $cmd"
- if($a[1] ne "modifyTimeSpec");
+ if(!defined($sets{$a[1]}));
+
+ if($a[1] eq "modifyTimeSpec") {
+ my ($err, undef) = GetTimeSpec($a[2]);
+ return $err if($err);
- my ($err, undef) = GetTimeSpec($a[2]);
- return $err if($err);
+ my $def = ($hash->{RELATIVE} eq "yes" ? "+":"").
+ ($hash->{PERIODIC} eq "yes" ? "*":"").
+ $a[2];
+ $hash->{OLDDEF} = $hash->{DEF};
+ my $ret = at_Define($hash, "$hash->{NAME} at $def");
+ delete $hash->{OLDDEF};
+ return $ret;
+
+ } elsif($a[1] eq "inactive") {
+ readingsSingleUpdate($hash, "state", "inactive", 1);
+ return undef;
+
+ } elsif($a[1] eq "active") {
+ readingsSingleUpdate($hash,"state","Next: ".FmtTime($hash->{TRIGGERTIME}),1)
+ if(!AttrVal($hash->{NAME}, "disable", undef));
+ return undef;
+ }
- my $def = ($hash->{RELATIVE} eq "yes" ? "+":"").
- ($hash->{PERIODIC} eq "yes" ? "*":"").
- $a[2];
- $hash->{OLDDEF} = $hash->{DEF};
- my $ret = at_Define($hash, "$hash->{NAME} at $def");
- delete $hash->{OLDDEF};
- return $ret;
}
sub
@@ -257,6 +272,11 @@ at_State($$$$)
{
my ($hash, $tim, $vt, $val) = @_;
+ if($vt eq "state" && $val eq "inactive") {
+ readingsSingleUpdate($hash, "state", "inactive", 1);
+ return undef;
+ }
+
return undef if($hash->{DEF} !~ m/^\+\d/ ||
$val !~ m/Next: (\d\d):(\d\d):(\d\d)/);
@@ -437,8 +457,17 @@ EOF
Change the execution time. Note: the N-times repetition is ignored.
It is intended to be used in combination with
webCmd, for an easier modification from the room
- overview in FHEMWEB.
+ overview in FHEMWEB.
+
inactive
+ Inactivates the current device. Note the slight difference to the
+ disable attribute: using set inactive the state is automatically saved
+ to the statefile on shutdown, there is no explicit save necesary.
+ This command is intended to be used by scripts to temporarily
+ deactivate the at.
+ The concurrent setting of the disable attribute is not recommended.
+ active
+ Activates the current device (see inactive).
@@ -488,7 +517,6 @@ EOF
-
=end html
@@ -593,6 +621,18 @@ EOF
Modifikation im FHEMWEB Raumübersicht, dazu muss man
modifyTimeSpec in webCmd spezifizieren.
+ inactive
+ Deaktiviert das entsprechende Gerät. Beachte den leichten
+ semantischen Unterschied zum disable Attribut: "set inactive"
+ wird bei einem shutdown automatisch in fhem.state gespeichert, es ist
+ kein save notwendig.
+ Der Einsatzzweck sind Skripte, um das at temporär zu
+ deaktivieren.
+ Das gleichzeitige Verwenden des disable Attributes wird nicht empfohlen.
+
+ active
+ Aktiviert das entsprechende Gerät, siehe inactive.
+
@@ -604,7 +644,7 @@ EOF
- disable
- Deaktiviert das entsprechende Ger&aauml;t.
+ Deaktiviert das entsprechende Gerät.
Hinweis: Wenn angewendet auf ein at, dann wird der
Befehl nicht ausgeführt, jedoch die nächste
Ausführungszeit berechnet.
diff --git a/fhem/FHEM/91_notify.pm b/fhem/FHEM/91_notify.pm
index a6488ee5c..e372a0b00 100755
--- a/fhem/FHEM/91_notify.pm
+++ b/fhem/FHEM/91_notify.pm
@@ -17,6 +17,7 @@ notify_Initialize($)
$hash->{AttrFn} = "notify_Attr";
$hash->{AttrList} = "disable:0,1 disabledForIntervals forwardReturnValue:0,1 showtime:0,1 addStateEvent:0,1";
$hash->{SetFn} = "notify_Set";
+ $hash->{StateFn} = "notify_State";
$hash->{FW_detailFn} = "notify_fhemwebFn";
}
@@ -125,7 +126,7 @@ notify_Set($@)
my $me = $hash->{NAME};
return "no set argument specified" if(int(@a) < 2);
- my %sets = (addRegexpPart=>2, removeRegexpPart=>1);
+ my %sets = (addRegexpPart=>2, removeRegexpPart=>1, inactive=>0, active=>0);
my $cmd = $a[1];
return "Unknown argument $cmd, choose one of " # No dropdown in FHEMWEB
@@ -159,7 +160,26 @@ notify_Set($@)
$hash->{DEF} = "$re ".$hash->{".COMMAND"};
notifyRegexpChanged($hash, $re);
+ } elsif($cmd eq "inactive") {
+ readingsSingleUpdate($hash, "state", "inactive", 1);
+
}
+ elsif($cmd eq "active") {
+ readingsSingleUpdate($hash, "state", "active", 1)
+ if(!AttrVal($me, "disable", undef));
+ }
+
+ return undef;
+}
+
+#############
+sub
+notify_State($$$$)
+{
+ my ($hash, $tim, $vt, $val) = @_;
+
+ return undef if($vt ne "state" || $val ne "inactive");
+ readingsSingleUpdate($hash, "state", "inactive", 1);
return undef;
}
@@ -331,22 +351,24 @@ notify_fhemwebFn($$$$)
Set
- - addRegexpPart <device> <regexp>
-
+ - addRegexpPart <device> <regexp>
add a regexp part, which is constructed as device:regexp. The parts
are separated by |. Note: as the regexp parts are resorted, manually
- constructed regexps may become invalid.
-
-
- - removeRegexpPart <re>
-
+ constructed regexps may become invalid.
+ - removeRegexpPart <re>
remove a regexp part. Note: as the regexp parts are resorted, manually
constructed regexps may become invalid.
The inconsistency in addRegexpPart/removeRegexPart arguments originates
- from the reusage of javascript functions.
-
-
-
+ from the reusage of javascript functions.
+ - inactive
+ Inactivates the current device. Note the slight difference to the
+ disable attribute: using set inactive the state is automatically saved
+ to the statefile on shutdown, there is no explicit save necesary.
+ This command is intended to be used by scripts to temporarily
+ deactivate the notify.
+ The concurrent setting of the disable attribute is not recommended.
+ - active
+ Activates the current device (see inactive).
@@ -520,19 +542,27 @@ notify_fhemwebFn($$$$)
Set
- - addRegexpPart <device> <regexp>
-
+ - addRegexpPart <device> <regexp>
Fügt ein regexp Teil hinzu, der als device:regexp aufgebaut ist.
Die Teile werden nach Regexp-Regeln mit | getrennt. Achtung: durch
hinzufügen können manuell erzeugte Regexps ungültig
- werden.
-
- - removeRegexpPart <re>
-
+ - removeRegexpPart <re>
Entfernt ein regexp Teil. Die Inkonsistenz von addRegexpPart /
removeRegexPart-Argumenten hat seinen Ursprung in der Wiederverwendung
- von Javascript-Funktionen.
-
+ von Javascript-Funktionen.
+ inactive
+ Deaktiviert das entsprechende Gerät. Beachte den leichten
+ semantischen Unterschied zum disable Attribut: "set inactive"
+ wird bei einem shutdown automatisch in fhem.state gespeichert, es ist
+ kein save notwendig.
+ Der Einsatzzweck sind Skripte, um das notify temporär zu
+ deaktivieren.
+ Das gleichzeitige Verwenden des disable Attributes wird nicht empfohlen.
+
+ active
+ Aktiviert das entsprechende Gerät, siehe inactive.
+
diff --git a/fhem/fhem.pl b/fhem/fhem.pl
index 290847cb0..d6e0866fc 100755
--- a/fhem/fhem.pl
+++ b/fhem/fhem.pl
@@ -695,6 +695,8 @@ IsDisabled($)
return 0 if(!$devname || !defined($attr{$devname}));
return 1 if($attr{$devname}{disable});
+ return 1 if($defs{$devname} && $defs{$devname}{STATE} &&
+ $defs{$devname}{STATE} eq "inactive");
my $dfi = $attr{$devname}{disabledForIntervals};
if(defined($dfi)) {