mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-29 23:47:10 +00:00
add getSerial, improve message sequence
git-svn-id: https://svn.fhem.de/fhem/trunk@2876 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
58f7f35214
commit
34fd46aa1b
@ -15,7 +15,7 @@ sub HMLAN_secSince2000();
|
|||||||
|
|
||||||
sub HMLAN_SimpleWrite(@);
|
sub HMLAN_SimpleWrite(@);
|
||||||
|
|
||||||
my $debug = 1; # set 1 for better log readability
|
my $debug = 0; # set 1 for better log readability
|
||||||
my %sets = (
|
my %sets = (
|
||||||
"hmPairForSec" => "HomeMatic",
|
"hmPairForSec" => "HomeMatic",
|
||||||
"hmPairSerial" => "HomeMatic",
|
"hmPairSerial" => "HomeMatic",
|
||||||
|
@ -111,6 +111,7 @@ sub CUL_HM_autoReadConfig($){
|
|||||||
my $name = shift(@{$modules{CUL_HM}{helper}{updtCfgLst}});
|
my $name = shift(@{$modules{CUL_HM}{helper}{updtCfgLst}});
|
||||||
my $hash = CUL_HM_name2Hash($name);
|
my $hash = CUL_HM_name2Hash($name);
|
||||||
if (1 == AttrVal($name,"autoReadReg","0")){
|
if (1 == AttrVal($name,"autoReadReg","0")){
|
||||||
|
CUL_HM_Set($hash,$name,"getSerial");
|
||||||
CUL_HM_Set($hash,$name,"getConfig");
|
CUL_HM_Set($hash,$name,"getConfig");
|
||||||
CUL_HM_Set($hash,$name,"statusRequest");
|
CUL_HM_Set($hash,$name,"statusRequest");
|
||||||
InternalTimer(gettimeofday()+15,"CUL_HM_autoReadConfig","updateConfig",0);
|
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"));
|
push @getConfList,$name if (1 == AttrVal($name,"autoReadReg","0"));
|
||||||
}
|
}
|
||||||
$modules{CUL_HM}{helper}{updtCfgLst} = \@getConfList;
|
$modules{CUL_HM}{helper}{updtCfgLst} = \@getConfList;
|
||||||
#General CUL_HM_autoReadConfig("updateConfig");
|
CUL_HM_autoReadConfig("updateConfig");
|
||||||
}
|
}
|
||||||
sub CUL_HM_Define($$) {##############################
|
sub CUL_HM_Define($$) {##############################
|
||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
@ -1286,18 +1287,12 @@ sub CUL_HM_parseCommon(@){#####################################################
|
|||||||
CUL_HM_ProcessCmdStack($shash);
|
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 ($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
|
#see if the channel is defined separate - otherwise go for chief
|
||||||
my $subType = substr($p,0,2);
|
my $subType = substr($p,0,2);
|
||||||
@ -1345,7 +1340,11 @@ sub CUL_HM_parseCommon(@){#####################################################
|
|||||||
}
|
}
|
||||||
elsif($msgType eq "10"){######################################
|
elsif($msgType eq "10"){######################################
|
||||||
my $subType = substr($p,0,2);
|
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"){
|
if ($pendType eq "PeerList"){
|
||||||
my $chn = $shash->{helper}{respWait}{forChn};
|
my $chn = $shash->{helper}{respWait}{forChn};
|
||||||
my $chnhash = $modules{CUL_HM}{defptr}{$src.$chn};
|
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');
|
CUL_HM_PushCmdStack($hash,'++'.$flag.'01'.$id.$dst.$chn.'03');
|
||||||
$state = "";
|
$state = "";
|
||||||
}
|
}
|
||||||
|
elsif($cmd eq "getSerial") { ############################################
|
||||||
|
CUL_HM_PushCmdStack($hash,'++'.$flag.'01'.$id.$dst.'0009');
|
||||||
|
$state = "";
|
||||||
|
}
|
||||||
elsif($cmd eq "getConfig") { ################################################
|
elsif($cmd eq "getConfig") { ################################################
|
||||||
my $chFound = 0;
|
my $chFound = 0;
|
||||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'01'.$id.$dst.'00040000000000')
|
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);
|
# InternalTimer(gettimeofday()+$rTo, "CUL_HM_respPendTout", "respPend:$dst", 0);
|
||||||
# return;
|
# 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')){
|
if (($msgFlag & 0x20) && ($dst ne '000000')){
|
||||||
@ -3887,6 +3880,9 @@ sub CUL_HM_putHash($) {# provide data for HMinfo
|
|||||||
set mydimmer getRegRaw List3 all <br>
|
set mydimmer getRegRaw List3 all <br>
|
||||||
</code></ul>
|
</code></ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><B>getSerial</B><a name="CUL_HMgetSerial"></a><br>
|
||||||
|
Read serial number from device and write it to attribute serialNr.
|
||||||
|
</li>
|
||||||
<li><B>pair</B><a name="CUL_HMpair"></a><br>
|
<li><B>pair</B><a name="CUL_HMpair"></a><br>
|
||||||
Pair the device with a known serialNumber (e.g. after a device reset)
|
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,
|
to FHEM Central unit. FHEM Central is usualy represented by CUL/CUNO,
|
||||||
|
@ -638,6 +638,7 @@ my %culHmGlobalSetsDevice = (
|
|||||||
pair => "",
|
pair => "",
|
||||||
unpair => "",
|
unpair => "",
|
||||||
getpair => "",
|
getpair => "",
|
||||||
|
getSerial => "",
|
||||||
virtual =>"<noButtons>",
|
virtual =>"<noButtons>",
|
||||||
);
|
);
|
||||||
my %culHmGlobalSets = (
|
my %culHmGlobalSets = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user