modify definition argument is optional now

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2653 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2013-02-06 18:19:59 +00:00
parent 5e069aab6f
commit d710dc66f5

View File

@@ -1304,7 +1304,7 @@ CommandModify($$)
my @a = split("[ \t]+", $def, 2);
return "Usage: modify <name> <type dependent arguments>"
if(int(@a) < 2);
if(int(@a) < 1);
# Return a list of modules
return "Define $a[0] first" if(!defined($defs{$a[0]}));
@@ -1312,7 +1312,8 @@ CommandModify($$)
$hash->{OLDDEF} = $hash->{DEF};
$hash->{DEF} = $a[1];
my $ret = CallFn($a[0], "DefFn", $hash, "$a[0] $hash->{TYPE} $a[1]");
my $ret = CallFn($a[0], "DefFn", $hash,
"$a[0] $hash->{TYPE}".(defined($a[1]) ? " $a[1]" : ""));
$hash->{DEF} = $hash->{OLDDEF} if($ret);
delete($hash->{OLDDEF});
return $ret;