2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 05:06:35 +00:00

EnOcean button mods + MultiMessages fix

FHEMWEB eventMap on/off fix


git-svn-id: https://svn.fhem.de/fhem/trunk@1071 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2011-10-15 11:24:11 +00:00
parent 81740a9024
commit bb3c748a55
4 changed files with 50 additions and 37 deletions

View File

@ -232,12 +232,13 @@ TCM_Read($)
} else { # TCM310 / ESP3 } else { # TCM310 / ESP3
if($data =~ m/^55(....)(..)(..)(..)/) { if($data =~ m/^55(....)(..)(..)(..)/) {
my ($l1, $l2, $t, $crc) = (hex($1), hex($2), $3, $4); my ($l1, $l2, $t, $crc) = (hex($1), hex($2), $3, $4);
my $tlen = (7+$l1+$l2); my $tlen = 2*(7+$l1+$l2);
if(length($data) < 2*$tlen) { if(length($data) < $tlen) {
$hash->{PARTIAL} = $data; $hash->{PARTIAL} = $data;
return; return;
} }
$hash->{PARTIAL} = substr($data, ($tlen*2)); $hash->{PARTIAL} = substr($data, $tlen);
$data = substr($data, 0, $tlen);
my $hdr = substr($data, 2, 8); my $hdr = substr($data, 2, 8);
my $mdata = substr($data, 12, $l1*2); my $mdata = substr($data, 12, $l1*2);
@ -276,7 +277,7 @@ TCM_Read($)
"04"=>"RET_OPERATION_DENIED", "04"=>"RET_OPERATION_DENIED",
); );
$rc = $codes{$rc} if($codes{$rc}); $rc = $codes{$rc} if($codes{$rc});
Log $ll2, "$name: RESPONSE: $rc" ; Log (($rc eq "RET_OK") ? $ll5 : $ll2, "$name: RESPONSE: $rc") ;
} else { } else {
Log $ll2, "$name: unknown packet type $t: $data" ; Log $ll2, "$name: unknown packet type $t: $data" ;

View File

@ -10,31 +10,15 @@ sub EnOcean_Initialize($);
sub EnOcean_Parse($$); sub EnOcean_Parse($$);
sub EnOcean_Set($@); 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 my %rorgname = ("F6"=>"switch", # RPS
"D5"=>"contact", # 1BS "D5"=>"contact", # 1BS
"A5"=>"sensor", # 4BS "A5"=>"sensor", # 4BS
); );
my @ptm200btn = ("AI", "A0", "BI", "B0", "CI", "C0", "DI", "D0"); my @ptm200btn = ("AI", "A0", "BI", "B0", "CI", "C0", "DI", "D0");
my %ptm200btn; 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 = ( my %manuf = (
"001" => "Peha", "001" => "Peha",
"002" => "Thermokon", "002" => "Thermokon",
@ -70,6 +54,26 @@ my %subTypes = (
"A5.20.01" => "MD15", "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 sub
EnOcean_Define($$) EnOcean_Define($$)
@ -86,11 +90,6 @@ EnOcean_Define($$)
# Help FHEMWEB split up devices # Help FHEMWEB split up devices
$attr{$name}{subType} = $1 if($name =~ m/EnO_(.*)_$a[2]/); $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") { if($rorg eq "F6") {
my $nu = ((hex($status)&0x10)>>4); my $nu = ((hex($status)&0x10)>>4);
# unused flags (AFAIK)
#push @event, "1:T21:".((hex($status)&0x20)>>5); #push @event, "1:T21:".((hex($status)&0x20)>>5);
#push @event, "1:NU:$nu"; #push @event, "1:NU:$nu";
@ -210,14 +210,20 @@ EnOcean_Parse($$)
$msg = "keycard removed"; $msg = "keycard removed";
} else { } 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 # 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 $tn = TimeNow();
my @changed; my @changed;
for(my $i = 0; $i < int(@event); $i++) { for(my $i = 0; $i < int(@event); $i++) {

View File

@ -3090,8 +3090,10 @@ A line ending with \ will be concatenated with the next one, so long lines
<li>D0 <li>D0
<li>DI <li>DI
<li>A0,BI <li>A0,BI
<li>&lt;all other combinations of BtnX/BtnY&gt; <li>&lt;BtnX,BtnY&gt; where BtnX and BtnY is one of the above, e.g.
<li>buttons released A0,BI or D0,CI
<li>buttons:released
<li>buttons:<BtnX> released<br>
</ul> </ul>
<li>windowHandle (HOPPE SecuSignal). Set the subType attr to windowHandle. <li>windowHandle (HOPPE SecuSignal). Set the subType attr to windowHandle.
<ul> <ul>
@ -6778,10 +6780,11 @@ href="http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=29870">U
<li>2<br> <li>2<br>
Easter-dependent date. Arguments: &lt;day-offset&gt; Easter-dependent date. Arguments: &lt;day-offset&gt;
&lt;holiday-name&gt;. &lt;holiday-name&gt;.
The offset is counted from Easter-Sunday. Note: the perl module The offset is counted from Easter-Sunday.
DateTime::Event::Easter must be installed to use this type of <br>
holiday.<br> Exampe: 2 1 Easter-Monday<br>
Exampe: 2 1 Easter-Monday Sidenote: You can check the easter date with:
fhem> { join("-", western_easter(2011)) }
</li> </li>
<li>3<br> <li>3<br>
Month dependent date. Arguments: &lt;nth&gt; &lt;weekday&gt; Month dependent date. Arguments: &lt;nth&gt; &lt;weekday&gt;

View File

@ -1790,7 +1790,7 @@ FW_devState($$)
$hasOnOff = ($allSets =~ m/ on / && $allSets =~ m/ off /); $hasOnOff = ($allSets =~ m/ on / && $allSets =~ m/ off /);
if(!$hasOnOff) { # Check the eventMap if(!$hasOnOff) { # Check the eventMap
my $em = AttrVal($d, "eventMap", "") . " "; my $em = AttrVal($d, "eventMap", "") . " ";
$hasOnOff = ($em =~ m/:on / && $em =~ m/:off /); $hasOnOff = ($em =~ m/:on\b/ && $em =~ m/:off\b/);
} }
} }