2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 13:26:02 +00:00

CUL_HM:update rgbw

git-svn-id: https://svn.fhem.de/fhem/trunk@12707 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2016-12-03 18:39:36 +00:00
parent 11f0f86f47
commit e3520a08a2
2 changed files with 39 additions and 5 deletions

View File

@ -8,6 +8,7 @@ package main;
use strict; use strict;
use warnings; use warnings;
use HMConfig; use HMConfig;
use Color;
use Digest::MD5 qw(md5); use Digest::MD5 qw(md5);
eval "use Crypt::Rijndael"; eval "use Crypt::Rijndael";
@ -1933,7 +1934,8 @@ sub CUL_HM_Parse($$) {#########################################################
($mh{mTyp} eq "1006")) { # or Info_Status message here ($mh{mTyp} eq "1006")) { # or Info_Status message here
my $rSUpdt = 0;# require status update my $rSUpdt = 0;# require status update
my ($val,$err) = (hex($mI[2])/2,hex($mI[3])); my ($val,$err) = (hex($mI[2]),hex($mI[3]));
$val /= 2 if ($mh{st} ne "rgb" || $mh{chn} != 3);
CUL_HM_m_setCh(\%mh,$mI[1]); CUL_HM_m_setCh(\%mh,$mI[1]);
my($lvlMin,$lvlMax)=split",",AttrVal($mh{cName}, "levelRange", "0,100"); my($lvlMin,$lvlMax)=split",",AttrVal($mh{cName}, "levelRange", "0,100");
my $physLvl; #store phys level if available my $physLvl; #store phys level if available
@ -2065,6 +2067,13 @@ sub CUL_HM_Parse($$) {#########################################################
$mh{devH}->{helper}{PONtest} = 0; $mh{devH}->{helper}{PONtest} = 0;
} }
} }
elsif($mh{st} eq "rgb"){
if ($mh{chn} == 2){
push @evtEt,[$mh{cHash},1,"color:$val"]; # duplicate to color - necessary for "colorpicker"
push @evtEt,[$mh{cHash},1,"rgb:".(($val==100)?("FFFFFF"):(Color::hsv2hex($val/100,1,1)))];
}
push @evtEt,[$mh{cHash},1,"colProgram:$val"] if ($mh{chn} == 3); # duplicate to colProgram - necessary for "slider"
}
elsif ($mh{st} eq "blindActuator"){ elsif ($mh{st} eq "blindActuator"){
my $param = AttrVal($mh{cName}, "param", ""); my $param = AttrVal($mh{cName}, "param", "");
if ($param =~ m/ponRestoreSmart/){ if ($param =~ m/ponRestoreSmart/){
@ -3919,6 +3928,8 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
my $usg = "Unknown argument $cmd, choose one of ".join(" ",sort @arr1); my $usg = "Unknown argument $cmd, choose one of ".join(" ",sort @arr1);
$usg =~ s/ pct/ pct:slider,0,1,100/; $usg =~ s/ pct/ pct:slider,0,1,100/;
$usg =~ s/ virtual/ virtual:slider,1,1,50/; $usg =~ s/ virtual/ virtual:slider,1,1,50/;
$usg =~ s/ color/ color:colorpicker,HUE,0,0.5,100/;
$usg =~ s/ colProgram/ colProgram:0,1,2,3,4,5,6/;
if ($usg =~ m/ tempTmplSet/){ if ($usg =~ m/ tempTmplSet/){
my $tl = $modules{CUL_HM}{AttrList}; my $tl = $modules{CUL_HM}{AttrList};
my $ok = ($tl =~ s/.* (tempListTmpl)(\:.*? ).*/$2/); my $ok = ($tl =~ s/.* (tempListTmpl)(\:.*? ).*/$2/);
@ -4812,6 +4823,15 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'80'.$chn. CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'80'.$chn.
sprintf("%02X%02X",$bright,$colVal).$ramp.$tval); sprintf("%02X%02X",$bright,$colVal).$ramp.$tval);
} }
elsif($cmd eq "color") { ################################################
my (undef,undef,$colVal) = @a; #date prepared extention to entdate
return "cmd requires color[0..100] step 0.5" if (!defined $colVal
||$colVal < 0 ||$colVal > 100);
$colVal = int($colVal*2);# convert percent to [0..200]
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'02'.$chn.
sprintf("%02X",$colVal)."00A0");
}
elsif($cmd eq "brightAuto") { ############################################### elsif($cmd eq "brightAuto") { ###############################################
my (undef,undef,$bright,$colProg,$min,$max,$duration,$ramp) = @a; #date prepared extention to entdate my (undef,undef,$bright,$colProg,$min,$max,$duration,$ramp) = @a; #date prepared extention to entdate
return "please enter the duration in seconds" return "please enter the duration in seconds"
@ -4827,6 +4847,14 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'81'.$chn. CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'81'.$chn.
sprintf("%02X%02X",$bright,$colProg).$min.$max.$ramp.$tval); sprintf("%02X%02X",$bright,$colProg).$min.$max.$ramp.$tval);
} }
elsif($cmd eq "colProgram") { ################################################
my (undef,undef,$colProg) = @a; #date prepared extention to entdate
return "cmd requires a colorProgram[0..255]" if (!defined $colProg
||$colProg < 0 ||$colProg > 255);
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'02'.$chn.
sprintf("%02X",$colProg)."00A0");
}
elsif($cmd eq "playTone") { ################################################# elsif($cmd eq "playTone") { #################################################
my $msg; my $msg;
if (!defined $a[2]){ if (!defined $a[2]){
@ -6640,8 +6668,10 @@ sub CUL_HM_SndCmd($$) {
# #
my @arr = (); my @arr = ();
$hash->{cmdStack} = \@arr if(!$hash->{cmdStack}); $hash->{cmdStack} = \@arr if(!$hash->{cmdStack});
$cmd = $hash->{helper}{prt}{rspWait}{cmd} if( $hash->{helper}{prt}{rspWait}
&& $hash->{helper}{prt}{rspWait}{cmd}); if( $hash->{helper}{prt}{rspWait} && $hash->{helper}{prt}{rspWait}{cmd}){
(undef,$cmd) = unpack 'A4A*',$hash->{helper}{prt}{rspWait}{cmd};
}
unshift (@{$hash->{cmdStack}}, $cmd);#pushback cmd, wait for opportunity unshift (@{$hash->{cmdStack}}, $cmd);#pushback cmd, wait for opportunity
@{$modules{CUL_HM}{$ioName}{pendDev}} = @{$modules{CUL_HM}{$ioName}{pendDev}} =

View File

@ -1825,8 +1825,12 @@ $culHmModelSets{"HM-Sen-Wa-Od"} = $culHmModelSets{"HM-SEC-SD"};
,statusRequest =>"" ,statusRequest =>""
,peerIODev =>"[IO] -btn- [set|unset]... not for future use" ,peerIODev =>"[IO] -btn- [set|unset]... not for future use"
} }
,"HM-LC-RGBW-WM02" =>{ brightCol =>"-bright[0-100]- -colVal[0-100]- -duration- -ramp- ..."} ,"HM-LC-RGBW-WM02" =>{ brightCol =>"-bright[0-100]- -colVal[0-100]- -duration- -ramp- ..."
,"HM-LC-RGBW-WM03" =>{ brightAuto =>"-bright- -colProg- -min- -max- -duration- -ramp- ..."} ,color =>"-colVal[0-100]-"
}
,"HM-LC-RGBW-WM03" =>{ brightAuto =>"-bright- -colProg- -min- -max- -duration- -ramp- ..."
,colProgram =>"-colProg[0-255]-"
}
,"HM-Sec-Sir-WM01" =>{ on =>"" ,"HM-Sec-Sir-WM01" =>{ on =>""
,off =>"" ,off =>""
,"on-for-timer" =>"-ontime-" ,"on-for-timer" =>"-ontime-"