diff --git a/fhem/FHEM/00_TCM.pm b/fhem/FHEM/00_TCM.pm index 07a75c48f..5bacb79db 100755 --- a/fhem/FHEM/00_TCM.pm +++ b/fhem/FHEM/00_TCM.pm @@ -232,12 +232,13 @@ TCM_Read($) } else { # TCM310 / ESP3 if($data =~ m/^55(....)(..)(..)(..)/) { my ($l1, $l2, $t, $crc) = (hex($1), hex($2), $3, $4); - my $tlen = (7+$l1+$l2); - if(length($data) < 2*$tlen) { + my $tlen = 2*(7+$l1+$l2); + if(length($data) < $tlen) { $hash->{PARTIAL} = $data; return; } - $hash->{PARTIAL} = substr($data, ($tlen*2)); + $hash->{PARTIAL} = substr($data, $tlen); + $data = substr($data, 0, $tlen); my $hdr = substr($data, 2, 8); my $mdata = substr($data, 12, $l1*2); @@ -276,7 +277,7 @@ TCM_Read($) "04"=>"RET_OPERATION_DENIED", ); $rc = $codes{$rc} if($codes{$rc}); - Log $ll2, "$name: RESPONSE: $rc" ; + Log (($rc eq "RET_OK") ? $ll5 : $ll2, "$name: RESPONSE: $rc") ; } else { Log $ll2, "$name: unknown packet type $t: $data" ; diff --git a/fhem/FHEM/10_EnOcean.pm b/fhem/FHEM/10_EnOcean.pm index b4911416c..1cb61ad9d 100755 --- a/fhem/FHEM/10_EnOcean.pm +++ b/fhem/FHEM/10_EnOcean.pm @@ -10,31 +10,15 @@ sub EnOcean_Initialize($); sub EnOcean_Parse($$); sub EnOcean_Set($@); -# TODO -# Send120 -# Send310 -# Test windowHandle - -sub -EnOcean_Initialize($) -{ - my ($hash) = @_; - - $hash->{Match} = "^EnOcean:"; - $hash->{DefFn} = "EnOcean_Define"; - $hash->{ParseFn} = "EnOcean_Parse"; - $hash->{SetFn} = "EnOcean_Set"; - $hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 " . - "showtime:1,0 loglevel:0,1,2,3,4,5,6 model " . - "subType:switch,contact,sensor,windowHandle,SR04,MD15"; -} - my %rorgname = ("F6"=>"switch", # RPS "D5"=>"contact", # 1BS "A5"=>"sensor", # 4BS ); my @ptm200btn = ("AI", "A0", "BI", "B0", "CI", "C0", "DI", "D0"); my %ptm200btn; + +# Some Manufacturers (e.g. Jaeger Direkt) also sell EnOcean products without an +# intry in the table below. This table is only needed for A5 category devices my %manuf = ( "001" => "Peha", "002" => "Thermokon", @@ -70,6 +54,26 @@ my %subTypes = ( "A5.20.01" => "MD15", ); +sub +EnOcean_Initialize($) +{ + my ($hash) = @_; + + $hash->{Match} = "^EnOcean:"; + $hash->{DefFn} = "EnOcean_Define"; + $hash->{ParseFn} = "EnOcean_Parse"; + $hash->{SetFn} = "EnOcean_Set"; + $hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 " . + "showtime:1,0 loglevel:0,1,2,3,4,5,6 model " . + "subType:switch,contact,sensor,windowHandle,SR04,MD15"; + + for(my $i=0; $i<@ptm200btn;$i++) { + $ptm200btn{$ptm200btn[$i]} = "$i:30"; + } + $ptm200btn{released} = "0:20"; + return undef; +} + ############################# sub EnOcean_Define($$) @@ -86,11 +90,6 @@ EnOcean_Define($$) # Help FHEMWEB split up devices $attr{$name}{subType} = $1 if($name =~ m/EnO_(.*)_$a[2]/); - for(my $i=0; $i<@ptm200btn;$i++) { - $ptm200btn{$ptm200btn[$i]} = "$i:30"; - } - $ptm200btn{released} = "0:20"; - return undef; } @@ -181,6 +180,7 @@ EnOcean_Parse($$) if($rorg eq "F6") { my $nu = ((hex($status)&0x10)>>4); + # unused flags (AFAIK) #push @event, "1:T21:".((hex($status)&0x20)>>5); #push @event, "1:NU:$nu"; @@ -210,14 +210,20 @@ EnOcean_Parse($$) $msg = "keycard removed"; } else { - $msg = "buttons ". (($db_3&0x10) ? "pressed" : "released"); + $msg = (($db_3&0x10) ? "pressed" : "released"); } } } - push @event, "3:state:$msg"; + + # released events are disturbing when using a remote, since it overwrites + # the "real" state immediately + my $event = "state"; + $event = "buttons" if($msg =~ m/released$/); + + push @event, "3:$event:$msg"; ################################# # 1BS. Only contact is defined in the EEP2.1 for 1BS @@ -290,6 +296,9 @@ EnOcean_Parse($$) } + # Flag & 1: reading + # Flag & 2: changed + my $tn = TimeNow(); my @changed; for(my $i = 0; $i < int(@event); $i++) { diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html index 52a8d5c9a..f058bbf95 100644 --- a/fhem/docs/commandref.html +++ b/fhem/docs/commandref.html @@ -3090,8 +3090,10 @@ A line ending with \ will be concatenated with the next one, so long lines
  • D0
  • DI
  • A0,BI -
  • <all other combinations of BtnX/BtnY> -
  • buttons released +
  • <BtnX,BtnY> where BtnX and BtnY is one of the above, e.g. + A0,BI or D0,CI +
  • buttons:released +
  • buttons: released
  • windowHandle (HOPPE SecuSignal). Set the subType attr to windowHandle.