31_HUEDevice.pm: optional new_id parameter for HUEDevice_IODevChanged()

git-svn-id: https://svn.fhem.de/fhem/trunk@20976 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme1968
2020-01-14 17:11:14 +00:00
parent 8ba5f97f5e
commit 683d2249b4

View File

@@ -270,9 +270,9 @@ HUEDevice_summaryFn($$$$)
} }
sub sub
HUEDevice_IODevChanged($$$) HUEDevice_IODevChanged($$$;$)
{ {
my ($hash,$old,$new) = @_; my ($hash,$old,$new, $new_id) = @_;
$hash = $defs{$hash} if( ref($hash) ne 'HASH' ); $hash = $defs{$hash} if( ref($hash) ne 'HASH' );
my $name = $hash->{NAME}; my $name = $hash->{NAME};
@@ -296,6 +296,8 @@ HUEDevice_IODevChanged($$$)
} }
$new = $hash->{IODev}->{NAME} if( defined($hash->{IODev}) ); $new = $hash->{IODev}->{NAME} if( defined($hash->{IODev}) );
$hash->{ID} = $new_id if( defined($new_id) );
$code = $hash->{ID}; $code = $hash->{ID};
$code = $new ."-". $code if( $new ); $code = $new ."-". $code if( $new );
$modules{HUEDevice}{defptr}{$code} = $hash; $modules{HUEDevice}{defptr}{$code} = $hash;