minor correct plus some docu

git-svn-id: https://svn.fhem.de/fhem/trunk@4101 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876
2013-10-23 14:25:19 +00:00
parent 3a5072cc7b
commit 9cec4b21b3
3 changed files with 90 additions and 31 deletions

View File

@@ -1592,6 +1592,15 @@ sub CUL_HM_parseCommon(@){#####################################################
$reply = "ACK";
}
if ( $shash->{helper}{prt}{mmcA}
&& @{$shash->{helper}{prt}{mmcA}}
&& $shash->{helper}{prt}{mmcS} == 3){
if ($success eq 'yes'){
delete $shash->{helper}{prt}{mmcA};
delete $shash->{helper}{prt}{mmcS};
}
};
if($success){#do we have a final ack?
#mark timing on the channel, not the device
my $chn = sprintf("%02X",hex(substr($p,2,2))&0x3f);
@@ -1935,11 +1944,11 @@ sub CUL_HM_Get($@) {
}
}
my $addInfo = "";
$addInfo = CUL_HM_TCtempReadings($hash)
if ($md eq "HM-CC-TC" && $chn eq "02");
$addInfo = CUL_HM_repReadings($hash) if ($md eq "HM-Sys-sRP-Pl");
if ($md eq "HM-CC-TC" && $chn eq "02"){$addInfo = CUL_HM_TCtempReadings($hash)}
elsif ($md =~ m/HM-CC-RT-DN/ && $chn eq "04"){$addInfo = CUL_HM_RTtempReadings($hash)}
elsif ($md eq "HM-PB-4DIS-WM") {$addInfo = CUL_HM_4DisText($hash)}
elsif ($md eq "HM-Sys-sRP-Pl") {$addInfo = CUL_HM_repReadings($hash)}
return $name." type:".$st." - \n".
$regHeader.join("",sort(@regValList)).
$addInfo;
@@ -2226,6 +2235,8 @@ sub CUL_HM_Set($@) {
delete $hash->{EVENTS};
delete $hash->{helper}{prt}{rspWait};
delete $hash->{helper}{prt}{rspWaitSec};
delete $hash->{helper}{prt}{mmcA};
delete $hash->{helper}{prt}{mmcS};
#rescue "protLastRcv" for action detector.
my $protLastRcv = $hash->{protLastRcv} if ($hash->{protLastRcv});
delete ($hash->{$_}) foreach (grep(/^prot/,keys %{$hash}));
@@ -2357,7 +2368,7 @@ sub CUL_HM_Set($@) {
}
}
elsif($cmd eq "regSet") { ############################################### reg
#set <name> regSet <regName> [prep] <value> [<peerChn>]
#set <name> regSet [prep] <regName> <value> [<peerChn>]
#prep is internal use only. It allowes to prepare shadowReg only but supress
#writing. Application necessarily needs to execute writing subsequent.
my $prep = "";
@@ -3465,6 +3476,33 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response
}
}
my $mmcS = $hash->{helper}{prt}{mmcS}?$hash->{helper}{prt}{mmcS}:0;
if ($mTp eq '01'){
my ($chn,$sTp) = unpack 'A2A2',$p;
my $oCmd = "++".substr($cmd,6);
if ($sTp eq "05"){
my @arr = ($oCmd);
$hash->{helper}{prt}{mmcA}=\@arr;
$hash->{helper}{prt}{mmcS} = 1;
}
elsif ($sTp =~ m/(07|08)/ && ($mmcS == 1||$mmcS == 2)){
push @{$hash->{helper}{prt}{mmcA}},$oCmd;
$hash->{helper}{prt}{mmcS} = 2;
}
elsif ($sTp eq "06" && ($mmcS == 2)){
push @{$hash->{helper}{prt}{mmcA}},$oCmd;
$hash->{helper}{prt}{mmcS} = 3;
}
elsif ($mmcS){ #
delete $hash->{helper}{prt}{mmcA};
delete $hash->{helper}{prt}{mmcS};
}
}
elsif($mmcS){
delete $hash->{helper}{prt}{mmcA};
delete $hash->{helper}{prt}{mmcS};
}
if($hash->{cmdStack} && scalar @{$hash->{cmdStack}}){
$hash->{protCmdPend} = scalar @{$hash->{cmdStack}}." CMDs pending";
}
@@ -3599,6 +3637,13 @@ sub CUL_HM_respPendTout($) {
}
elsif ($pHash->{rspWait}{reSent} > AttrVal($hash->{NAME},"msgRepeat",3) # too much
||((CUL_HM_getRxType($hash) & 0x83) == 0)){ #to slow
if ($pHash->{mmcA}){
#shall we re-insert commands?
#unshift @{$hash->{cmdStack}},@{$pHash->{mmcA}};
delete $pHash->{mmcA};
delete $pHash->{mmcS};
}
if ($hash->{IODev}->{STATE} ne "opened"){#IO errors
CUL_HM_eventP($hash,"IOerr");
readingsSingleUpdate($hash,"state","IOerr",1);
@@ -4031,10 +4076,10 @@ sub CUL_HM_updtRegDisp($$$) {
CUL_HM_TCtempReadings($hash) if (($list == 5 ||$list == 6) &&
substr($hash->{DEF},6,2) eq "02");
}
if ($md =~ m/HM-CC-RT-DN/){#handle temperature readings
elsif ($md =~ m/HM-CC-RT-DN/){#handle temperature readings
CUL_HM_RTtempReadings($hash) if ($list == 7);
}
if ($md eq "HM-PB-4DIS-WM"){#add text
elsif ($md eq "HM-PB-4DIS-WM"){#add text
CUL_HM_4DisText($hash) if ($list == 1) ;
}
elsif ($st eq "repeater"){
@@ -4046,6 +4091,7 @@ sub CUL_HM_rmOldRegs($){ # remove register i outdated
#will remove register for deleted peers
my $name = shift;
my $hash = $defs{$name};
return if (!$hash->{peerList});# so far only peer-regs are removed
my @pList = split",",$hash->{peerList};
my @rpList;
foreach(grep /^R-(.*)-/,keys %{$hash->{READINGS}}){
@@ -4059,7 +4105,6 @@ sub CUL_HM_rmOldRegs($){ # remove register i outdated
}
}
#############################
#+++++++++++++++++ parameter cacculations +++++++++++++++++++++++++++++++++++++
my @culHmTimes8 = ( 0.1, 1, 5, 10, 60, 300, 600, 3600 );
@@ -5193,7 +5238,7 @@ sub CUL_HM_reglUsed($) {# provide data for HMinfo
set myblind regBulk 01 0C:00<br>
</code></ul>
myblind will set the max drive time up for a blind actor to 25,6sec</li>
<li><B>regSet &lt;regName&gt; [prep|exec] &lt;value&gt; &lt;peerChannel&gt;</B><a name="CUL_HMregSet"></a><br>
<li><B>regSet [prep|exec] &lt;regName&gt; &lt;value&gt; &lt;peerChannel&gt;</B><a name="CUL_HMregSet"></a><br>
For some major register a readable version is implemented supporting
register names &lt;regName&gt; and value conversionsing. Only a subset
of register can be supproted.<br>

View File

@@ -946,26 +946,17 @@ sub HMinfo_templateSet(@){#####################################################
return "peer necessary for template" if ($ret =~ m/peer required/ && !$pName);
return "Device doesn't support literal $regV for reg $regN" if ($ret =~ m/literal:/ && $ret !~ m/\b$regV\b/);
my ($min,$max) = ($1,$2) if ($ret =~ m/range:(.*) to (.*) :/);
$max = 0 if (!$max);
$max =~ s/([0-9\.]+).*/$1/;
return "$regV out of range: $min to $max" if ($min && ($regV < $min || $regV > $max));
return "$regV out of range: $min to $max" if ($min && ($regV < $min || ($max && $regV > $max)));
push @regCh,"$regN,$regV";
}
foreach (@regCh){#Finally write to shadow register.
my ($ret,undef) = CUL_HM_Set($aHash,$aName,"regSet","prep",split(",",$_),$pName);
return $ret if ($ret);
}
foreach my $regl (keys %{$aHash->{helper}{shadowReg}}){#write any existing shadowreg for this entity
my @new;
my $cur = $aHash->{READINGS}{$regl}{VAL};
foreach (split(" ",$aHash->{helper}{shadowReg}{$regl})){
push @new, $_ if ($cur !~ m/$_/);
}
next if (!@new); # nothing to write
my ($ret,undef) = CUL_HM_Set($aHash,$aName,"regBulk",$regl,@new);
return $ret if ($ret);
}
return "";
my ($ret,undef) = CUL_HM_Set($aHash,$aName,"regSet","exec",split(",",$regCh[0]),$pName);
return $ret;
}
sub HMinfo_templateChk(@){#####################################################
my ($aName,$tmpl,$pSet,@p) = @_;

View File

@@ -622,16 +622,29 @@ my %culHmRegDefine = (
reguExtP =>{a=>206.0,s=>1 ,l=>7,min=>25 ,max=>35 ,c=>'' ,f=>'' ,u=>'' ,d=>1,t=>"regulator P-param extern mode"},
reguExtPstart =>{a=>207.0,s=>1 ,l=>7,min=>5 ,max=>45 ,c=>'' ,f=>'' ,u=>'' ,d=>1,t=>"regulator P-param extern mode start value"},
);
#'THSensor'
#'thermostat'
#'smokeDetector'
#'sensor'
#'KFM100'
#'AlarmControl'
#'singleButton'
#'outputUnit'
#'repeater'
#'blindActuatorSol'
#'powerMeter'
my %culHmRegGeneral = (
intKeyVisib=>1,pairCentral=>1,
);
pairCentral=>1,
);
my %culHmRegType = (
swi =>{peerNeedsBurst =>1,expectAES =>1},
remote =>{peerNeedsBurst =>1,expectAES =>1,dblPress =>1,longPress =>1,
sign =>1
},
blindActuator =>{driveUp =>1,driveDown =>1,driveTurn =>1,refRunCounter =>1,
blindActuator =>{intKeyVisib =>1,
driveUp =>1,driveDown =>1,driveTurn =>1,refRunCounter =>1,
sign =>1,
MaxTimeF =>1,
OnDly =>1,OnTime =>1,OffDly =>1,OffTime =>1,
@@ -644,7 +657,8 @@ my %culHmRegType = (
CtOff =>1,CtDlyOff =>1,CtRampOff =>1,CtRefOff =>1,
lgMultiExec =>1
},
dimmer =>{transmitTryMax =>1,statusInfoMinDly=>1,statusInfoRandom=>1,powerUpAction =>1,
dimmer =>{intKeyVisib =>1,
transmitTryMax =>1,statusInfoMinDly=>1,statusInfoRandom=>1,powerUpAction =>1,
OnDly =>1,OnTime =>1,OffDly =>1,OffTime =>1,
OffDlyBlink =>1,OnLvlPrio =>1,OnDlyMode =>1,
ActionTypeDim =>1,OnTimeMode =>1,OffTimeMode =>1,
@@ -659,7 +673,7 @@ my %culHmRegType = (
OffDlyNewTime =>1,OffDlyOldTime =>1,
lgMultiExec =>1
},
switch =>{sign =>1,
switch =>{intKeyVisib =>1,sign =>1,
OnTime =>1,OffTime =>1,OnDly =>1,OffDly =>1,
SwJtOn =>1,SwJtOff =>1,SwJtDlyOn =>1,SwJtDlyOff =>1,
CtValLo =>1,CtValHi =>1,
@@ -686,7 +700,9 @@ my %culHmRegType = (
peerNeedsBurst =>1,expectAES =>1
},
sensRain =>{transmDevTryMax =>1,localResDis =>1},
tipTronic =>{cyclicInfoMsg =>1,cyclicInfoMsgDis=>1,localResDis =>1,RS485IdleTime =>1}
tipTronic =>{cyclicInfoMsg =>1,cyclicInfoMsgDis=>1,localResDis =>1,RS485IdleTime =>1},
powerMeter =>{intKeyVisib =>1},
);
#clones - - - - - - - - - - - - - - -
$culHmRegType{pushButton} = $culHmRegType{remote};
@@ -975,7 +991,7 @@ my %culHmGlobalSets = (# all but virtuals
regBulk => "<list>:<peer> <addr1:data1> <addr2:data2> ...",
getRegRaw => "[List0|List1|List2|List3|List4|List5|List6] ... [<PeerChannel>]",
getConfig => "",
regSet => "<regName> [prep|exec] <value> ... [<peerChannel>]",
regSet => "[prep|exec] <regName> <value> ... [<peerChannel>]",
clear => "[readings|register|rssi|msgEvents]",
);
my %culHmGlobalSetsVrtDev = (# virtuals and devices without subtype
@@ -1278,6 +1294,13 @@ my %culHmBits = (
STATUS => '4,2',
UNKNOWN => "6,2",
RSSI => '08,02,$val=(-1)*(hex($val))' } },
"10;p01=0A" => { txt => "INFO_TEMP", params => {
SET => '2,4,$val=(hex($val)>>10)&0x3F',
ACT => '2,4,$val=hex($val)&0x3FF',
ERR => "6,2",
VALVE => "6,2",
MODE => "6,2" } },
"11;p01=02" => { txt => "SET" , params => {
CHANNEL => "02,2",
VALUE => "04,2",