From 22c8bd55922c6bde03528b75ba32dd092aaada38 Mon Sep 17 00:00:00 2001 From: Beta-User Date: Fri, 25 Sep 2020 19:13:37 +0000 Subject: [PATCH] 98_RandomTimer.pm: add parseParams support, #14010 msg1087704 git-svn-id: https://svn.fhem.de/fhem/trunk@22850 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_RandomTimer.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/98_RandomTimer.pm b/fhem/FHEM/98_RandomTimer.pm index 05fd2fd5f..4f34dfebd 100644 --- a/fhem/FHEM/98_RandomTimer.pm +++ b/fhem/FHEM/98_RandomTimer.pm @@ -82,18 +82,20 @@ sub Initialize { $hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond disableCondCmd:none,offCmd,onCmd offState " . "runonce:0,1 keepDeviceAlive:0,1 forceStoptimeSameDay:0,1 disabledForIntervals " . $readingFnAttributes; + $hash->{parseParams} = 1; return; } # regular Functions ################################################################## sub Define { my $hash = shift; - my $def = shift // return; + my $arr = shift; + my $href = shift // return if !defined $arr; RemoveInternalTimer($hash); my ( $name, $type, $timespec_start, $device, $timespec_stop, $timeToSwitch, $variation ) - = split m{\s+}xms, $def; + = @$arr; return "wrong syntax: define RandomTimer []" if ( !defined $timeToSwitch ); @@ -211,14 +213,14 @@ sub Attr { } sub Set { - my ( $hash, @a ) = @_; + my ( $hash, $arr, $h ) = @_; - return "no set value specified" if ( int(@a) < 2 ); - return "Unknown argument $a[1], choose one of execNow:noArg active:noArg inactive:noArg" - if ( $a[1] eq "?" ); + return "no set value specified" if ( int(@$arr) < 2 ); + return "Unknown argument @$arr[1], choose one of execNow:noArg active:noArg inactive:noArg" + if ( @$arr[1] eq "?" ); - my $name = shift @a; - my $v = join( " ", @a ); + my $name = shift @$arr; + my $v = join( " ", @$arr ); if ( $v eq "execNow" ) { Log3( $hash, 3, "[$name] set $name $v" );