From 6826a47b52a4045fca0cab8dec3de2e32b337bbc Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Mon, 29 Sep 2014 09:12:34 +0000 Subject: [PATCH] sequence: reportEvents Attribute added (Forum #27436) git-svn-id: https://svn.fhem.de/fhem/trunk@6629 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/91_sequence.pm | 64 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 2609d8ad7..877f33227 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - feature: sequence: reportEvents attribtue added - feature: SYSMON: RAM and SWAP Readings on OSX - change: 34_NUT: removed calculation of values. Use userReadings instead. removed autogeneration of attr model and serNo. diff --git a/fhem/FHEM/91_sequence.pm b/fhem/FHEM/91_sequence.pm index f9a529483..3af675e6b 100755 --- a/fhem/FHEM/91_sequence.pm +++ b/fhem/FHEM/91_sequence.pm @@ -15,7 +15,7 @@ sequence_Initialize($) $hash->{DefFn} = "sequence_Define"; $hash->{UndefFn} = "sequence_Undef"; $hash->{NotifyFn} = "sequence_Notify"; - $hash->{AttrList} = "disable:0,1 triggerPartial:0,1"; + $hash->{AttrList} = "disable:0,1 triggerPartial:1,0 reportEvents:1,0"; } @@ -73,12 +73,17 @@ sequence_Notify($$) my $idx = $hash->{IDX} + 2; Log3 $ln, 5, "sequence $ln matched $idx"; my @d = split("[ \t]+", $hash->{DEF}); - + $hash->{EVENTS} = "" if(!$hash->{EVENTS}); + $hash->{EVENTS} .= " $n:$s"; if($idx > $hash->{MAX}) { # Last element reached - Log3 $ln, 5, "sequence $ln triggered"; - DoTrigger($ln, "trigger"); + my $tt = "trigger"; + $tt .= $hash->{EVENTS} if(AttrVal($ln, "reportEvents", undef)); + delete($hash->{EVENTS}); + + Log3 $ln, 5, "sequence $ln $tt"; + DoTrigger($ln, $tt); $idx = 0; } else { @@ -105,8 +110,12 @@ sequence_Trigger($) $hash->{RE} = $d[0]; my $idx = $hash->{IDX}/2; $hash->{IDX} = 0; - Log3 $ln, 5, "sequence $ln timeout on $idx"; - DoTrigger($ln, "partial_$idx") if(AttrVal($ln, "triggerPartial", undef)); + my $tt = "partial_$idx"; + Log3 $ln, 5, "sequence $ln timeout on $idx ($tt)"; + $tt .= $hash->{EVENTS} if(AttrVal($ln, "reportEvents", undef)); + delete($hash->{EVENTS}); + + DoTrigger($ln, $tt) if(AttrVal($ln, "triggerPartial", undef)); } sub @@ -168,6 +177,17 @@ sequence_Undef($$) 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. +
+
  • reportEvents
    + if set (to 1), report the events (space separated) after the + "trigger" or "partial_X" keyword. This way one can create more general + sequences, and create different notifies to react:
    +

  • @@ -229,6 +249,38 @@ sequence_Undef($$)
    + + Attributes + +
    + =end html_DE