mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
31_HUEDevice.pm: fixed set scene command for tradfi gateway iodev
git-svn-id: https://svn.fhem.de/fhem/trunk@20426 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0a8c9d7d05
commit
c8cc9db927
@ -933,33 +933,33 @@ HUEDevice_Set($@)
|
||||
if( $hash->{helper}->{devtype} eq 'G' ) {
|
||||
$list .= " savescene deletescene";
|
||||
}
|
||||
}
|
||||
|
||||
if( my $scenes = $hash->{IODev}{helper}{scenes} ) {
|
||||
local *containsOneOfMyLights = sub($) {
|
||||
return 1 if( !defined($hash->{helper}{lights}) );
|
||||
if( my $scenes = $hash->{IODev}{helper}{scenes} ) {
|
||||
local *containsOneOfMyLights = sub($) {
|
||||
return 1 if( !defined($hash->{helper}{lights}) );
|
||||
|
||||
my( $lights ) = @_;
|
||||
my( $lights ) = @_;
|
||||
|
||||
foreach my $light (@{$lights}) {
|
||||
return 1 if( defined($hash->{helper}{lights}{$light}) );
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
my %count;
|
||||
map { $count{$scenes->{$_}{name}}++ } keys %{$scenes};
|
||||
$list .= " scene:". join(",", sort grep { defined } map { if( !containsOneOfMyLights($scenes->{$_}{lights}) ) {
|
||||
undef;
|
||||
} else {
|
||||
my $scene = $scenes->{$_}{name};
|
||||
if( $count{$scene} > 1 ) {
|
||||
$scene .= " [id=$_]";
|
||||
}
|
||||
$scene =~ s/ /#/g; $scene;
|
||||
}
|
||||
} keys %{$scenes} );
|
||||
} else {
|
||||
$list .= " scene";
|
||||
}
|
||||
foreach my $light (@{$lights}) {
|
||||
return 1 if( defined($hash->{helper}{lights}{$light}) );
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
my %count;
|
||||
map { $count{$scenes->{$_}{name}}++ } keys %{$scenes};
|
||||
$list .= " scene:". join(",", sort grep { defined } map { if( !containsOneOfMyLights($scenes->{$_}{lights}) ) {
|
||||
undef;
|
||||
} else {
|
||||
my $scene = $scenes->{$_}{name};
|
||||
if( $count{$scene} > 1 ) {
|
||||
$scene .= " [id=$_]";
|
||||
}
|
||||
$scene =~ s/ /#/g; $scene;
|
||||
}
|
||||
} keys %{$scenes} );
|
||||
} else {
|
||||
$list .= " scene";
|
||||
}
|
||||
|
||||
return SetExtensions($hash, $list, $name, @aa);
|
||||
|
Loading…
Reference in New Issue
Block a user