mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
io handling, templist handling
git-svn-id: https://svn.fhem.de/fhem/trunk@6008 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
042d3b8c1b
commit
bacaf739c4
@ -540,7 +540,7 @@ sub HMLAN_Parse($$) {##########################################################
|
||||
# 00 30= should: AES response failed
|
||||
# 00 4x= AES response accepted
|
||||
# 00 50= ??(seen with 'R')
|
||||
# 00 8x= first AES-response for this device?
|
||||
# 00 8x= response to a message send autonomous by HMLAN (e.g. A112 -> wakeup)
|
||||
# 01 xx= ?? 0100 AES response send (gen autoMsgSent)
|
||||
# 02 xx= prestate to 04xx. Message is still sent. This is a warning
|
||||
# 04 xx= nothing sent anymore. Any restart unsuccessful except power
|
||||
@ -552,9 +552,7 @@ sub HMLAN_Parse($$) {##########################################################
|
||||
# 2 Warning-HighLoad
|
||||
# 4 Overload condition - no send anymore
|
||||
#
|
||||
my $stat = hex($mFld[1]);
|
||||
my $HMcnd =$stat >>8; #high = HMLAN cond
|
||||
$stat &= 0xff; # low byte related to message format
|
||||
my ($HMcnd,$stat) = map{hex($_)} unpack('A2A2',($mFld[1]));
|
||||
|
||||
if ($HMcnd == 0x01 && $mFld[3] ne "FF"){#HMLAN responded to AES request
|
||||
$CULinfo = "AESKey-".$mFld[3];
|
||||
|
@ -742,38 +742,44 @@ sub CUL_HM_hmInitMsg($){ #define device init msg for HMLAN
|
||||
#bit-usage is widely unknown.
|
||||
my ($hash)=@_;
|
||||
my $rxt = CUL_HM_getRxType($hash);
|
||||
my @p;
|
||||
if (!($rxt & ~0x04)){@p = ("00","01","FE1F");}#config only
|
||||
elsif($rxt & 0x10) {@p = ("00","01","1E"); }#lazyConfig
|
||||
else {@p = ("00","01","00"); }
|
||||
# else {@p = ("00","01","1E"); }
|
||||
if (AttrVal($hash->{NAME},"aesCommReq",0)){
|
||||
$p[0] = sprintf("%02X",($p[0] + 1));
|
||||
$p[2] = ($p[2]eq "")?"1E":$p[2];
|
||||
}
|
||||
my $id = CUL_HM_hash2Id($hash);
|
||||
$hash->{helper}{io}{newChn} = "+$id,".join(",",@p);
|
||||
my @p;
|
||||
if (!($rxt & ~0x04)){@p = ("$id","00","01","FE1F");}#config only
|
||||
elsif($rxt & 0x10) {@p = ("$id","00","01","1E"); }#lazyConfig
|
||||
else {@p = ("$id","00","01","00"); }
|
||||
# else {@p = ("$id","00","01","1E"); }
|
||||
if (AttrVal($hash->{NAME},"aesCommReq",0)){
|
||||
$p[1] = sprintf("%02X",(hex($p[1]) + 1));
|
||||
$p[3] = ($p[3]eq "")?"1E":$p[3];
|
||||
}
|
||||
$hash->{helper}{io}{newChn} = "";
|
||||
$hash->{helper}{io}{rxt} = ($rxt & 0x08)?2:0;
|
||||
$hash->{helper}{io}{p} = \@p;
|
||||
CUL_HM_hmInitMsgUpdt($hash);
|
||||
}
|
||||
sub CUL_HM_hmInitMsgUpdt($){ #update device init msg for HMLAN
|
||||
my ($hash)=@_;
|
||||
|
||||
my $oldChn = $hash->{helper}{io}{newChn};
|
||||
my @p = unpack 'A8A2A*',$oldChn;
|
||||
my @p = @{$hash->{helper}{io}{p}};
|
||||
# General todo
|
||||
# $p[1] |= 2; need to be set if data is pending for a wakeup device.
|
||||
# it will force HMLAN to send A112 (have data). HMLAN will return
|
||||
# status "81" ACK if the device answers the A112 - FHEM should start sending Data by then
|
||||
#
|
||||
if($hash->{helper}{prt}{sProc}){
|
||||
$p[1] |= 2;
|
||||
$p[1] = sprintf("%02X",hex($p[1]) | $hash->{helper}{io}{rxt});
|
||||
}
|
||||
else{
|
||||
$p[1] &= 0xFD;# remove this Bit if no more data to send
|
||||
# otherwise could cause continous send (e.g. from SC
|
||||
}
|
||||
$hash->{helper}{io}{newChn} = sprintf("%s%02X%s",@p);
|
||||
if (($hash->{helper}{io}{newChn} ne $oldChn)
|
||||
&&$hash->{IODev}
|
||||
&&$hash->{IODev}->{TYPE}
|
||||
&&($hash->{IODev}->{TYPE} eq "HMLAN")){
|
||||
my $id = CUL_HM_hash2Id($hash);
|
||||
IOWrite($hash, "", "init:$id");
|
||||
# else{
|
||||
# $p[1] = sprintf("%02X",hex($p[1]) & 0xFD);# remove this Bit if no more data to send
|
||||
# # otherwise could cause continous send (e.g. from SC)
|
||||
# }
|
||||
$hash->{helper}{io}{newChn} = '+'.join(",",@p);
|
||||
if (( $hash->{helper}{io}{newChn} ne $oldChn)
|
||||
&& $hash->{IODev}
|
||||
&& $hash->{IODev}->{TYPE}
|
||||
&& $hash->{IODev}->{TYPE} eq "HMLAN"){
|
||||
IOWrite($hash, "", "init:$p[0]");
|
||||
}
|
||||
}
|
||||
|
||||
@ -6624,7 +6630,7 @@ sub CUL_HM_getAttrInt($@){#return attrValue as integer
|
||||
my ($name,$attrName,$default) = @_;
|
||||
$default = 0 if (!defined $default);
|
||||
if($defs{$name}){
|
||||
my $val = ($attr{$name}{$attrName})
|
||||
my $val = (defined $attr{$name}{$attrName})
|
||||
?$attr{$name}{$attrName}
|
||||
:"";
|
||||
no warnings 'numeric';
|
||||
@ -6762,8 +6768,13 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
|
||||
my @el = split",",$name;
|
||||
my ($fName,$tmpl) = split":",$template;
|
||||
if (!$tmpl){
|
||||
$tmpl = $fName;
|
||||
$fName = "tempList.cfg";
|
||||
if(defined $tmpl){
|
||||
$tmpl = $name;
|
||||
}
|
||||
else{#only template was given
|
||||
$tmpl = $fName;
|
||||
$fName = "tempList.cfg";
|
||||
}
|
||||
}
|
||||
return "file: $fName for $name does not exist" if (!(-e $fName));
|
||||
open(aSave, "$fName") || return("Can't open $fName: $!");
|
||||
|
@ -232,7 +232,7 @@ my $K_actDetID = '000000'; # id of actionDetector
|
||||
"00A6" => {name=>"HM-RC-Key4-2" ,st=>'remote' ,cyc=>'' ,rxt=>'c:l' ,lst=>'1,4' ,chn=>"lock:1:1,unlock:2:2,open:3:3,light:4:4",},
|
||||
"00A7" => {name=>"HM-Sen-RD-O" ,st=>'sensRain' ,cyc=>'' ,rxt=>'' ,lst=>'1:1,4:1p' ,chn=>"Rain:1:1,Heating:2:2",},#stc:70 THSensor
|
||||
"00A8" => {name=>"HM-WDS30-OT2-SM" ,st=>'THSensor' ,cyc=>'12:00' ,rxt=>'c:w:f' ,lst=>'p' ,chn=>"T1:1:1,T2:2:2,T1_T2:3:3,T2_T1:4:4,Event:5:5",},
|
||||
"00A9" => {name=>"HM-PB-6-WM55" ,st=>'remote' ,cyc=>'' ,rxt=>'c' ,lst=>'1,4' ,chn=>"Btn:1:6",},
|
||||
"00A9" => {name=>"HM-PB-6-WM55" ,st=>'remote' ,cyc=>'' ,rxt=>'c:l' ,lst=>'1,4' ,chn=>"Btn:1:6",},
|
||||
"00AB" => {name=>"HM-LC-SW4-BA-PCB" ,st=>'switch' ,cyc=>'' ,rxt=>'b' ,lst=>'1,3' ,chn=>"Sw:1:4",},
|
||||
"00AC" => {name=>"HM-ES-PMSw1-Pl" ,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"},
|
||||
|
Loading…
Reference in New Issue
Block a user