mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-17 17:36:01 +00:00
sequence: triggerPartial (Forum #26772)
git-svn-id: https://svn.fhem.de/fhem/trunk@6516 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9692fb7972
commit
48d922626c
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- feature: sequence: triggerPartial Attribute added
|
||||||
- feature: 36_JeeLink: changed flash command to use fhem firmware
|
- feature: 36_JeeLink: changed flash command to use fhem firmware
|
||||||
directory (by HCS)
|
directory (by HCS)
|
||||||
- feature: 70_ENIGMA2: new attribute lightMode for old/slow devices
|
- feature: 70_ENIGMA2: new attribute lightMode for old/slow devices
|
||||||
|
@ -15,7 +15,7 @@ sequence_Initialize($)
|
|||||||
$hash->{DefFn} = "sequence_Define";
|
$hash->{DefFn} = "sequence_Define";
|
||||||
$hash->{UndefFn} = "sequence_Undef";
|
$hash->{UndefFn} = "sequence_Undef";
|
||||||
$hash->{NotifyFn} = "sequence_Notify";
|
$hash->{NotifyFn} = "sequence_Notify";
|
||||||
$hash->{AttrList} = "disable:0,1";
|
$hash->{AttrList} = "disable:0,1 triggerPartial:0,1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -103,8 +103,10 @@ sequence_Trigger($)
|
|||||||
my $hash = $defs{$ln};
|
my $hash = $defs{$ln};
|
||||||
my @d = split("[ \t]+", $hash->{DEF});
|
my @d = split("[ \t]+", $hash->{DEF});
|
||||||
$hash->{RE} = $d[0];
|
$hash->{RE} = $d[0];
|
||||||
|
my $idx = $hash->{IDX}/2;
|
||||||
$hash->{IDX} = 0;
|
$hash->{IDX} = 0;
|
||||||
Log3 $ln, 5, "sequence $ln timeout";
|
Log3 $ln, 5, "sequence $ln timeout on $idx";
|
||||||
|
DoTrigger($ln, "partial_$idx") if(AttrVal($ln, "triggerPartial", undef));
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
@ -128,7 +130,8 @@ sequence_Undef($$)
|
|||||||
<a name="sequencedefine"></a>
|
<a name="sequencedefine"></a>
|
||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> sequence <re1> <timeout1> <re2> [<timeout2> <re3> ...]</code>
|
<code>define <name> sequence <re1> <timeout1>
|
||||||
|
<re2> [<timeout2> <re3> ...]</code>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
A sequence is used to allow to trigger events for a certain combination of
|
A sequence is used to allow to trigger events for a certain combination of
|
||||||
@ -155,10 +158,79 @@ sequence_Undef($$)
|
|||||||
<b>Attributes</b>
|
<b>Attributes</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#disable">disable</a></li>
|
<li><a href="#disable">disable</a></li>
|
||||||
|
<li><a href="#triggerPartial">triggerPartial</a><br>
|
||||||
|
if set (to 1), and not all the events of a sequence are received, then a
|
||||||
|
partial_X event is generated by the sequence. Example:<br><code><ul>
|
||||||
|
fhem> define seq sequence d1:on 1 d1:on 1 d1:on<br>
|
||||||
|
fhem> attr seq triggerPartial<br>
|
||||||
|
fhem> set d1 on;; sleep 0.5;; set d1 on<br>
|
||||||
|
</ul></code>
|
||||||
|
generates the event seq partial_2. This can be used to assign different
|
||||||
|
tasks for a single button, depending on the number of times it is
|
||||||
|
pressed.
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
=end html
|
=end html
|
||||||
|
|
||||||
|
=begin html_DE
|
||||||
|
|
||||||
|
<a name="sequence"></a>
|
||||||
|
<h3>sequence</h3>
|
||||||
|
<ul>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a name="sequencedefine"></a>
|
||||||
|
<b>Define</b>
|
||||||
|
<ul>
|
||||||
|
<code>define <name> sequence <re1> <timeout1>
|
||||||
|
<re2> [<timeout2> <re3> ...]</code>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
Ein sequence kann verwendet werden, um ein neues Event zu generieren, wenn
|
||||||
|
eine bestimmte Folge von anderen Events in einem festgelegten Zeitraum
|
||||||
|
eingetroffen ist. Z.Bsp. um eine Lampe dann einzuschalten, falls Btn1:on,
|
||||||
|
dann Btn2:off und zum Schluss Btn3:on innerhalb einer Sekunde gedrückt
|
||||||
|
wurde, definiert man folgendes:<br>
|
||||||
|
<ul>
|
||||||
|
<code>
|
||||||
|
define lampseq sequence Btn1:on 0.5 Btn2:off 0.5 Btn1:on<br>
|
||||||
|
define lampon notify lampseq:trigger set lamp on
|
||||||
|
</code>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a name="sequenceset"></a>
|
||||||
|
<b>Set</b> <ul>N/A</ul><br>
|
||||||
|
|
||||||
|
<a name="sequenceget"></a>
|
||||||
|
<b>Get</b> <ul>N/A</ul><br>
|
||||||
|
|
||||||
|
<a name="sequenceattr"></a>
|
||||||
|
<b>Attributes</b>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#disable">disable</a></li>
|
||||||
|
<li><a href="#triggerPartial">triggerPartial</a><br>
|
||||||
|
Falls gesetzt (auf 1), und nicht alle erwarteten Events eingetroffen
|
||||||
|
sind, dann wird ein partial_X Event generiert, wobei X durch Anzahl der
|
||||||
|
eingetroffenen Events ersetzt wird. Beispiel:<br><code><ul>
|
||||||
|
fhem> define seq sequence d1:on 1 d1:on 1 d1:on<br>
|
||||||
|
fhem> attr seq triggerPartial<br>
|
||||||
|
fhem> set d1 on;; sleep 0.5;; set d1 on<br>
|
||||||
|
</ul></code>
|
||||||
|
erzeugt das Event "seq partial_2". Dies kann verwendet werden, um z.Bsp.
|
||||||
|
einer Taste unterschiedliche Aufgaben zuzuweisen, jenachdem wie oft sie
|
||||||
|
gedrückt wurde.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
=end html_DE
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
Loading…
x
Reference in New Issue
Block a user