diff --git a/FHEM/00_HMLAN.pm b/FHEM/00_HMLAN.pm index ad6edda91..4628b9b40 100755 --- a/FHEM/00_HMLAN.pm +++ b/FHEM/00_HMLAN.pm @@ -15,7 +15,7 @@ sub HMLAN_secSince2000(); sub HMLAN_SimpleWrite(@); -my $debug = 1; # set 1 for better log readability +my $debug = 0; # set 1 for better log readability my %sets = ( "hmPairForSec" => "HomeMatic", "hmPairSerial" => "HomeMatic", diff --git a/FHEM/10_CUL_HM.pm b/FHEM/10_CUL_HM.pm index 67aee8755..8225d2e79 100755 --- a/FHEM/10_CUL_HM.pm +++ b/FHEM/10_CUL_HM.pm @@ -111,6 +111,7 @@ sub CUL_HM_autoReadConfig($){ my $name = shift(@{$modules{CUL_HM}{helper}{updtCfgLst}}); my $hash = CUL_HM_name2Hash($name); if (1 == AttrVal($name,"autoReadReg","0")){ + CUL_HM_Set($hash,$name,"getSerial"); CUL_HM_Set($hash,$name,"getConfig"); CUL_HM_Set($hash,$name,"statusRequest"); InternalTimer(gettimeofday()+15,"CUL_HM_autoReadConfig","updateConfig",0); @@ -211,7 +212,7 @@ sub CUL_HM_updateConfig($){ push @getConfList,$name if (1 == AttrVal($name,"autoReadReg","0")); } $modules{CUL_HM}{helper}{updtCfgLst} = \@getConfList; -#General CUL_HM_autoReadConfig("updateConfig"); + CUL_HM_autoReadConfig("updateConfig"); } sub CUL_HM_Define($$) {############################## my ($hash, $def) = @_; @@ -1286,18 +1287,12 @@ sub CUL_HM_parseCommon(@){##################################################### CUL_HM_ProcessCmdStack($shash); } + if ($shash->{helper}{respWait}{msgId} && + $shash->{helper}{respWait}{msgId} eq $msgId ){ + #response we waited for - stop Waiting + CUL_HM_respPendRm($shash); + } if ($msgType eq "02"){# Ack/Nack ############################# - if ($shash->{helper}{respWait}{msgId} && - $shash->{helper}{respWait}{msgId} eq $msgId ){ - #ack we waited for - stop Waiting - CUL_HM_respPendRm($shash); - } - if ($pendType eq "StatusReq"){#possible answer for status request - my $chnSrc = $src.$shash->{helper}{respWait}{forChn}; - my $chnhash = $modules{CUL_HM}{defptr}{$chnSrc}; - $chnhash = $shash if (!$chnhash); - CUL_HM_respPendRm($shash); - } #see if the channel is defined separate - otherwise go for chief my $subType = substr($p,0,2); @@ -1345,7 +1340,11 @@ sub CUL_HM_parseCommon(@){##################################################### } elsif($msgType eq "10"){###################################### my $subType = substr($p,0,2); - if($subType eq "01"){ #storePeerList################# + if($subType eq "00"){ #storePeerList################# + $attr{$shash->{NAME}}{serialNR} = pack("H*",substr($p,2,20)); + return "done"; + } + elsif($subType eq "01"){ #storePeerList################# if ($pendType eq "PeerList"){ my $chn = $shash->{helper}{respWait}{forChn}; my $chnhash = $modules{CUL_HM}{defptr}{$src.$chn}; @@ -1800,6 +1799,10 @@ sub CUL_HM_Set($@) { CUL_HM_PushCmdStack($hash,'++'.$flag.'01'.$id.$dst.$chn.'03'); $state = ""; } + elsif($cmd eq "getSerial") { ############################################ + CUL_HM_PushCmdStack($hash,'++'.$flag.'01'.$id.$dst.'0009'); + $state = ""; + } elsif($cmd eq "getConfig") { ################################################ my $chFound = 0; CUL_HM_PushCmdStack($hash,'++'.$flag.'01'.$id.$dst.'00040000000000') @@ -2692,16 +2695,6 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response # InternalTimer(gettimeofday()+$rTo, "CUL_HM_respPendTout", "respPend:$dst", 0); # return; # } - elsif($subType eq "0E"){ #StatusReq---------- - #--- set messaging items - $hash->{helper}{respWait}{Pending}= "StatusReq"; - $hash->{helper}{respWait}{PendCmd}= $cmd; - $hash->{helper}{respWait}{forChn} = $chn; - - # define timeout - holdup cmdStack until response complete or timeout - InternalTimer(gettimeofday()+$rTo, "CUL_HM_respPendTout", "respPend:$dst", 0); - return; - } } if (($msgFlag & 0x20) && ($dst ne '000000')){ @@ -3887,6 +3880,9 @@ sub CUL_HM_putHash($) {# provide data for HMinfo set mydimmer getRegRaw List3 all
+
  • getSerial
    + Read serial number from device and write it to attribute serialNr. +
  • pair
    Pair the device with a known serialNumber (e.g. after a device reset) to FHEM Central unit. FHEM Central is usualy represented by CUL/CUNO, diff --git a/FHEM/HMConfig.pm b/FHEM/HMConfig.pm index c2f7f9cbc..2727061a1 100644 --- a/FHEM/HMConfig.pm +++ b/FHEM/HMConfig.pm @@ -638,6 +638,7 @@ my %culHmGlobalSetsDevice = ( pair => "", unpair => "", getpair => "", + getSerial => "", virtual =>"", ); my %culHmGlobalSets = (