From 189ab5c180be2318e15bd574f3fbd239dd2f2e4a Mon Sep 17 00:00:00 2001 From: martinp876 <> Date: Sun, 16 Aug 2015 10:16:27 +0000 Subject: [PATCH] 10_CUL_HM: code cleanup git-svn-id: https://svn.fhem.de/fhem/trunk@9078 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_CUL_HM.pm | 25 +++++++++++++------------ fhem/FHEM/HMConfig.pm | 6 +++++- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm index 5377e234b..827f4771f 100755 --- a/fhem/FHEM/10_CUL_HM.pm +++ b/fhem/FHEM/10_CUL_HM.pm @@ -2367,7 +2367,7 @@ sub CUL_HM_Parse($$) {######################################################### } if($ioId eq $mh{dst} && $mh{mFlgH}&0x20 && $state){ - push @ack,$mh{shash},$mh{mNo}."8002".$ioId.$mh{src}."0101$mh{state}00"; + push @ack,$mh{shash},$mh{mNo}."8002".$ioId.$mh{src}."0101".$state."00"; } } elsif($mh{st} eq "smokeDetector") { ######################################### @@ -2681,13 +2681,12 @@ sub CUL_HM_parseCommon(@){##################################################### $mhp->{devH}{helper}{PONtest} = 1 if($mhp->{mNo} eq "00"); my $repeat; if ($mhp->{mTp} eq "02"){# Ack/Nack/aesReq #################### - my $subType = substr($mhp->{p},0,2); my $reply; my $success; if ($mhp->{devH}{helper}{prt}{rspWait}{brstWu}){ if ($mhp->{devH}{helper}{prt}{rspWait}{mNo} eq $mhp->{mNo} && - $subType eq "00"){ + $mhp->{mStp} eq "00"){ if ($mhp->{devH}{helper}{prt}{awake} && $mhp->{devH}{helper}{prt}{awake}==4){#re-burstWakeup delete $mhp->{devH}{helper}{prt}{rspWait};#clear burst-wakeup values $mhp->{devH}{helper}{prt}{rspWait}{$_} = $mhp->{devH}{helper}{prt}{rspWaitSec}{$_} @@ -2718,7 +2717,7 @@ sub CUL_HM_parseCommon(@){##################################################### delete $mhp->{devH}{helper}{AESreqAck}; } - if ($subType =~ m/^8/){#NACK + if ($mhp->{mStp} =~ m/^8/){#NACK #82 : peer not accepted - list full (VD) #84 : request undefined register #85 : peer not accepted - why? unknown @@ -2726,16 +2725,18 @@ sub CUL_HM_parseCommon(@){##################################################### CUL_HM_eventP($mhp->{devH},"Nack"); $reply = "NACK"; } - elsif($subType eq "01"){ #ACKinfo################# + elsif($mhp->{mStp} eq "01"){ #ACKinfo################# $success = "yes"; CUL_HM_m_setCh($mhp,substr($mhp->{p},2,2)); - my $rssi = substr($mhp->{p},8,2); push @evtEt,[$mhp->{cHash},0,"recentStateType:ack"]; - CUL_HM_storeRssi( $mhp->{devN} - ,$mhp->{dstN} - ,(-1)*(hex($rssi)) - ,$mhp->{mNo}) - if ($rssi && $rssi ne '00' && $rssi ne'80'); + if (length($mhp->{p})>9){ + my $rssi = substr($mhp->{p},8,2); + CUL_HM_storeRssi( $mhp->{devN} + ,$mhp->{dstN} + ,(-1)*(hex($rssi)) + ,$mhp->{mNo}) + if ($rssi && $rssi ne '00' && $rssi ne'80'); + } $reply = "ACKStatus"; if ($mhp->{devH}{helper}{tmdOn}){ if ((not hex(substr($mhp->{p},6,2))&0x40) && # not timedOn, we have to repeat @@ -2750,7 +2751,7 @@ sub CUL_HM_parseCommon(@){##################################################### } } } - elsif($subType eq "04"){ #ACK-AES, ############### + elsif($mhp->{mStp} eq "04"){ #ACK-AES, ############### my (undef,$challenge,$aesKeyNbr) = unpack'A2A12A2',$mhp->{p}; push @evtEt,[$mhp->{devH},1,"aesKeyNbr:".$aesKeyNbr] if (defined $aesKeyNbr);# if ($mh{msgStat} =~ m/AESKey/) diff --git a/fhem/FHEM/HMConfig.pm b/fhem/FHEM/HMConfig.pm index be0936824..248db36f6 100644 --- a/fhem/FHEM/HMConfig.pm +++ b/fhem/FHEM/HMConfig.pm @@ -218,7 +218,7 @@ my $K_actDetID = '000000'; # id of actionDetector ,"0091" => {name=>"Schueco_263-167" ,st=>'smokeDetector' ,cyc=>'99:00' ,rxt=>'b' ,lst=>'p' ,chn=>"",} # HM Smoke Detector Schueco ,"0092" => {name=>"Schueco_263-144" ,st=>'switch' ,cyc=>'' ,rxt=>'c' ,lst=>'1,3' ,chn=>"",} # HM Switch Interface 3 switches ,"0093" => {name=>"Schueco_263-158" ,st=>'THSensor' ,cyc=>'00:10' ,rxt=>'c:w:f' ,lst=>'p' ,chn=>"",} # - ,"0094" => {name=>"IS-WDS-TH-OD-S-R3" ,st=>'THSensor' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'p' ,chn=>"",} # + ,"0094" => {name=>"Schueco_263-157" ,st=>'THSensor' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'p' ,chn=>"",} # ,"0095" => {name=>"HM-CC-RT-DN" ,st=>'thermostat' ,cyc=>'00:10' ,rxt=>'c:w:f' ,lst=>'p:1p.2p.4p.5p.6p,3:3p.6p,1,7:3p.4' ,chn=>"Weather:1:1,Climate:2:2,WindowRec:3:3,Clima:4:4,ClimaTeam:5:5,remote:6:6"} # ,"0096" => {name=>"WDF-solar" ,st=>'blindActuatorSol' ,cyc=>'' ,rxt=>'b' ,lst=>'1,3' ,chn=>"win:1:1,blind:2:3",} # @@ -275,6 +275,9 @@ my $K_actDetID = '000000'; # id of actionDetector ,"00D2" => {name=>"HM-LC-Bl1-FM-2" ,st=>'blindActuator' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",} # radio-controlled blind actuator 1-channel (flush-mount) # check config modess,"00D3" => {name=>"HM-Dis-WM55" ,st=>'pushButton' ,cyc=>'' ,rxt=>'c:w:l' ,lst=>'1' ,chn=>"Dis:1:10",} ,"00D3" => {name=>"HM-Dis-WM55" ,st=>'pushButton' ,cyc=>'' ,rxt=>'c' ,lst=>'1,p' ,chn=>"Dis:1:10",} + ,"00D4" => {name=>"HM-RC-4-3" ,st=>'remote' ,cyc=>'' ,rxt=>'c:w:l' ,lst=>'1,4' ,chn=>"Btn:1:4",} + ,"00D5" => {name=>"HM-RC-Sec4-3" ,st=>'remote' ,cyc=>'' ,rxt=>'c:l' ,lst=>'1,4' ,chn=>"armInt:1:1,armExt:2:2,light:3:3,disarm:4:4",} + ,"00D6" => {name=>"HM-RC-Key4-3" ,st=>'remote' ,cyc=>'' ,rxt=>'c:l' ,lst=>'1,4' ,chn=>"unlock:1:1,lock:2:2,light:3:3,open:4:4",} ,"00D7" => {name=>"HM-ES-PMSw1-Pl-DN-R1" ,st=>'powerMeter' ,cyc=>'00:10' ,rxt=>'' ,lst=>'1:2.3.4.5.6,3:1p,4:3p.4p.5p.6p' ,chn=>"Sw:1:1,Pwr:2:2,SenPwr:3:3,SenI:4:4,SenU:5:5,SenF:6:6"} ,"00D8" => {name=>"HM-LC-Sw1-Pl-DN-R1" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",} @@ -305,6 +308,7 @@ my $K_actDetID = '000000'; # id of actionDetector ,"00ED" => {name=>"HM-LC-Sw1-Pl-CT-R3" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",} ,"00EE" => {name=>"HM-LC-Sw1-Pl-CT-R4" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",} ,"00EF" => {name=>"HM-LC-Sw1-Pl-CT-R5" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",} + ,"00F0" => {name=>"HM-LC-Sw1-DR" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",} ,"8001" => {name=>"PS-switch" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:4",} ,"8002" => {name=>"PS-Th-Sens" ,st=>'THSensor' ,cyc=>'' ,rxt=>'' ,lst=>'1,4' ,chn=>"Sen:1:4",} ,"FFF0" => {name=>"CCU-FHEM" ,st=>'virtual' ,cyc=>'' ,rxt=>'' ,lst=>'' ,chn=>"Btn:1:50",}