2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 01:46:08 +00:00

37_harmony.pm: some more Development Guidelines AV compatibility

git-svn-id: https://svn.fhem.de/fhem/trunk@6823 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2014-10-27 21:15:03 +00:00
parent 63c0792be3
commit 9ca1d7e00f

View File

@ -216,6 +216,20 @@ harmony_actionOfCommand($$)
return undef; 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 sub
harmony_Set($$@) harmony_Set($$@)
@ -232,6 +246,13 @@ harmony_Set($$@)
return "no hub found for device $name ($param)" if( !$hash->{hub} ); 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" ) { if( $cmd eq "command" ) {
$param2 = $param; $param2 = $param;
@ -1259,20 +1280,6 @@ harmony_GetPower($$)
return $power; return $power;
} }
sub 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($$@) harmony_Get($$@)
{ {
my ($hash, $name, $cmd, $param) = @_; my ($hash, $name, $cmd, $param) = @_;