From 9ca1d7e00f68b54bcece1a4e803951e9e19219a7 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Mon, 27 Oct 2014 21:15:03 +0000 Subject: [PATCH] 37_harmony.pm: some more Development Guidelines AV compatibility git-svn-id: https://svn.fhem.de/fhem/trunk@6823 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/37_harmony.pm | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/fhem/FHEM/37_harmony.pm b/fhem/FHEM/37_harmony.pm index 9abe91d03..b240a58de 100644 --- a/fhem/FHEM/37_harmony.pm +++ b/fhem/FHEM/37_harmony.pm @@ -216,6 +216,20 @@ harmony_actionOfCommand($$) return undef; } +sub +harmony_hubOfDevice($) +{ + my ($id) = @_; + + foreach my $d (sort keys %defs) { + next if( !defined($defs{$d}) ); + next if( $defs{$d}->{TYPE} ne "harmony" ); + next if( $defs{$d}->{id} ); + next if( !harmony_deviceOfId($defs{$d}, $id) ); + Log3 undef, 3, "harmony: found IODev $d for device $id" ; + return $d; + } +} sub harmony_Set($$@) @@ -232,6 +246,13 @@ harmony_Set($$@) return "no hub found for device $name ($param)" if( !$hash->{hub} ); } + if( $cmd ne "?" ) { + my $device = harmony_deviceOfId( $defs{$hash->{hub}}, $hash->{id} ); + if( harmony_actionOfCommand( $device, $cmd ) ) { + $param = $cmd; + $cmd = "command"; + } + } if( $cmd eq "command" ) { $param2 = $param; @@ -1259,20 +1280,6 @@ harmony_GetPower($$) return $power; } sub -harmony_hubOfDevice($) -{ - my ($id) = @_; - - foreach my $d (sort keys %defs) { - next if( !defined($defs{$d}) ); - next if( $defs{$d}->{TYPE} ne "harmony" ); - next if( $defs{$d}->{id} ); - next if( !harmony_deviceOfId($defs{$d}, $id) ); - Log3 undef, 3, "harmony: found IODev $d for device $id" ; - return $d; - } -} -sub harmony_Get($$@) { my ($hash, $name, $cmd, $param) = @_;