2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

enhance CC-RT

git-svn-id: https://svn.fhem.de/fhem/trunk@3932 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-09-20 18:46:51 +00:00
parent 065f6808a0
commit 31a68e44b9
2 changed files with 103 additions and 21 deletions

View File

@ -396,7 +396,8 @@ sub CUL_HM_Attr(@) {#################################
if ($rdEntry =~m /^R-/){
my $reg = $rdEntry;
$reg =~ s/.*-//;
$rdEntryNew = ".".$rdEntry if($culHmRegDefine{$reg}{d} eq '0' );
$rdEntryNew = ".".$rdEntry if($culHmRegDefine{$reg} &&
$culHmRegDefine{$reg}{d} eq '0' );
}
next if (!defined($rdEntryNew)); # no change necessary
delete $hash->{READINGS}{$rdEntryNew};
@ -2711,15 +2712,24 @@ sub CUL_HM_Set($@) {
if($mode =~ m/central/);
}
elsif($cmd =~ m/^tempList(...)/) { ###################################### reg
my $wd = $1;
$state= "";
my ($list,$addr,$prgChn);
if ($md eq "HM-CC-RT-DN"){
my %day2off = ( "Sat"=>"20", "Sun"=>"46", "Mon"=>"72", "Tue"=>"98",
"Wed"=>"124","Thu"=>"150","Fri"=>"176");
($list,$addr,$prgChn) = (7,$day2off{$wd},0);
}
else{
my %day2off = ( "Sat"=>"5 0B", "Sun"=>"5 3B", "Mon"=>"5 6B",
"Tue"=>"5 9B", "Wed"=>"5 CB", "Thu"=>"6 01",
"Fri"=>"6 31");
my $wd = $1;
my ($list,$addr) = split(" ", $day2off{$wd});
($list,$addr,$prgChn) = split(" ", $day2off{$wd},2);
$addr = hex($addr);
}
return "To few arguments" if(@a < 4);
return "To many arguments, max is 24 pairs" if(@a > 50);
return "To many arguments, max 24 pairs" if(@a > (($md eq "HM-CC-RT-DN")?28:50));
return "Bad format, use HH:MM TEMP ..." if(@a % 2);
return "Last time spec must be 24:00" if($a[@a-2] ne "24:00");
@ -2728,16 +2738,28 @@ sub CUL_HM_Set($@) {
return "$a[$idx] is not in HH:MM format"
if($a[$idx] !~ m/^([0-2]\d):([0-5]\d)/);
my ($h, $m) = ($1, $2);
my $temp = CUL_HM_convTemp($a[$idx+1]);
my ($hByte,$lByte);
my $temp = $a[$idx+1];
if ($md eq "HM-CC-RT-DN"){
$temp = (int($temp*2)<<9) + ($h*12+($m/5));
$hByte = $temp>>8;
$lByte = $temp & 0xff;
}
else{
$temp = CUL_HM_convTemp($temp);
return $temp if($temp =~ m/Invalid/);
$data .= sprintf("%02X%02X%02X%s", $addr, $h*6+($m/10), $addr+1,$temp);
$hByte = $h*6+($m/10);
$lByte = $temp;
}
$data .= sprintf("%02X%02X%02X%s", $addr, $hByte, $addr+1,$hByte);
$addr += 2;
$hash->{TEMPLIST}{$wd}{($idx-2)/2}{HOUR} = $h;
$hash->{TEMPLIST}{$wd}{($idx-2)/2}{MINUTE} = $m;
$hash->{TEMPLIST}{$wd}{($idx-2)/2}{TEMP} = $a[$idx+1];
$msg .= sprintf(" %02d:%02d %.1f", $h, $m, $a[$idx+1]);
}
CUL_HM_pushConfig($hash, $id, $dst, 2,0,0,$list, $data);
CUL_HM_pushConfig($hash, $id, $dst, $prgChn,0,0,$list, $data);
readingsSingleUpdate($hash,"tempList$wd",$msg,0);
}
elsif($cmd eq "sysTime") { ##################################################
@ -3812,6 +3834,9 @@ sub CUL_HM_updtRegDisp($$$) {
CUL_HM_TCtempReadings($hash) if (($list == 5 ||$list == 6) &&
substr($hash->{DEF},6,2) eq "02");
}
if ($md eq "HM-CC-RT-DN"){#handle temperature readings
CUL_HM_RTtempReadings($hash) if ($list == 7);
}
if ($md eq "HM-PB-4DIS-WM"){#add text
CUL_HM_4DisText($hash) if ($list == 1) ;
}
@ -4008,7 +4033,7 @@ sub CUL_HM_4DisText($) {# convert text for 4dis
return "text1:".$txt{54}."\n".
"text2:".$txt{70}."\n";
}
sub CUL_HM_TCtempReadings($) {# parse TC readings
sub CUL_HM_TCtempReadings($) {# parse TC temperature readings
my ($hash)=@_;
my $name = $hash->{NAME};
my $regLN = ((CUL_HM_getAttrInt($name,"expert") == 2)?"":".")."RegL_";
@ -4067,6 +4092,45 @@ sub CUL_HM_TCtempReadings($) {# parse TC readings
}
return $setting;
}
sub CUL_HM_RTtempReadings($) {# parse RT temperature readings
my ($hash)=@_;
my $name = $hash->{NAME};
my $regLN = ((CUL_HM_getAttrInt($name,"expert") == 2)?"":".")."RegL_";
my $tempRegs = ReadingsVal($name,$regLN."07:" ,"");
my @days = ("Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri");
$tempRegs =~ s/.* 14://; #remove register up to addr 20 from list
$tempRegs =~ s/ 00:00/ /g; #remove regline termination
$tempRegs =~ s/ ..://g; #remove addr Info
$tempRegs =~ s/ //g; #blank
my @time;
my @temp;
foreach (unpack '(A4)*',$tempRegs){
my $h = hex($_);
push @temp,($h >> 9)/2;
$h = ($h & 0x1ff) * 5;
$h = sprintf("%02d:%02d",int($h / 60),($h%60));
push @time,$h;
}
return "reglist incomplete\n" if (scalar( @time )<91);
my $setting;
my @changedRead;
push (@changedRead,"tempList_State:".
($hash->{helper}{shadowReg}{$regLN."07:"} ?"set":"verified"));
for (my $day = 0;$day<7;$day++){
my $dayRead = "";
for (my $idx = 0;$idx<($day+1) *13;$idx++){
my $entry = sprintf(" %s %3.01f",$time[$idx],$temp[$idx]);
$setting .= "Temp set: ".$days[$day].$entry." C\n";
$dayRead .= $entry;
last if ($time[$idx] eq "24:00");
}
push (@changedRead,"tempList".$days[$day].":".$dayRead);
}
CUL_HM_UpdtReadBulk($hash,1,@changedRead) if (@changedRead);
return $setting;
}
sub CUL_HM_repReadings($) {# for repeater in:hash, out: string with peers
my ($hash)=@_;
my %pCnt;

View File

@ -190,7 +190,8 @@ my %culHmModel=(
"0092" => {name=>"Schueco_263-144" ,st=>'switch' ,cyc=>'' ,rxt=>'c' ,lst=>'4' ,chn=>"",}, # HM Switch Interface 3 switches
"0093" => {name=>"Schueco_263-158" ,st=>'THSensor' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'p' ,chn=>"",}, #
"0094" => {name=>"IS-WDS-TH-OD-S-R3" ,st=>'THSensor' ,cyc=>'00:10' ,rxt=>'c:w' ,lst=>'p' ,chn=>"",}, #
"0095" => {name=>"HM-CC-RT-DN" ,st=>'thermostat' ,cyc=>'' ,rxt=>'c:w' ,lst=>'3:3p.6p,7:4' ,chn=>"Weather:1:1,Climate:2:2,WindowRec:3:3,ClimRT_tr:4:4,ClimRT_r:5:5,rCtrl:6:6"}, #
"0095" => {name=>"HM-CC-RT-DN" ,st=>'thermostat' ,cyc=>'' ,rxt=>'c:w' ,lst=>'p:1p.2p.5p.6p,3:3p.6p,7:4'
,chn=>"Weather:1:1,Climate:2:2,WindowRec:3:3,ClimRT_tr:4:4,ClimaTeam:5:5,remote:6:6"}, #
"0096" => {name=>"WDF-solar" ,st=>'blindActuatorSol' ,cyc=>'' ,rxt=>'b' ,lst=>'1,3' ,chn=>"win:1:1,blind_2:3",}, #
"009B" => {name=>"Schueco_263-xxx" ,st=>'tipTronic' ,cyc=>'28:00' ,rxt=>'c:w' ,lst=>'1:1.2,3:1p.3p',chn=>"act:1:1,sen:2:2,sec:3:3",}, #
"009F" => {name=>"HM-Sen-Wa-Od" ,st=>'sensor' ,cyc=>'28:00' ,rxt=>'c:w' ,lst=>'1,4' ,chn=>"",}, #capacitive filling level sensor
@ -543,8 +544,8 @@ my %culHmRegDefine = (
tempMax =>{a=> 4 ,s=>0.6,l=>7,min=>15 ,max=>30.5 ,c=>'' ,f=>'2' ,u=>'' ,d=>1,t=>"maximum temperatur"},
tempFallWinOpen =>{a=> 5 ,s=>0.6,l=>7,min=>5 ,max=>30 ,c=>'' ,f=>'2' ,u=>'' ,d=>1,t=>"lowering temp whenWindow is opened"},
tempFallWinPerio=>{a=> 6 ,s=>0.4,l=>7,min=>0 ,max=>60 ,c=>'' ,f=>'0.2' ,u=>'min' ,d=>1,t=>"period lowering when window is open"},
decalcWeekday =>{a=> 7 ,s=>0.3,l=>7,min=>0 ,max=>7 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"decalcification day" ,lit=>{Sat=>0,Sun=>1,Mon=>2,Tue=>3,Wed=>4,Thu=>5,Fri=>6}},
decalcTime =>{a=> 8 ,s=>0.6,l=>7,min=>0 ,max=>1410 ,c=>'' ,f=>'0.033' ,u=>'' ,d=>1,t=>"decalcification time"},
decalcWeekday =>{a=> 7 ,s=>0.3,l=>7,min=>0 ,max=>7 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"decalc day" ,lit=>{Sat=>0,Sun=>1,Mon=>2,Tue=>3,Wed=>4,Thu=>5,Fri=>6}},
decalcTime =>{a=> 8 ,s=>0.6,l=>7,min=>0 ,max=>1410 ,c=>'' ,f=>'0.00055',u=>'h' ,d=>1,t=>"decalc hour"},
tempOffset =>{a=> 9 ,s=>0.4,l=>7,min=>0 ,max=>15 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"temperature offset",lit=>{"-3.5K"=>0,"-3.0K"=>1,"-2.5K"=>2,"-2.0K"=>3,"-1.5K"=>4,"-1.0K"=>5,"-0.5K"=>6,
"0.0K"=>7, "0.5K"=>8, "1.0K"=>10, "1.5K"=>11, "2.0K"=>12, "2.5K"=>13, "3.0K"=>14, "3.5K"=>15}},
btnNoBckLight =>{a=> 9.4,s=>0.1,l=>7,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"button response without backlight",lit=>{off=>0,on=>1}},
@ -689,6 +690,7 @@ my %culHmRegModel = (
"HM-CC-RT-DN" =>{btnLock =>1,localResDis =>1,globalBtnLock =>1,modusBtnLock =>1,
cyclicInfoMsg =>1,cyclicInfoMsgDis=>1,
burstRx =>1,lowBatLimitRT =>1,backOnTime =>1,
sign =>1
},
"HM-PB-4DIS-WM" =>{peerNeedsBurst =>1,expectAES =>1,language =>1,stbyTime =>1},
@ -964,7 +966,6 @@ $culHmSubTypeSets{pushButton} = $culHmSubTypeSets{remote};
$culHmSubTypeSets{swi} = $culHmSubTypeSets{remote};
$culHmSubTypeSets{sensor} = $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{thermostat} = $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{KFM100} = $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{blindActuatorSol}= $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{tipTronic} = $culHmSubTypeSets{outputUnit};
@ -984,7 +985,8 @@ my %culHmModelSets = (# channels of this subtype-------------
,ilum => "[0-15] [0-127]"},
"HM-OU-CFM-PL" =>{ press => "[long|short] [on|off] ..."
,inhibit => "[on|off]"},
"HM-CC-RT-DN" =>{ mode => "[auto|manu|party|boost|comfort|lower] ... <temp> <startTime> <endTime>"}#General only for one channel??
"HM-CC-TC" =>{ statusRequest =>""},
"HM-CC-VD" =>{ statusRequest =>""},
);
# clones- - - - - - - - - - - - - - - - -
$culHmModelSets{"HM-RC-19-B"} = $culHmModelSets{"HM-RC-19"};
@ -1027,7 +1029,17 @@ my %culHmChanSets = (
,"on-till" =>"<time>"
,on =>""
,off =>""
,toggle =>""}
,toggle =>""},
"HM-CC-RT-DN04" =>{ mode => "[auto|manu|party|boost|comfort|lower] ... <temp> <startTime> <endTime>"
,tempListSat =>"HH:MM temp ..."
,tempListSun =>"HH:MM temp ..."
,tempListMon =>"HH:MM temp ..."
,tempListTue =>"HH:MM temp ..."
,tempListThu =>"HH:MM temp ..."
,tempListWed =>"HH:MM temp ..."
,tempListFri =>"HH:MM temp ..."
}
);
# clones- - - - - - - - - - - - - - - - -
#$culHmChanSets{"HM-OU-CF-PL02"} = $culHmChanSets{"HM-OU-CF-PL01"};
@ -1080,6 +1092,10 @@ my %culHmBits = (
PARAM_LIST => "12,2", } },
"01;p11=06" => { txt => "CONFIG_END", params => {
CHANNEL => "0,2", } },
"01;p11=07" => { txt => "CONFIG_WRITE_INDEX", params => {
CHANNEL => "0,2",
ADDR => "4,2",
DATA => '6,,$val =~ s/(..)/ $1/g', } },
"01;p11=08" => { txt => "CONFIG_WRITE_INDEX", params => {
CHANNEL => "0,2",
DATA => '4,,$val =~ s/(..)(..)/ $1:$2/g', } },
@ -1197,6 +1213,8 @@ my %culHmBits = (
"58" => { txt => "ClimateEvent", params => {
CMD => "00,2",
ValvePos => '02,2,$val=(hex($val))', } },
"59" => { txt => "Climate unknown", params => {
CMD => "00,2", } },
"70" => { txt => "WeatherEvent", params => {
TEMP => '00,4,$val=((hex($val)&0x3FFF)/10)*((hex($val)&0x4000)?-1:1)',
HUM => '04,2,$val=(hex($val))', } },