2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 06:48:43 +00:00

10_EnOcean.pm. subType switch: commands C0 ... DI: T21 status flag is set now properly, sub EnOcean_define changed

git-svn-id: https://svn.fhem.de/fhem/trunk@11035 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
klaus-schauer 2016-03-10 05:40:20 +00:00
parent 5436e08494
commit 5bcb21b2c4

View File

@ -1,13 +1,7 @@
############################################## ##############################################
# $Id$ # $Id$
# 2016-02-17 # 2016-03-10
# EEP changed:
# EnOcean_Notify():
# EnOcean_Attr():
# Remote Management (incomplete, experimental)
# commandref: further explanations added
# PID V1.0.0.9 # PID V1.0.0.9
# EnOcean Security in Perl, teach-in, VAES, MAC and message handling # EnOcean Security in Perl, teach-in, VAES, MAC and message handling
@ -688,10 +682,10 @@ EnOcean_Define($$) {
while (($autocreateName, $autocreateHash) = each(%defs)) { while (($autocreateName, $autocreateHash) = each(%defs)) {
last if ($defs{$autocreateName}{TYPE} eq "autocreate"); last if ($defs{$autocreateName}{TYPE} eq "autocreate");
} }
$autocreateDeviceRoom = $attr{$autocreateName}{device_room} if (exists $attr{$autocreateName}{device_room}); $autocreateDeviceRoom = AttrVal($autocreateName, "device_room", $autocreateDeviceRoom);
$autocreateDeviceRoom = 'EnOcean' if ($autocreateDeviceRoom eq '%TYPE'); $autocreateDeviceRoom = 'EnOcean' if ($autocreateDeviceRoom eq '%TYPE');
$autocreateDeviceRoom = $name if ($autocreateDeviceRoom eq '%NAME'); $autocreateDeviceRoom = $name if ($autocreateDeviceRoom eq '%NAME');
$autocreateDeviceRoom = $attr{$name}{room} if (exists $attr{$name}{room}); $autocreateDeviceRoom = AttrVal($name, "room", $autocreateDeviceRoom);
if ($init_done) { if ($init_done) {
Log3 $name, 2, "EnOcean define " . join(' ', @a); Log3 $name, 2, "EnOcean define " . join(' ', @a);
if (!defined(AttrVal($autocreateName, "disable", undef)) && !exists($defs{$filelogName})) { if (!defined(AttrVal($autocreateName, "disable", undef)) && !exists($defs{$filelogName})) {
@ -1456,7 +1450,7 @@ sub EnOcean_Set($@)
($cmd1, $cmd2) = split(",", $cmd, 2); ($cmd1, $cmd2) = split(",", $cmd, 2);
# check values # check values
if (!defined($EnO_ptm200btn{$cmd1}) || ($cmd2 && !defined($EnO_ptm200btn{$cmd2}))) { if (!defined($EnO_ptm200btn{$cmd1}) || ($cmd2 && !defined($EnO_ptm200btn{$cmd2}))) {
$cmdList .= join(":noArg ", sort keys %EnO_ptm200btn); $cmdList .= join(":noArg ", sort keys %EnO_ptm200btn) . ':noArg';
return SetExtensions($hash, $cmdList, $name, @a); return SetExtensions($hash, $cmdList, $name, @a);
} }
my $channelA = ReadingsVal($name, "channelA", undef); my $channelA = ReadingsVal($name, "channelA", undef);
@ -1550,6 +1544,8 @@ sub EnOcean_Set($@)
# convert and send first and second command # convert and send first and second command
my $switchCmd; my $switchCmd;
($switchCmd, $status) = split(':', $EnO_ptm200btn{$cmd1}, 2); ($switchCmd, $status) = split(':', $EnO_ptm200btn{$cmd1}, 2);
# reset T21 status flag if 4 rocker
$status = '10' if ($switchCmd > 3);
$switchCmd <<= 5; $switchCmd <<= 5;
if ($cmd1 ne "released") { if ($cmd1 ne "released") {
# set the pressed flag # set the pressed flag
@ -1562,6 +1558,8 @@ sub EnOcean_Set($@)
$cmd = $cmd1; $cmd = $cmd1;
} else { } else {
my ($d2, undef) = split(':', $EnO_ptm200btn{$cmd2}, 2); my ($d2, undef) = split(':', $EnO_ptm200btn{$cmd2}, 2);
# reset T21 status flag if 4 rocker
$status = '10' if ($d2 > 3);
$switchCmd |= ($d2 << 1) | 0x01; $switchCmd |= ($d2 << 1) | 0x01;
} }
} }
@ -12614,7 +12612,6 @@ sub EnOcean_observeRepeat($)
return; return;
} }
#####
sub EnOcean_RLT($) { sub EnOcean_RLT($) {
# Radio Link Test # Radio Link Test
my ($rltParam) = @_; my ($rltParam) = @_;
@ -13120,7 +13117,6 @@ sub EnOcean_convIntToBit($$) {
return $data; return $data;
} }
#####
sub EnOcean_gpConvSelDataToSndData($$$$) { sub EnOcean_gpConvSelDataToSndData($$$$) {
# Generic Profiles, make selective data in hex # Generic Profiles, make selective data in hex
my ($header, $channel, $resolution, $data) = @_; my ($header, $channel, $resolution, $data) = @_;