From 986b8ff9791c07c54d4067e57c5fc1cc09261e99 Mon Sep 17 00:00:00 2001 From: justme1968 Date: Sun, 8 Dec 2019 10:13:15 +0000 Subject: [PATCH] 30_HUEBridge.pm: deConz scene fix git-svn-id: https://svn.fhem.de/fhem/trunk@20684 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/30_HUEBridge.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/30_HUEBridge.pm b/fhem/FHEM/30_HUEBridge.pm index 316e4f395..38b075590 100644 --- a/fhem/FHEM/30_HUEBridge.pm +++ b/fhem/FHEM/30_HUEBridge.pm @@ -498,6 +498,7 @@ HUEBridge_string2array($) sub HUEBridge_scene2id($$) { + # hash is the bridge device my ($hash,$id) = @_; $hash = $defs{$hash} if( ref($hash) ne 'HASH' ); return undef if( !$hash ); @@ -506,13 +507,13 @@ HUEBridge_scene2id($$) $id = $1; } - if( $hash->{helper}{scenes} ) { + if( my $scenes = $hash->{helper}{scenes} ) { return $id if( defined($hash->{helper}{scenes}{$id}) ); $id = lc($id); $id =~ s/\((.*)\)$/\\\($1\\\)/; - foreach my $key ( keys %{$hash->{helper}{scenes}} ) { - my $scene = $hash->{helper}{scenes}{$key}; + foreach my $key ( keys %{$scenes} ) { + my $scene = $scenes->{$key}; return $key if( lc($key) eq $id ); #return $key if( $scene->{name} eq $id ); @@ -525,6 +526,7 @@ HUEBridge_scene2id($$) sub HUEBridge_scene2id_deCONZ($$) { + # hash is the client device my ($hash,$id) = @_; my $name = $hash->{NAME}; #Log3 $name, 4, "HUEBridge_scene2id_deCONZ: $id, hash: " . Dumper $hash; @@ -535,7 +537,7 @@ HUEBridge_scene2id_deCONZ($$) $id = $1; } - if( my $scenes = $hash->{scenes} ) { + if( my $scenes = $hash->{helper}{scenes} ) { $id = lc($id); $id =~ s/\((.*)\)$/\\\($1\\\)/; for my $scene ( @{$scenes} ) {