2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 23:06:37 +00:00

31_HUEDevice.pm: added addlight and removelight command for groups

git-svn-id: https://svn.fhem.de/fhem/trunk@29014 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2024-07-06 20:41:45 +00:00
parent c33a7fb36a
commit 5f7a0306e9
2 changed files with 36 additions and 1 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it
- feature: 31_HUEDevice.pm: added addlight and removelight command for groups
- bufgix: 72_FRITZBOX: Fehler behoben bei FritzOS >= 6.69 und < 7.00
- feature: 76_SolarForecast: improve manual setting of pvCorrectionFactor_XX
- feature: 98_RandomTimer: add recomputeTimes setter

View File

@ -854,6 +854,40 @@ HUEDevice_Set($@)
return $result->{error}{description} if( $result->{error} );
return undef;
} elsif( $cmd eq 'addlight' || $cmd eq 'addlights' ) {
return "usage: $cmd <lights>" if( @args != 1 );
my $obj = { 'lights' => HUEBridge_string2array("$hash->{lights},$args[0]"), };
my $result = HUEDevice_ReadFromServer($hash,$hash->{ID},$obj);
if( $result->{success} ) {
RemoveInternalTimer($hash);
HUEDevice_GetUpdate($hash);
}
return $result->{error}{description} if( $result->{error} );
return undef;
} elsif( $cmd eq 'removelight' || $cmd eq 'removelights' ) {
return "usage: $cmd <lights>" if( @args != 1 );
my $current = HUEBridge_string2array($hash->{lights});
my %to_remove;
@to_remove{@{HUEBridge_string2array($args[0])}} = undef;
my @new = grep {not exists $to_remove{$_}} @{$current};
my $obj = { 'lights' => \@new };
my $result = HUEDevice_ReadFromServer($hash,$hash->{ID},$obj);
if( $result->{success} ) {
RemoveInternalTimer($hash);
HUEDevice_GetUpdate($hash);
}
return $result->{error}{description} if( $result->{error} );
return undef;
} elsif( $cmd eq 'savescene' ) {
if( $hash->{IODev} && $hash->{IODev}{helper}{apiversion} && $hash->{IODev}{helper}{apiversion} >= (1<<16) + (11<<8) ) {
return "usage: savescene <name>" if( @args < 1 );
@ -1196,7 +1230,7 @@ HUEDevice_Set($@)
$list .= " effect:none,colorloop" if( $subtype =~ m/color/ );
$list .= " lights" if( $hash->{helper}->{devtype} eq 'G' );
$list .= " lights addlight removelight" if( $hash->{helper}->{devtype} eq 'G' );
$list .= " rename";
#$list .= " setlight configlight config" if( !$hash->{helper}->{devtype} );