2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

new devices, valvePos for VD

git-svn-id: https://svn.fhem.de/fhem/trunk@4849 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2014-02-08 15:14:26 +00:00
parent 9977df7adc
commit fa699cd58b
2 changed files with 92 additions and 66 deletions

View File

@ -3283,70 +3283,79 @@ sub CUL_HM_Set($@) {
my %lim = (valvePos =>{min=>0 ,max=>99 ,rd =>"valvePosTC" ,u =>" %"},
virtTemp =>{min=>-20,max=>50 ,rd =>"temperature",u =>"" },
virtHum =>{min=>0 ,max=>99 ,rd =>"humidity" ,u =>"" },);
if ($valu eq "off"){
if ($cmd eq "virtHum") {$hash->{helper}{vd}{vinH} = "";}
else {$hash->{helper}{vd}{vin} = "";}
if ((!$hash->{helper}{vd}{vinH} || $hash->{helper}{vd}{vinH} eq "") &&
(!$hash->{helper}{vd}{vin} || $hash->{helper}{vd}{vin} eq "") ){
$state = "$cmd:stopped";
RemoveInternalTimer("valvePos:$dst$chn");# remove responsePending timer
RemoveInternalTimer("valveTmr:$dst$chn");# remove responsePending timer
delete($hash->{helper}{virtTC});
}
}
if ($hash->{helper}{virtTC} || $valu ne "off") {
if ($valu ne "off"){
return "level between $lim{$cmd}{min} and $lim{$cmd}{max} or 'off' allowed"
if ($md eq "HM-CC-VD"){
return "level between $lim{$cmd}{min} and $lim{$cmd}{max} allowed"
if ($valu !~ m/^[+-]?\d+\.?\d+$/||
$valu > $lim{$cmd}{max}||$valu < $lim{$cmd}{min} );
if ($cmd eq "virtHum") {$hash->{helper}{vd}{vinH} = $valu;}
else {$hash->{helper}{vd}{vin} = $valu;}
}
if ($cmd eq "valvePos"){
my @pId = grep !/^$/,split(',',AttrVal($name,"peerIDs",""));
return "virtual TC support one VD only. Correct number of peers"
if (scalar @pId != 1);
my $ph = CUL_HM_id2Hash($pId[0]);
return "peerID $pId[0] is not assigned to a device " if (!$ph);
$hash->{helper}{vd}{typ} = 1; #valvePos
$hash->{helper}{vd}{id} = $modules{CUL_HM}{defptr}{$pId[0]}
?$pId[0]
:substr($pId[0],0,6);
$hash->{helper}{vd}{cmd} = "A258$dst".substr($pId[0],0,6);
CUL_HM_UpdtReadBulk($ph,1,
"state:set_$valu %",
"ValveDesired:$valu %");
$hash->{helper}{vd}{val} = sprintf("%02X",($valu * 2.56)%256);
$state = "ValveAdjust:$valu %";
}
else{#virtTemp || virtHum
$hash->{helper}{vd}{typ} = 2; #virtTemp
$hash->{helper}{vd}{cmd} = "8670$dst"."000000";
my $t = $hash->{helper}{vd}{vin}?$hash->{helper}{vd}{vin}:0;
$t *=10;
$t -= 0x8000 if ($t < 0);
$hash->{helper}{vd}{val} = sprintf("%04X", $t & 0x7fff);
$hash->{helper}{vd}{val} .= sprintf("%02X", $hash->{helper}{vd}{vinH})
if ($hash->{helper}{vd}{vinH} && $hash->{helper}{vd}{vinH} ne "");
}
$hash->{helper}{vd}{idh} = hex(substr($dst,2,2))*20077;
$hash->{helper}{vd}{idl} = hex(substr($dst,4,2))*256;
$hash->{helper}{vd}{msgCnt} = ReadingsVal($name,".msgCnt",0)
if (!defined $hash->{helper}{vd}{msgCnt});
if (!$hash->{helper}{virtTC}){
my $pn = CUL_HM_id2Name($hash->{helper}{vd}{id});
$hash->{helper}{vd}{ackT} = ReadingsTimestamp($pn, "ValvePosition", "")
if (!defined $hash->{helper}{vd}{ackT});
$hash->{helper}{vd}{miss} = 0 if (!defined$hash->{helper}{vd}{miss});
$hash->{helper}{virtTC} = ($cmd eq "valvePos")?"03":"00";
CUL_HM_UpdtReadSingle($hash,"valveCtrl","init",1)if ($cmd eq "valvePos");
$hash->{helper}{vd}{next} = ReadingsVal($name,".next",gettimeofday())
if (!defined $hash->{helper}{vd}{next});
CUL_HM_valvePosUpdt("valvePos:$dst$chn");
}
$hash->{helper}{virtTC} = ($cmd eq "valvePos")?"03":"00";
CUL_HM_PushCmdStack($hash,'++A258'.$id.$dst
."00".sprintf("%02X",($valu * 2.56)%256));
}
else{
if ($valu eq "off"){
if ($cmd eq "virtHum") {$hash->{helper}{vd}{vinH} = "";}
else {$hash->{helper}{vd}{vin} = "";}
if ((!$hash->{helper}{vd}{vinH} || $hash->{helper}{vd}{vinH} eq "") &&
(!$hash->{helper}{vd}{vin} || $hash->{helper}{vd}{vin} eq "") ){
$state = "$cmd:stopped";
RemoveInternalTimer("valvePos:$dst$chn");# remove responsePending timer
RemoveInternalTimer("valveTmr:$dst$chn");# remove responsePending timer
delete($hash->{helper}{virtTC});
}
}
if ($hash->{helper}{virtTC} || $valu ne "off") {
if ($valu ne "off"){
return "level between $lim{$cmd}{min} and $lim{$cmd}{max} or 'off' allowed"
if ($valu !~ m/^[+-]?\d+\.?\d+$/||
$valu > $lim{$cmd}{max}||$valu < $lim{$cmd}{min} );
if ($cmd eq "virtHum") {$hash->{helper}{vd}{vinH} = $valu;}
else {$hash->{helper}{vd}{vin} = $valu;}
}
if ($cmd eq "valvePos"){
my @pId = grep !/^$/,split(',',AttrVal($name,"peerIDs",""));
return "virtual TC support one VD only. Correct number of peers"
if (scalar @pId != 1);
my $ph = CUL_HM_id2Hash($pId[0]);
return "peerID $pId[0] is not assigned to a device " if (!$ph);
$hash->{helper}{vd}{typ} = 1; #valvePos
$hash->{helper}{vd}{id} = $modules{CUL_HM}{defptr}{$pId[0]}
?$pId[0]
:substr($pId[0],0,6);
$hash->{helper}{vd}{cmd} = "A258$dst".substr($pId[0],0,6);
CUL_HM_UpdtReadBulk($ph,1,
"state:set_$valu %",
"ValveDesired:$valu %");
$hash->{helper}{vd}{val} = sprintf("%02X",($valu * 2.56)%256);
$state = "ValveAdjust:$valu %";
}
else{#virtTemp || virtHum
$hash->{helper}{vd}{typ} = 2; #virtTemp
$hash->{helper}{vd}{cmd} = "8670$dst"."000000";
my $t = $hash->{helper}{vd}{vin}?$hash->{helper}{vd}{vin}:0;
$t *=10;
$t -= 0x8000 if ($t < 0);
$hash->{helper}{vd}{val} = sprintf("%04X", $t & 0x7fff);
$hash->{helper}{vd}{val} .= sprintf("%02X", $hash->{helper}{vd}{vinH})
if ($hash->{helper}{vd}{vinH} && $hash->{helper}{vd}{vinH} ne "");
}
$hash->{helper}{vd}{idh} = hex(substr($dst,2,2))*20077;
$hash->{helper}{vd}{idl} = hex(substr($dst,4,2))*256;
$hash->{helper}{vd}{msgCnt} = ReadingsVal($name,".msgCnt",0)
if (!defined $hash->{helper}{vd}{msgCnt});
if (!$hash->{helper}{virtTC}){
my $pn = CUL_HM_id2Name($hash->{helper}{vd}{id});
$hash->{helper}{vd}{ackT} = ReadingsTimestamp($pn, "ValvePosition", "")
if (!defined $hash->{helper}{vd}{ackT});
$hash->{helper}{vd}{miss} = 0 if (!defined$hash->{helper}{vd}{miss});
$hash->{helper}{virtTC} = ($cmd eq "valvePos")?"03":"00";
CUL_HM_UpdtReadSingle($hash,"valveCtrl","init",1)if ($cmd eq "valvePos");
$hash->{helper}{vd}{next} = ReadingsVal($name,".next",gettimeofday())
if (!defined $hash->{helper}{vd}{next});
CUL_HM_valvePosUpdt("valvePos:$dst$chn");
}
$hash->{helper}{virtTC} = ($cmd eq "valvePos")?"03":"00";
}
CUL_HM_UpdtReadSingle($hash,$lim{$cmd}{rd},$valu.$lim{$cmd}{u},1);
}
CUL_HM_UpdtReadSingle($hash,$lim{$cmd}{rd},$valu.$lim{$cmd}{u},1);
}
elsif($cmd eq "matic") { ####################################################
# Trigger pre-programmed action in the winmatic. These actions must be

View File

@ -229,7 +229,7 @@ my $K_actDetID = '000000'; # id of actionDetector
"00A5" => {name=>"HM-RC-Sec4-2" ,st=>'remote' ,cyc=>'' ,rxt=>'c:l' ,lst=>'1,4' ,chn=>"Btn:1:2,BTN_T:3:3,BTN_A:4:4",},#only 1 and 2 can be peered???
"00A6" => {name=>"HM-RC-Key4-2" ,st=>'remote' ,cyc=>'' ,rxt=>'c:l' ,lst=>'1,4' ,chn=>"Btn:1:2,BTN_T:3:3,BTN_A:4:4",},#only 1 and 2 can be peered???
"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=>'00:10' ,rxt=>'c:w:f' ,lst=>'p' ,chn=>"T1:1:1,T2:2:2,T1_T2:3:3,T2_T1:4:4,Event:5:5",},
"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",},
"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'
@ -256,12 +256,25 @@ my $K_actDetID = '000000'; # id of actionDetector
"00C0" => {name=>"HM-SEC-MDIR-2" ,st=>'motionDetector' ,cyc=>'00:20' ,rxt=>'c:w:l' ,lst=>'1,4' ,chn=>"",},
"00C1" => {name=>"HM-Sen-MDIR-O-2" ,st=>'motionDetector' ,cyc=>'00:10' ,rxt=>'c:w:l' ,lst=>'1,4' ,chn=>"",},
"00C2" => {name=>"HM-PB-2-WM55-2" ,st=>'pushButton' ,cyc=>'' ,rxt=>'c:w:l' ,lst=>'1,4' ,chn=>"Btn:1:2",},
"00C8" => {name=>"HM-LC-Sw1-Pl-3" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",},
"00C9" => {name=>"HM-LC-Sw1-SM-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",},
"00CA" => {name=>"HM-LC-Sw1-FM-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",},
"00CB" => {name=>"HM-LC-Sw2-FM-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:2",},
"00CC" => {name=>"HM-LC-Sw2-DR-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:2",},
"00CD" => {name=>"HM-LC-Sw4-SM-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:4",},
"00CE" => {name=>"HM-LC-Sw4-PCB-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:4",},
"00CF" => {name=>"HM-LC-Sw4-WM-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:4",},
"00D0" => {name=>"HM-LC-Sw4-DR-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:4",},
"00D1" => {name=>"HM-LC-Bl1-SM-2" ,st=>'blindActuator' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",}, # radio-controlled blind actuator 1-channel (flush-mount)
"00D2" => {name=>"HM-LC-Bl1-FM-2" ,st=>'blindActuator' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",}, # radio-controlled blind actuator 1-channel (flush-mount)
"8001" => {name=>"PS-switch" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:4",},
"8002" => {name=>"PS-Th-Sens" ,st=>'THSensor' ,cyc=>'' ,rxt=>'' ,lst=>'1,4' ,chn=>"Sen:1:4",},
# "xxxx" => {name=>"HM-LC-SW4-DR-2" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"Sw:1:4",},
# "xxxx" => {name=>"HM-LC-Sw1-Pl-3" ,st=>'switch' ,cyc=>'' ,rxt=>'' ,lst=>'1,3' ,chn=>"",},
# "HM-LGW-O-TW-W-EU" #Funk LAN Gateway
# "HM-LGW-O-TW-W-EU" #Funk LAN Gateway
#################open:---------------------------
# rf_s list 1 ist neu
# rf_s_644 list 1 ist neu
);
##----------definitions for register settings-----------------
@ -687,6 +700,8 @@ my $K_actDetID = '000000'; # id of actionDetector
blindActuator =>{ intKeyVisib =>1
,driveUp =>1,driveDown =>1,driveTurn =>1,refRunCounter =>1
,sign =>1
,confBtnTime =>1,localResDis =>1
,transmitTryMax =>1,statusInfoMinDly=>1,statusInfoRandom=>1
,MaxTimeF =>1
,OnDly =>1,OnTime =>1,OffDly =>1,OffTime =>1
,OffLevel =>1,OnLevel =>1
@ -715,6 +730,8 @@ my $K_actDetID = '000000'; # id of actionDetector
,lgMultiExec =>1
},
switch =>{ intKeyVisib =>1,sign =>1
,confBtnTime =>1,localResDis =>1
,transmitTryMax =>1,powerUpAction =>1,statusInfoMinDly=>1,statusInfoRandom=>1
,OnTime =>1,OffTime =>1,OnDly =>1,OffDly =>1
,SwJtOn =>1,SwJtOff =>1,SwJtDlyOn =>1,SwJtDlyOff =>1
,CtValLo =>1,CtValHi =>1
@ -1161,7 +1178,7 @@ $culHmSubTypeSets{powerMeter} = $culHmSubTypeSets{outputUnit};
$culHmSubTypeSets{motionDetector} = $culHmSubTypeSets{threeStateSensor};
%culHmModelSets = (# channels of this subtype-------------
# "HM-CC-VD" =>{ valvePos => "position"},
"HM-CC-VD" =>{ valvePos =>"[off|0.0..99.0]"},
"HM-RC-19" =>{ service => "<count>"
,alarm => "<count>"
,display => "<text> [comma|no] [unit] [off|1|2|3] [off|on|slow|fast] <symbol>"},