diff --git a/fhem/FHEM/30_HUEBridge.pm b/fhem/FHEM/30_HUEBridge.pm index 75968c168..d9b35de50 100644 --- a/fhem/FHEM/30_HUEBridge.pm +++ b/fhem/FHEM/30_HUEBridge.pm @@ -220,6 +220,22 @@ HUEBridge_Set($@) return undef; + } elsif($cmd eq 'delete') { + if( defined $defs{$arg} && $defs{$arg}{TYPE} eq 'HUEDevice' ) { + $arg = $defs{$arg}{ID}; + } + + my $code = $name ."-". $arg; + if( defined($modules{HUEDevice}{defptr}{$code}) ) { + CommandDelete( undef, "$modules{HUEDevice}{defptr}{$code}{NAME}" ); + CommandSave(undef,undef) if( AttrVal( "autocreate", "autosave", 1 ) ); + } + + my $result = HUEBridge_Call($hash, undef, "lights/$arg", undef, 'DELETE'); + return $result->{error}{description} if( $result->{error} ); + + return undef; + } elsif($cmd eq 'creategroup') { my @lights = (); @@ -262,7 +278,7 @@ HUEBridge_Set($@) return undef; } else { - my $list = "creategroup deletegroup autocreate:noArg statusRequest:noArg"; + my $list = "delete creategroup deletegroup autocreate:noArg statusRequest:noArg"; $list .= " swupdate:noArg" if( defined($hash->{updatestate}) && $hash->{updatestate} == 2 ); return "Unknown argument $cmd, choose one of $list"; } @@ -927,6 +943,8 @@ HUEBridge_HTTP_Request($$$@) Initiate the detection of new ZigBee devices. After aproximately one minute any newly detected devices can be listed with get devices and the corresponding fhem devices can be created by set autocreate. +
  • delete <name>|<id>
    + Deletes the given device in the bridge and deletes the associated fhem device.
  • creategroup <name> <light-1>[ <light-2>..<lignt-n>]
    Create a group out of <light-1>-<light-n> in the bridge. The lights can be given as fhem device names or bridge device numbers.