2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

initial HMID for HMLAN, TC peer reading corrected

git-svn-id: https://svn.fhem.de/fhem/trunk@3240 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-06-02 11:34:18 +00:00
parent 62bbd2d911
commit 782494fbb4
2 changed files with 50 additions and 40 deletions

View File

@ -15,7 +15,7 @@ sub HMLAN_secSince2000();
sub HMLAN_SimpleWrite(@);
my $debug = 0; # set 1 for better log readability
my $debug = 1; # set 1 for better log readability
my %sets = (
"hmPairForSec" => "HomeMatic",
"hmPairSerial" => "HomeMatic",
@ -60,7 +60,6 @@ sub HMLAN_Define($$) {#########################################################
my $name = $a[0];
my $dev = $a[2];
$dev .= ":1000" if($dev !~ m/:/ && $dev ne "none" && $dev !~ m/\@/);
$attr{$name}{hmId} = sprintf("%06X", time() % 0xffffff); # Will be overwritten
if($dev eq "none") {
Log 1, "$name device is none, commands will be echoed only";
@ -171,41 +170,42 @@ my %lhash; # remember which ID is assigned to this HMLAN
sub HMLAN_Write($$$) {#########################################################
my ($hash,$fn,$msg) = @_;
my ($mtype,$src,$dst) = (substr($msg, 8, 2),
substr($msg, 10, 6),
substr($msg, 16, 6));
my $ll5 = GetLogLevel($hash->{NAME},5);
if ($mtype eq "02" && $src eq $hash->{owner} && length($msg) == 24){
# Acks are generally send by HMLAN autonomously
# Special
Log $ll5, "HMLAN: Skip ACK" if (!$debug);
return;
}
# my $IDHM = '+'.$dst.',01,00,F1EF'; #used by HMconfig - meanning??
# my $IDadd = '+'.$dst; # guess: add ID?
# my $IDack = '+'.$dst.',02,00,'; # guess: ID acknowledge
# my $IDack = '+'.$dst.',FF,00,'; # guess: ID acknowledge
# my $IDsub = '-'.$dst; # guess: ID remove?
# my $IDnew = '+'.$dst.',00,01,'; # newChannel- trailing 01 to be sent if talk to neu channel
my $IDadd = '+'.$dst.',00,00,'; # guess: add ID?
if (!$lhash{$dst} && $dst ne "000000"){
HMLAN_SimpleWrite($hash, $IDadd);
delete $hash->{helper}{$dst};
my $rxt = CUL_HM_Get(CUL_HM_id2Hash($dst),CUL_HM_id2Name($dst),"param","rxType");
if (!($rxt & ~0x04)){#config only
$hash->{helper}{$dst}{newChn} = '+'.$dst.",01,01,FE1F";
if (length($msg)>22){
my ($mtype,$src,$dst) = (substr($msg, 8, 2),
substr($msg, 10, 6),
substr($msg, 16, 6));
my $ll5 = GetLogLevel($hash->{NAME},5);
if ($mtype eq "02" && $src eq $hash->{owner} && length($msg) == 24){
# Acks are generally send by HMLAN autonomously
# Special
Log $ll5, "HMLAN: Skip ACK" if (!$debug);
return;
}
# my $IDHM = '+'.$dst.',01,00,F1EF'; #used by HMconfig - meanning??
# my $IDadd = '+'.$dst; # guess: add ID?
# my $IDack = '+'.$dst.',02,00,'; # guess: ID acknowledge
# my $IDack = '+'.$dst.',FF,00,'; # guess: ID acknowledge
# my $IDsub = '-'.$dst; # guess: ID remove?
# my $IDnew = '+'.$dst.',00,01,'; # newChannel- trailing 01 to be sent if talk to neu channel
my $IDadd = '+'.$dst.',00,00,'; # guess: add ID?
if (!$lhash{$dst} && $dst ne "000000"){
HMLAN_SimpleWrite($hash, $IDadd);
delete $hash->{helper}{$dst};
my $rxt = CUL_HM_Get(CUL_HM_id2Hash($dst),CUL_HM_id2Name($dst),"param","rxType");
if (!($rxt & ~0x04)){#config only
$hash->{helper}{$dst}{newChn} = '+'.$dst.",01,01,FE1F";
}
else{
$hash->{helper}{$dst}{newChn} = '+'.$dst.',00,01,';
}
$hash->{helper}{$dst}{name} = CUL_HM_id2Name($dst);
$lhash{$dst} = 1;
$hash->{assignIDs}=join(',',keys %lhash);
$hash->{assignIDsCnt}=scalar(keys %lhash);
}
else{
$hash->{helper}{$dst}{newChn} = '+'.$dst.',00,01,';
}
$hash->{helper}{$dst}{name} = CUL_HM_id2Name($dst);
$lhash{$dst} = 1;
$hash->{assignIDs}=join(',',keys %lhash);
$hash->{assignIDsCnt}=scalar(keys %lhash);
}
my $tm = int(gettimeofday()*1000) % 0xffffffff;
$msg = sprintf("S%08X,00,00000000,01,%08X,%s",$tm, $tm, substr($msg, 4));
HMLAN_SimpleWrite($hash, $msg);
@ -366,8 +366,10 @@ sub HMLAN_Parse($$) {##########################################################
Log $ll5, 'HMLAN_Parse: '.$name. ' V:'.$mFld[1]
.' sNo:'.$mFld[2].' d:'.$mFld[3]
.' O:' .$mFld[4].' t:'.$mFld[5].' IDcnt:'.$mFld[6];
my $myId = AttrVal($name, "hmId", $mFld[4]);
if(lc($mFld[4]) ne lc($myId) && !AttrVal($name, "dummy", 0)) {
my $myId = AttrVal($name, "hmId", "");
$myId = $attr{$name}{hmId} = $mFld[4] if (!$myId);
if($mFld[4] ne $myId && !AttrVal($name, "dummy", 0)) {
Log 1, 'HMLAN setting owner to '.$myId.' from '.$mFld[4];
HMLAN_SimpleWrite($hash, "A$myId");
}

View File

@ -95,7 +95,7 @@ my %culHmModel=(
,chn=>"Btn:1:17,Disp:18:18",},
"0038" => {name=>"HM-RC-19-B" ,st=>'remote' ,cyc=>'' ,rxt=>'c:b' ,lst=>'1,4:1p.2p.3p.4p.5p.6p.7p.8p.9p.10p.11p.12p.13p.14p.15p.16p'
,chn=>"Btn:1:17,Disp:18:18",},
"0039" => {name=>"HM-CC-TC" ,st=>'thermostat' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'5:2.3p,6:2' ,chn=>"Weather:1:1,Climate:2:2,WindowRec:3:3",},
"0039" => {name=>"HM-CC-TC" ,st=>'thermostat' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'p:2p,5:2.3p,6:2',chn=>"Weather:1:1,Climate:2:2,WindowRec:3:3",},
"003A" => {name=>"HM-CC-VD" ,st=>'thermostat' ,cyc=>'28:00' ,rxt=>'c:w' ,lst=>'p,5' ,chn=>"",},
"003B" => {name=>"HM-RC-4-B" ,st=>'remote' ,cyc=>'' ,rxt=>'c' ,lst=>'1,4' ,chn=>"Btn:1:4",},
"003C" => {name=>"HM-WDS20-TH-O" ,st=>'THSensor' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'p' ,chn=>"",},
@ -325,6 +325,9 @@ my %culHmRegDefine = (
keypressSignal =>{a=> 3.0,s=>0.1,l=>0,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"Keypress beep" ,lit=>{off=>0,on=>1}},
signal =>{a=> 3.4,s=>0.1,l=>0,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"Confirmation beep" ,lit=>{off=>0,on=>1}},
signalTone =>{a=> 3.6,s=>0.2,l=>0,min=>0 ,max=>3 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"" ,lit=>{low=>0,mid=>1,high=>2,veryHigh=>3}},
brightness =>{a=> 4.0,s=>0.4,l=>0,min=>0 ,max=>15 ,c=>'' ,f=>'' ,u=>'' ,d=>1,t=>"Display brightness"},
energyOpt =>{a=> 8.0,s=>1.0,l=>0,min=>0 ,max=>127 ,c=>'factor' ,f=>2 ,u=>'s' ,d=>1,t=>"energy Option: Duration of ilumination"},
# sec_mdir
cyclicInfoMsg =>{a=> 9.0,s=>1.0,l=>0,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"cyclic message" ,lit=>{off=>0,on=>1}},
sabotageMsg =>{a=> 16.0,s=>1.0,l=>0,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"enable sabotage message" ,lit=>{off=>0,on=>1}},
@ -605,6 +608,7 @@ my %culHmRegModel = (
"HM-PB-4DIS-WM" =>{peerNeedsBurst =>1,expectAES =>1,language =>1,stbyTime =>1},
"HM-WDS100-C6-O" =>{stormUpThresh =>1,stormLowThresh =>1},
"KS550" =>{stormUpThresh =>1,stormLowThresh =>1},
"HM-OU-LED16" =>{brightness =>1,energyOpt =>1,localResDis =>1},
"HM-OU-CFM-PL" =>{localResetDis =>1,
OnTime =>1,OffTime =>1,OnDly =>1,OffDly =>1,
OnTimeMode =>1,OffTimeMode =>1,
@ -949,11 +953,15 @@ my %culHmBits = (
"11;p02=8100" => { txt => "LEDall" , params => {
Led1To16 => '04,8,$val= join(":",sprintf("%b",hex($val))=~ /(.{2})/g)',
} },
"11;p01=81" => { txt => "LEVEL" , params => {
CHANNEL => "02,2",
"11;p01=81" => { txt => "LEVEL" , params => {
CHANNEL => "02,2",
TIME => '04,2,$val=hex($val)',
SPEED => '06,2,$val=hex($val)',
} },
"11;p01=82" => { txt => "Sleepmode" , params => {#only LED16?
CHANNEL => "02,2",
MODE => '04,2,$val=hex($val)',
} },
"12" => { txt => "HAVE_DATA"},
"3E" => { txt => "SWITCH", params => {
DST => "00,6",