mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
31_HUEDevice.pm: addes scene reading to deCONZ groups
git-svn-id: https://svn.fhem.de/fhem/trunk@20906 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
98489d5230
commit
280f508a52
@ -613,9 +613,10 @@ HUEDevice_SetParam($$@)
|
||||
} elsif( $cmd eq "rgb" && $value =~ m/^(..)(..)(..)/) {
|
||||
my( $r, $g, $b ) = (hex($1)/255.0, hex($2)/255.0, hex($3)/255.0);
|
||||
|
||||
my $hash = $defs{$name};
|
||||
if( $name && ( !AttrVal($name, "model", undef)
|
||||
|| AttrVal($name, "model", undef) eq 'LLC020'
|
||||
|| ($hash->{IODev} && $hash->{IODev}{TYPE} eq 'tradfri' ) ) ) {
|
||||
|| ($hash && $hash->{IODev} && $hash->{IODev}{TYPE} eq 'tradfri' ) ) ) {
|
||||
my( $h, $s, $v ) = Color::rgb2hsv($r,$g,$b);
|
||||
|
||||
$obj->{'on'} = JSON::true;
|
||||
@ -1338,8 +1339,6 @@ HUEDevice_Parse($$)
|
||||
$hash->{class} = $result->{class} if( defined($result->{class}) );
|
||||
$hash->{uniqueid} = $result->{uniqueid} if( defined($result->{uniqueid}) );
|
||||
|
||||
$hash->{helper}{scenes} = $result->{scenes} if( defined($result->{scenes}) );
|
||||
|
||||
$hash->{helper}{json} = $result;
|
||||
|
||||
if( $hash->{helper}->{devtype} eq 'G' ) {
|
||||
@ -1353,6 +1352,8 @@ HUEDevice_Parse($$)
|
||||
# }
|
||||
#}
|
||||
|
||||
$hash->{helper}{scenes} = $result->{scenes} if( defined($result->{scenes}) );
|
||||
|
||||
if( $result->{lights} ) {
|
||||
$hash->{helper}{lights} = {map {$_=>1} @{$result->{lights}}};
|
||||
$hash->{lights} = join( ",", sort { $a <=> $b } @{$result->{lights}} );
|
||||
@ -1386,6 +1387,18 @@ HUEDevice_Parse($$)
|
||||
|
||||
$readings{reachable} = $state->{reachable}?1:0 if( defined($state->{reachable}) );
|
||||
|
||||
$readings{scene} = $state->{scene};
|
||||
if( defined($readings{scene}) ) {
|
||||
if( my $scenes = $hash->{helper}{scenes} ) {
|
||||
for my $scene (@{$scenes}) {
|
||||
if( $readings{scene} == $scene->{id} ) {
|
||||
$readings{scene} = $scene->{name};
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $s = '';
|
||||
my $pct = -1;
|
||||
my $on = $state->{on}; $readings{on} = $hash->{helper}{onoff} if( !defined($on) );
|
||||
|
Loading…
Reference in New Issue
Block a user