2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

Add keyMatic support for CUL_HM

git-svn-id: https://svn.fhem.de/fhem/trunk@1923 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dirkho 2012-10-04 20:12:37 +00:00
parent 7ec6c65048
commit 59d0586b60
3 changed files with 742 additions and 649 deletions

View File

@ -58,7 +58,7 @@ my %culHmDevProps=(
"70" => { st => "THSensor", cl => "sender" }, # Parse,unfinished "70" => { st => "THSensor", cl => "sender" }, # Parse,unfinished
"80" => { st => "threeStateSensor",cl => "sender" }, # e.g.HM-SEC-RHS "80" => { st => "threeStateSensor",cl => "sender" }, # e.g.HM-SEC-RHS
"81" => { st => "motionDetector", cl => "sender" }, "81" => { st => "motionDetector", cl => "sender" },
"C0" => { st => "keyMatic", cl => "sender" }, "C0" => { st => "keyMatic", cl => "receiver" },
"C1" => { st => "winMatic", cl => "receiver" }, "C1" => { st => "winMatic", cl => "receiver" },
"CD" => { st => "smokeDetector", cl => "receiver" }, # Parse,set unfinished "CD" => { st => "smokeDetector", cl => "receiver" }, # Parse,set unfinished
); );
@ -379,7 +379,7 @@ CUL_HM_Parse($$)
$sendAck = ""; #todo why is this special? $sendAck = ""; #todo why is this special?
} }
elsif($cmd =~ m/^A0[01]{2}$/ && $dst eq $id) {#### Pairing-Request-Convers. elsif(($cmd =~ m/^A0[01]{2}$/ && $dst eq $id) && $st ne "keyMatic") {#### Pairing-Request-Convers.
push @event, ""; #todo why end here? push @event, ""; #todo why end here?
} }
@ -897,6 +897,24 @@ CUL_HM_Parse($$)
} }
} }
elsif($st eq "keyMatic") { ####################################
if($msgType eq "10" && $p =~ m/^(..)(..)(..)(..)(.*)/) {#subtype+chn+value+err
my ($val, $err) = (hex($3), hex($4));
my $error = 'none';
$error = 'motor aborted' if ($err & 0x04);
$error = 'clutch failure' if ($err & 0x02); # Todo: check this value
$error = 'unknown' if ($err & 0x40); # Todo: unknown error?
push @event, "error: " . $error;
push @event, "battery: ". (($err & 0x80) ? "low" : "ok");
push @event, "lock: " . (($val == 1) ? "unlocked" : "locked");
push @event, "uncertain: " . (($err & 0x30) ? "yes" : "no");
my $state = ($err & 0x30) ? " (uncertain)" : "";
push @event, "state: " . (($val == 1) ? "unlocked" : "locked") . $state;
}
}
else{##################################### else{#####################################
; # no one wants the message ; # no one wants the message
} }
@ -1091,13 +1109,13 @@ CUL_HM_fltCvT($) #float config time
last if ($inValue < $fltCvT{$div}); last if ($inValue < $fltCvT{$div});
$exp++; $exp++;
} }
return ($exp<<5)+int($inValue/$div2); return ($exp << 5)+int($inValue/$div2);
} }
sub sub
CUL_HM_CvTflt($) # config time -> float CUL_HM_CvTflt($) # config time -> float
{ {
my ($inValue) = @_; my ($inValue) = @_;
return ($inValue & 0x1f)*((sort {$a <=> $b} keys(%fltCvT))[$inValue>>5]); return ($inValue & 0x1f)*((sort {$a <=> $b} keys(%fltCvT))[$inValue >> 5]);
} }
@ -1269,6 +1287,15 @@ my %culHmSubTypeSets = (
read => "<btn>", read => "<btn>",
keydef => "<btn> <txt1> <txt2>", keydef => "<btn> <txt1> <txt2>",
create => "<txt>" }, create => "<txt>" },
keyMatic => {
"lock"=>"",
"unlock"=>"[sec] ...",
"open"=>"[sec] ...",
"inhibit-set"=>"",
"inhibit-clear"=>"",
},
); );
my %culHmModelSets = ( my %culHmModelSets = (
"HM-CC-TC"=>{ "HM-CC-TC"=>{
@ -1407,6 +1434,10 @@ CUL_HM_Set($@)
CUL_HM_pushConfig($hash, $id, $dst, $chn,0,0,$chn, CUL_HM_pushConfig($hash, $id, $dst, $chn,0,0,$chn,
"08" . ($a[2] eq "on" ? "01":"02")); "08" . ($a[2] eq "on" ? "01":"02"));
}
elsif($cmd eq "statusRequest" && $st eq "keyMatic") { ########################
CUL_HM_PushCmdStack($hash, sprintf("++B001%s%s010E",$id,$dst)); # LEVEL_GET
} }
elsif($cmd eq "statusRequest") { ############################################ elsif($cmd eq "statusRequest") { ############################################
my $chnFound; my $chnFound;
@ -1619,6 +1650,32 @@ CUL_HM_Set($@)
$dst, $chn, $hash->{toggleIndex})); $dst, $chn, $hash->{toggleIndex}));
} }
elsif($cmd eq "lock") { ###################################################
CUL_HM_PushCmdStack($hash, sprintf("++B011%s%s800100FF",$id,$dst)); # LEVEL_SET
}
elsif($cmd eq "unlock") { ###################################################
$tval = (@a > 2) ? int($a[2]) : 0;
my $delay = ($tval > 0) ? CUL_HM_encodeTime8($tval) : "FF"; # RELOCK_DELAY (255=never)
CUL_HM_PushCmdStack($hash, sprintf("++B011%s%s800101%s",$id,$dst,$delay)); # LEVEL_SET
}
elsif($cmd eq "open") { ###################################################
$tval = (@a > 2) ? int($a[2]) : 0;
my $delay = ($tval > 0) ? CUL_HM_encodeTime8($tval) : "FF"; # RELOCK_DELAY (255=never)
CUL_HM_PushCmdStack($hash, sprintf("++B011%s%s8001C8%s",$id,$dst,$delay)); # OPEN
}
elsif($cmd eq "inhibit-set") { ###############################################
CUL_HM_PushCmdStack($hash, sprintf("++B011%s%s0101",$id,$dst)); # SET_LOCK
}
elsif($cmd eq "inhibit-clear") { #############################################
CUL_HM_PushCmdStack($hash, sprintf("++B011%s%s0001",$id,$dst)); # SET_LOCK
}
elsif($cmd eq "pct") { ###################################################### elsif($cmd eq "pct") { ######################################################
$a[1] = 100 if ($a[1] > 100); $a[1] = 100 if ($a[1] > 100);
$tval = CUL_HM_encodeTime16((@a > 2)?$a[2]:85825945);# onTime 0.0..85825945.6, 0=forever $tval = CUL_HM_encodeTime16((@a > 2)?$a[2]:85825945);# onTime 0.0..85825945.6, 0=forever

File diff suppressed because it is too large Load Diff

View File

@ -3570,6 +3570,29 @@ A line ending with \ will be concatenated with the next one, so long lines
# "1234,5" in display with unit 'W'. Symbols scene,phone,bell and clock are active. Backlight flashing fast, Beep is second tone<br> # "1234,5" in display with unit 'W'. Symbols scene,phone,bell and clock are active. Backlight flashing fast, Beep is second tone<br>
set FB1 display 12345 comma Watt 2 fast scene,phone,bell,clock </ul></code> set FB1 display 12345 comma Watt 2 fast scene,phone,bell,clock </ul></code>
</li> </li>
</ul><br></li>
<li>keyMatic<br><br>
<ul>The Keymatic uses the AES signed communication. Therefore the control of the Keymatic is only together with the HM-LAN adapter possible. But the CUL can read and react on the status information of the Keymatic.</ul><br>
<ul>
<li><B>lock</B><br>
The lock bolt moves to the locking position<br></li>
<li><B>unlock [sec]</B><br>
The lock bolt moves to the unlocking position.<br>
[sec]: Sets the delay in seconds after the lock automatically locked again.<br>0 - 65535 seconds</li>
<li><B>open [sec]</B><br>
Unlocked the door so that the door can be opened.<br>
[sec]: Sets the delay in seconds after the lock automatically locked again.<br>0 - 65535 seconds</li>
<li><B>inhibit-set</B><br>
Blocked all directly paired remotes and the hardware buttons of the keyMatic. Now the door lock drive can be controlled only by FHEM.<br></li>
<li><B>inhibit-clear</B><br>
Deletes the previously set inhibit-flag again.<br><br>
Example:
<ul><code>
# Lock the lock<br>
set keymatic lock<br><br>
# open the door and relock the lock after 60 seconds<br>
set keymatic unlock 60</ul></code>
</li>
</ul></li> </ul></li>
</ul> </ul>
<br> <br>