add devicepair for single Button for HM devices

git-svn-id: https://svn.fhem.de/fhem/trunk@1716 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2012-07-10 16:03:59 +00:00
parent 2396e0246a
commit 4f9946d45f
3 changed files with 49 additions and 17 deletions

View File

@ -1,4 +1,5 @@
- SVN - SVN
- feature: devicepair for single Button in 10_CUL_HM.pm (by MartinP)
- feature: new Modules 75_MSG.pm, 76_MSGFile.pm and 76_MSGMail.pm (by Rüdiger) - feature: new Modules 75_MSG.pm, 76_MSGFile.pm and 76_MSGMail.pm (by Rüdiger)
- feature: new Module 59_Twilight.pm to calculate current daylight - feature: new Module 59_Twilight.pm to calculate current daylight
- feature: internal NotifyOrderPrefix: 98_average.pm is more straightforward - feature: internal NotifyOrderPrefix: 98_average.pm is more straightforward

View File

@ -120,6 +120,8 @@ my %culHmModel=(
"0062" => "HM-LC-SW2-DR", "0062" => "HM-LC-SW2-DR",
"0066" => "HM_LC_Sw4-WM", # Tested by peterp "0066" => "HM_LC_Sw4-WM", # Tested by peterp
"0067" => "HM-LC_Dim1PWM-CV", # Tested by peterp "0067" => "HM-LC_Dim1PWM-CV", # Tested by peterp
"0068" => "HM-LC_Dim1TPBU-FM", # Tested by martinp (2012-07-10)
"006A" => "HM-LC_Bl1PBU-FM", # Tested by martinp (2012-07-10)
"006C" => "HM-LC-SW1-BA-PCB", # Tested by MartiMcFly "006C" => "HM-LC-SW1-BA-PCB", # Tested by MartiMcFly
); );
@ -906,7 +908,10 @@ my %culHmSubTypeSets = (
{ "on-for-timer"=>"sec", on =>"", off=>"", toggle=>"", pct=>"", stop=>"" }, { "on-for-timer"=>"sec", on =>"", off=>"", toggle=>"", pct=>"", stop=>"" },
remote => remote =>
{ text => "<btn> [on|off] <txt1> <txt2>", { text => "<btn> [on|off] <txt1> <txt2>",
devicepair => "<btnNumber> device", }, devicepair => "<btnNumber> device [single|dual]", },
pushButton =>
{ text => "<btn> [on|off] <txt1> <txt2>",
devicepair => "<btnNumber> device [single|dual]", },
smokeDetector => smokeDetector =>
{ test => "", "alarmOn"=>"", "alarmOff"=>"" }, { test => "", "alarmOn"=>"", "alarmOff"=>"" },
winMatic => winMatic =>
@ -1402,14 +1407,26 @@ CUL_HM_Set($@)
$dst,$dst, $1 eq "On" ? "0BC8" : "0C01"), 1, 0); $dst,$dst, $1 eq "On" ? "0BC8" : "0C01"), 1, 0);
} elsif($cmd eq "devicepair") { ##################################### } elsif($cmd eq "devicepair") { #####################################
return "$a[2] is not a button number" if($a[2] !~ m/^\d$/ || $a[2] < 1); return "$a[2] is not a button number" if($a[2] < 1);
my $b1 = sprintf("%02X", $a[2]*2-1);
my $b2 = sprintf("%02X", $a[2]*2);
my $dhash = $defs{$a[3]}; my $dhash = $defs{$a[3]};
return "$a[3] is not a known fhem device" if(!$dhash); return "$a[3] is not a known fhem device" if(!$dhash);
return "$a[3] is not a CUL_HM device" if($dhash->{TYPE} ne "CUL_HM"); return "$a[3] is not a CUL_HM device" if($dhash->{TYPE} ne "CUL_HM");
return "$a[4] must be single or dual"
if(defined($a[4]) && (($a[4] ne"single") &&($a[4] ne"dual")));
my $b1;
my $b2;
my $nrCh2Pair;
if ($a[4] ne"single"){ #default to dual
$b1 = sprintf("%02X", $a[2]*2-1);
$b2 = sprintf("%02X", $a[2]*2);
$nrCh2Pair = 2;
}else{
$b1 = sprintf("%02X",$a[2]);
$b2 = $b1;
$nrCh2Pair = 1;
}
my $dst2 = $dhash->{DEF}; my $dst2 = $dhash->{DEF};
my $chn2 = "01"; my $chn2 = "01";
if(length($dst2) == 8) { # shadow switch device for multi-channel switch if(length($dst2) == 8) { # shadow switch device for multi-channel switch
@ -1419,23 +1436,18 @@ CUL_HM_Set($@)
} }
# First the remote (one loop for on, one for off) # First the remote (one loop for on, one for off)
for(my $i = 1; $i <= 2; $i++) { for(my $i = 1; $i <= $nrCh2Pair; $i++) {
my $b = ($i==1 ? $b1 : $b2); my $b = ($i==1 ? $b1 : $b2);
# PEER_ADD, START, WRITE_INDEX, END # PEER_ADD, START, WRITE_INDEX, END
CUL_HM_PushCmdStack($hash, "++A001${id}${dst}${b}01${dst2}${chn2}00"); CUL_HM_PushCmdStack($hash, "++A001${id}${dst}${b}01${dst2}${chn2}00");
CUL_HM_PushCmdStack($hash, "++A001${id}${dst}${b}05${dst2}${chn2}04"); CUL_HM_pushConfig($hash,$id, $dst,hex($b),$dst2,hex($chn2),4,"0100");
CUL_HM_PushCmdStack($hash, "++A001${id}${dst}${b}080100");
CUL_HM_PushCmdStack($hash, "++A001${id}${dst}${b}06");
} }
# Now the switch: PEER_ADD, PARAM_REQ:on, PARAM_REQ:off # Now the switch: PEER_ADD
CUL_HM_PushCmdStack($dhash, "++A001${id}${dst2}${chn2}01${dst}${b2}${b1}"); CUL_HM_PushCmdStack($dhash, "++A001${id}${dst2}${chn2}01${dst}${b2}${b1}");
CUL_HM_PushCmdStack($dhash, "++A001${id}${dst2}${chn2}04${dst}${b1}03");
CUL_HM_PushCmdStack($dhash, "++A001${id}${dst2}${chn2}04${dst}${b2}03");
$hash = $dhash; # Exchange the hash, as the switch is always alive. $hash = $dhash; # Exchange the hash, as the switch is always alive.
$isSender=0; # the other device is a switch. ahem. $isSender=0; # the other device is a switch. ahem.
} }
$hash->{STATE} = $state if($state); $hash->{STATE} = $state if($state);

View File

@ -3319,11 +3319,30 @@ A line ending with \ will be concatenated with the next one, so long lines
</ul></li> </ul></li>
<br> <br>
<li>remotes <li>remotes, pushButton
<ul> <ul>
devicepair <btnNumber> hmDevice<br> * devicepair &lt;btn_no&gt; &lt;hmDevice&gt; [single|dual]<br>
Pair a remote directly with a switch. The command for the switch is Pair a sender device directly with a actuator. After pairing
sent out directly, the remote must be set into learning mode first. commands sent by the remote are processed directly by the actuator.
Remote must be set into learning mode first. <br>
&lt;hmDevice&gt; is the actuator's channel to be paired.<br>
&lt;btn_no&gt; is the button on the remote to be paired. If 'single'
is choosen buttons are counted from 1. For 'dual' btn_no is the number
of the Button-pair to be used. I.e. '3'
in dual is the 3rd button pair correcponding to button 5 and 6 in
single mode.<br>
[single|dual]: this mode impacts the default behavior of the
Actuator upon using this button. E.g. a dimmer can be learned to a
single button or to a button pair. <br>
'dual' (default) Button pairs two buttons to one actuator. With a
dimmer this means one button for dim-up and one for dim-down. <br>
'single' uses only one button of the sender. It is useful for e.g. for
simple switch actuator to toggle on/off. Nevertheless
also dimmer can be learned to only one button. <br>
example: set myRemote devicepair 2 mySwitchActuator single
</ul> </ul>
<br> <br>