2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-28 11:01:59 +00:00

30_HUEBridge.pm: group readings fix

git-svn-id: https://svn.fhem.de/fhem/trunk@20608 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2019-11-28 08:43:02 +00:00
parent 9837867dd1
commit 07b164a1c0

View File

@ -111,6 +111,7 @@ HUEBridge_Read($)
} }
my $chash = $modules{HUEDevice}{defptr}{$code}; my $chash = $modules{HUEDevice}{defptr}{$code};
#Log 1, $chash;
if( defined($chash) ) { if( defined($chash) ) {
HUEDevice_Parse($chash,$obj); HUEDevice_Parse($chash,$obj);
HUEBridge_updateGroups($hash, $chash->{ID}) if( !$chash->{helper}{devtype} ); HUEBridge_updateGroups($hash, $chash->{ID}) if( !$chash->{helper}{devtype} );
@ -1272,7 +1273,7 @@ HUEBridge_updateGroups($$)
if( defined($h) ) { if( defined($h) ) {
Log 1, ">>> $h $s $v"; #Log 1, ">>> $h $s $v";
if( defined($hue) ) { if( defined($hue) ) {
my $a = $hue < $h ? $hue : $h; my $a = $hue < $h ? $hue : $h;
my $b = $hue < $h ? $h : $hue; my $b = $hue < $h ? $h : $hue;
@ -1325,10 +1326,10 @@ Log 1, ">>> $h $s $v";
} }
if( defined($hue) && $readings{colormode} && $readings{colormode} ne "ct" ) { if( defined($hue) && $readings{colormode} && $readings{colormode} ne "ct" ) {
Log 1, "$hue $sat $bri"; #Log 1, "$hue $sat $bri";
$readings{colormode} = 'hs'; $readings{colormode} = 'hs';
$readings{hue} = int($hue * 65535); $readings{hue} = int($hue * 65535);
$readings{sat} = int($sat * 254); $readings{sat} = int($sat * 254/ $count + 0.5);
$readings{bri} = int($bri * 254 / $count + 0.5); $readings{bri} = int($bri * 254 / $count + 0.5);
$readings{pct} = int($bri * 100 / $count + 0.5); $readings{pct} = int($bri * 100 / $count + 0.5);
@ -1340,7 +1341,7 @@ Log 1, "$hue $sat $bri";
} }
if( defined($hue) ) { if( defined($hue) ) {
my ($r,$g,$b) = Color::hsv2rgb($hue,$sat,$bri); my ($r,$g,$b) = Color::hsv2rgb($hue,$sat/$count,$bri/$count);
$r *= 255; $r *= 255;
$g *= 255; $g *= 255;