2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

30_HUEBridge.pm: allow spaces in updateschedule json

git-svn-id: https://svn.fhem.de/fhem/trunk@21366 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2020-03-06 12:01:05 +00:00
parent c767c28915
commit 4f21d34edc

View File

@ -799,7 +799,7 @@ HUEBridge_Set($@)
} elsif($cmd eq 'createrule' || $cmd eq 'updaterule') {
return "usage: createrule <name> <conditions&actions json>" if( $cmd eq 'createrule' && @args < 2 );
return "usage: updaterule <id> <conditions&actions json>" if( $cmd eq 'updaterule' && @args != 2 );
return "usage: updaterule <id> <conditions&actions json>" if( $cmd eq 'updaterule' && @args < 2 );
$args[@args-1] = '
{ "name":"Wall Switch Rule",
@ -809,7 +809,7 @@ HUEBridge_Set($@)
"actions":[
{"address":"/groups/0/action","method":"PUT", "body":{"scene":"S3"}}
]}' if( 0 || !$args[@args-1] );
my $json = $args[@args-1];
my $json = join( ' ', @args[1..@args-1]);
my $obj = eval { JSON->new->utf8(0)->decode($json) };
if( $@ ) {
Log3 $name, 2, "$name: json error: $@ in $json";
@ -830,10 +830,10 @@ HUEBridge_Set($@)
return undef;
} elsif($cmd eq 'updateschedule') {
return "usage: updateschedule <id> <attributes json>" if( @args != 2 );
return "usage: $cmd <id> <attributes json>" if( @args < 2 );
return "$arg is not a hue schedule number" if( $arg !~ m/^\d+$/ );
my $json = $args[@args-1];
my $json = join( ' ', @args[1..@args-1]);
my $obj = eval { JSON->new->utf8(0)->decode($json) };
if( $@ ) {
Log3 $name, 2, "$name: json error: $@ in $json";