correct devicereference for set command, improve statusrequest

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2321 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876
2012-12-12 19:10:48 +00:00
parent f85ee1aee3
commit 74422632a0

View File

@@ -1488,8 +1488,7 @@ CUL_HM_Get($@)
return "no get value specified" if(@a < 2); return "no get value specified" if(@a < 2);
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $devName = $hash->{device};# get devName as protocol entity my $devName = $hash->{device}?$hash->{device}:$name;
$devName = $name if (!$devName); # we control ourself if no device available
my $st = AttrVal($devName, "subType", ""); my $st = AttrVal($devName, "subType", "");
my $md = AttrVal($devName, "model", ""); my $md = AttrVal($devName, "model", "");
my $mId = CUL_HM_getMId($hash); my $mId = CUL_HM_getMId($hash);
@@ -1804,7 +1803,7 @@ CUL_HM_Set($@)
return "no set value specified" if(@a < 2); return "no set value specified" if(@a < 2);
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $devName = AttrVal($name, "device" , $name);# devName as protocol entity my $devName = $hash->{device}?$hash->{device}:$name;
my $st = AttrVal($devName, "subType", ""); my $st = AttrVal($devName, "subType", "");
my $md = AttrVal($devName, "model" , ""); my $md = AttrVal($devName, "model" , "");
my $class = AttrVal($devName, "hmClass", "");#relevant is the device my $class = AttrVal($devName, "hmClass", "");#relevant is the device
@@ -2819,10 +2818,11 @@ CUL_HM_respPendTout($)
my $hash = $modules{CUL_HM}{defptr}{$HMid}; my $hash = $modules{CUL_HM}{defptr}{$HMid};
if ($hash && $hash->{DEF} ne '000000'){ if ($hash && $hash->{DEF} ne '000000'){
CUL_HM_eventP($hash,"Tout") if ($hash->{helper}{respWait}{cmd}); CUL_HM_eventP($hash,"Tout") if ($hash->{helper}{respWait}{cmd});
CUL_HM_eventP($hash,"ToutResp") if ($hash->{helper}{respWait}{Pending}); my $pendCmd = $hash->{helper}{respWait}{Pending};# save before remove
CUL_HM_eventP($hash,"ToutResp") if ($pendCmd);
CUL_HM_respPendRm($hash); CUL_HM_respPendRm($hash);
CUL_HM_ProcessCmdStack($hash); # continue processing commands CUL_HM_ProcessCmdStack($hash); # continue processing commands
readingsSingleUpdate($hash,"state","RESPONSE TIMEOUT",1); readingsSingleUpdate($hash,"state","RESPONSE TIMEOUT:".$pendCmd,1);
} }
} }
sub #--------------------------------- sub #---------------------------------
@@ -3241,11 +3241,18 @@ CUL_HM_parseCommon(@){
CUL_HM_SndCmd($shash, '++A112'.CUL_HM_Id($shash->{IODev}).$src); CUL_HM_SndCmd($shash, '++A112'.CUL_HM_Id($shash->{IODev}).$src);
CUL_HM_ProcessCmdStack($shash); CUL_HM_ProcessCmdStack($shash);
} }
if ($msgType eq "02"){# Ack/Nack ####################################### if ($msgType eq "02"){# Ack/Nack #######################################
if ($shash->{helper}{respWait}{msgId} && if ($shash->{helper}{respWait}{msgId} &&
$shash->{helper}{respWait}{msgId} eq $msgId ){ $shash->{helper}{respWait}{msgId} eq $msgId ){
#ack we waited for - stop Waiting #ack we waited for - stop Waiting
CUL_HM_respPendRm($shash); 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
@@ -3404,7 +3411,7 @@ CUL_HM_parseCommon(@){
my $chnhash = $modules{CUL_HM}{defptr}{$chnSrc}; my $chnhash = $modules{CUL_HM}{defptr}{$chnSrc};
$chnhash = $shash if (!$chnhash); $chnhash = $shash if (!$chnhash);
CUL_HM_respPendRm($shash); CUL_HM_respPendRm($shash);
return "STATresp";# todo dont send ACK - check what others do return "STATresp";
} }
else{ else{
my ($chn) = ($1) if($p =~ m/^..(..)/); my ($chn) = ($1) if($p =~ m/^..(..)/);