mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
sleep parameter quiet
git-svn-id: https://svn.fhem.de/fhem/trunk@3498 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
79d919b38f
commit
47dfb2f143
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII
|
# Add changes at the top of the list. Keep it in ASCII
|
||||||
- SVN
|
- SVN
|
||||||
|
- feature: optional sleep parameter quiet
|
||||||
- feature: additional buttons for use with 95_remotecontrol
|
- feature: additional buttons for use with 95_remotecontrol
|
||||||
- feature: new module 71_LISTENLIVE.pm for use with media players (betateilchen)
|
- feature: new module 71_LISTENLIVE.pm for use with media players (betateilchen)
|
||||||
- feature: use xhr for colorupdates by colorpicker and rgb presets
|
- feature: use xhr for colorupdates by colorpicker and rgb presets
|
||||||
|
@ -948,18 +948,24 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
<a name="sleep"></a>
|
<a name="sleep"></a>
|
||||||
<h3>sleep</h3>
|
<h3>sleep</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<code>sleep <sec></code>
|
<code>sleep <sec> [quiet]</code>
|
||||||
<br><br>
|
<br><br>
|
||||||
Sleep for a given amount, millisecond accuracy.
|
Sleep for a given amount, millisecond accuracy.<br>
|
||||||
|
When called in a notify/at/etc, then nonempty return values of the following
|
||||||
|
commands is logged to the global logfile with loglevel 2.<br>
|
||||||
|
If quiet is specified, then skip this logging.
|
||||||
<br><br>
|
<br><br>
|
||||||
Example:
|
Example:
|
||||||
<ul>
|
<ul>
|
||||||
<code>sleep 0.5</code><br>
|
<code>sleep 0.5</code><br>
|
||||||
<code>define n3 notify btn3.* set lamp toggle;;sleep 0.5;;set lamp toggle</code>
|
<code>define n3 notify btn3.* set lamp toggle;;sleep 0.5;;set lamp
|
||||||
|
toggle</code><br>
|
||||||
|
<code>define a3 at +*00:05 set Windsensor 1w_measure;; sleep 2 quiet;; get
|
||||||
|
Windsensor 1w_temp</code>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
Note: sleep followed by another command and issued in at/notify/etc is not
|
Note: sleep followed by another command and issued in at/notify/etc is not
|
||||||
blocking fhem.<br>
|
blocking fhem<br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="version"></a>
|
<a name="version"></a>
|
||||||
|
@ -958,9 +958,9 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
|
|||||||
<ul>
|
<ul>
|
||||||
<code>shutdown [restart]</code>
|
<code>shutdown [restart]</code>
|
||||||
<br><br>
|
<br><br>
|
||||||
Der Befehl fährt den Server herunter (nach dem sichern der <a href="#statefile">state information
|
Der Befehl fährt den Server herunter (nach dem sichern aller <a
|
||||||
</a>). Er triggert das global:SHUTDOWN Ereignis. Wenn der optionale
|
href="#statefile">Gerätestati</a>). Er triggert das global:SHUTDOWN
|
||||||
Parameterv restart angegeben, versucht FHEM von selbst wieder zu starten.
|
Ereignis. Mit der optionalen Parameter restart startet FHEM danach neu.
|
||||||
<br><br>
|
<br><br>
|
||||||
Beispiel:
|
Beispiel:
|
||||||
<ul>
|
<ul>
|
||||||
@ -976,10 +976,8 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
|
|||||||
<code>trigger <devspec> <state></code>
|
<code>trigger <devspec> <state></code>
|
||||||
<br><br>
|
<br><br>
|
||||||
Triggert eine <a href="#notify">notify</a> Definition.
|
Triggert eine <a href="#notify">notify</a> Definition.
|
||||||
Lesen Sie bitte den Abschnitt <a href="#devspec">Device specification</a> für
|
Siehe <a href="#devspec">Geräte-Spezifikation (devspec)</a>
|
||||||
Details zu
|
für Details zu <devspec>.
|
||||||
<devspec>.
|
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
Beispiel:
|
Beispiel:
|
||||||
<ul>
|
<ul>
|
||||||
@ -990,18 +988,25 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
|
|||||||
<a name="sleep"></a>
|
<a name="sleep"></a>
|
||||||
<h3>sleep</h3>
|
<h3>sleep</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<code>sleep <sec></code>
|
<code>sleep <sec> [quiet]</code>
|
||||||
<br><br>
|
<br><br>
|
||||||
Stoppt die Befehlsabarbeitung für die angegebene Anzahl von Millisekunden.
|
Wartet für die angegebene Anzahl von Millisekunden.<br>
|
||||||
|
Falls sleep in at/notify/etc aufgerufen wurde, und die nachfolgenden
|
||||||
|
Kommandos einen nicht leeren Text zurückgeliefert haben, dann wird dieser
|
||||||
|
Text mit loglevel 2 protokolliert.<br>
|
||||||
|
quiet vermeidet diese Protokollierung.
|
||||||
<br><br>
|
<br><br>
|
||||||
Beispiel:
|
Beispiele:
|
||||||
<ul>
|
<ul>
|
||||||
<code>sleep 0.5</code><br>
|
<code>sleep 0.5</code><br>
|
||||||
<code>define n3 notify btn3.* set lamp toggle;;sleep 0.5;;set lamp toggle</code>
|
<code>define n3 notify btn3.* set lamp toggle;;sleep 0.5;;set lamp
|
||||||
|
toggle</code><br>
|
||||||
|
<code>define a3 at +*00:05 set Windsensor 1w_measure;; sleep 2 quiet;; get
|
||||||
|
Windsensor 1w_temp</code>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
Bemerkung: sleep gefolgt von einem weiteren Befehl und angegeben in at/notify/etc
|
Bemerkung: sleep gefolgt von weiteren Befehlen und aufgerufen in
|
||||||
blockiert die Abarbeitung von FHHM nicht.<br>
|
at/notify/etc blockiert die Abarbeitung von FHEM nicht.<br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="version"></a>
|
<a name="version"></a>
|
||||||
@ -1222,10 +1227,10 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
|
|||||||
|
|
||||||
<a name="statefile"></a>
|
<a name="statefile"></a>
|
||||||
<li>statefile<br>
|
<li>statefile<br>
|
||||||
Dieses Attribut legt den Namen der Datei fest, in die
|
Dieses Attribut legt den Namen der Datei fest, in die
|
||||||
Statusinformationen und verschiedene <a href="#at">at</a> Information
|
Statusinformationen aller Geräte gespeichert werden bevor der
|
||||||
gespeichert werden bevor der Server heruntergefahren wird. Fall diese
|
Server heruntergefahren wird. Falls diese Datei nicht angegeben wird, so
|
||||||
Datei nicht angegeben wird, so werden keinerlei Informationen gesichert.
|
werden keinerlei Informationen gesichert.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
<a name="title"></a>
|
<a name="title"></a>
|
||||||
|
40
fhem/fhem.pl
40
fhem/fhem.pl
@ -265,7 +265,7 @@ $readingFnAttributes = "event-on-change-reading event-on-update-reading ".
|
|||||||
"shutdown"=> { Fn=>"CommandShutdown",
|
"shutdown"=> { Fn=>"CommandShutdown",
|
||||||
Hlp=>"[restart],terminate the server" },
|
Hlp=>"[restart],terminate the server" },
|
||||||
"sleep" => { Fn=>"CommandSleep",
|
"sleep" => { Fn=>"CommandSleep",
|
||||||
Hlp=>"<sec>,sleep for sec, 3 decimal places" },
|
Hlp=>"<sec> [quiet],sleep for sec, 3 decimal places" },
|
||||||
"trigger" => { Fn=>"CommandTrigger",
|
"trigger" => { Fn=>"CommandTrigger",
|
||||||
Hlp=>"<devspec> <state>,trigger notify command" },
|
Hlp=>"<devspec> <state>,trigger notify command" },
|
||||||
"update" => {
|
"update" => {
|
||||||
@ -2070,21 +2070,37 @@ CommandInform($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
|
sub
|
||||||
|
WakeUpFn($)
|
||||||
|
{
|
||||||
|
my $h = shift;
|
||||||
|
$evalSpecials = $h->{evalSpecials};
|
||||||
|
my $ret = AnalyzeCommandChain(undef, $h->{cmd});
|
||||||
|
Log 2, "After sleep: $ret" if($ret && !$h->{quiet});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub
|
sub
|
||||||
CommandSleep($$)
|
CommandSleep($$)
|
||||||
{
|
{
|
||||||
my ($cl, $param) = @_;
|
my ($cl, $param) = @_;
|
||||||
|
my ($sec, $quiet) = split(" ", $param);
|
||||||
|
|
||||||
return "Cannot interpret $param as seconds" if($param !~ m/^[0-9\.]+$/);
|
return "Argument missing" if(!defined($sec));
|
||||||
Log 4, "sleeping for $param";
|
return "Cannot interpret $sec as seconds" if($sec !~ m/^[0-9\.]+$/);
|
||||||
|
return "Second parameter must be quiet" if($quiet && $quiet ne "quiet");
|
||||||
|
|
||||||
if(!$cl && @cmdList && $param && $init_done) {
|
Log 4, "sleeping for $sec";
|
||||||
my %h = (cmd=>join(";", @cmdList), evalSpecials=>$evalSpecials);
|
|
||||||
InternalTimer(gettimeofday()+$param, "WakeUpFn", \%h, 0);
|
if(!$cl && @cmdList && $sec && $init_done) {
|
||||||
|
my %h = (cmd => join(";", @cmdList),
|
||||||
|
evalSpecials => $evalSpecials,
|
||||||
|
quiet => $quiet);
|
||||||
|
InternalTimer(gettimeofday()+$sec, "WakeUpFn", \%h, 0);
|
||||||
@cmdList=();
|
@cmdList=();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
select(undef, undef, undef, $param);
|
select(undef, undef, undef, $sec);
|
||||||
|
|
||||||
}
|
}
|
||||||
return undef;
|
return undef;
|
||||||
@ -2113,16 +2129,6 @@ CommandVersion($$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
|
||||||
WakeUpFn($)
|
|
||||||
{
|
|
||||||
my $h = shift;
|
|
||||||
$evalSpecials = $h->{evalSpecials};
|
|
||||||
my $ret = AnalyzeCommandChain(undef, $h->{cmd});
|
|
||||||
Log 2, "After sleep: $ret" if($ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Return the time to the next event (or undef if there is none)
|
# Return the time to the next event (or undef if there is none)
|
||||||
# and call each function which was scheduled for this time
|
# and call each function which was scheduled for this time
|
||||||
|
Loading…
Reference in New Issue
Block a user