98_RandomTimer.pm: undo most changes from 22850

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@22889 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2020-09-30 05:05:51 +00:00
parent 2e65082467
commit 3de8d5bd5b

View File

@ -82,20 +82,18 @@ sub Initialize {
$hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond disableCondCmd:none,offCmd,onCmd offState " $hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond disableCondCmd:none,offCmd,onCmd offState "
. "runonce:0,1 keepDeviceAlive:0,1 forceStoptimeSameDay:0,1 disabledForIntervals " . "runonce:0,1 keepDeviceAlive:0,1 forceStoptimeSameDay:0,1 disabledForIntervals "
. $readingFnAttributes; . $readingFnAttributes;
$hash->{parseParams} = 1;
return; return;
} }
# regular Functions ################################################################## # regular Functions ##################################################################
sub Define { sub Define {
my $hash = shift; my $hash = shift;
my $arr = shift; my $def = shift // return;
my $href = shift // return if !defined $arr;
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
my ( $name, $type, $timespec_start, $device, $timespec_stop, $timeToSwitch, my ( $name, $type, $timespec_start, $device, $timespec_stop, $timeToSwitch,
$variation ) $variation )
= @$arr; = split m{\s+}xms, $def;
return "wrong syntax: define <name> RandomTimer <timespec_start> <device> <timespec_stop> <timeToSwitch> [<variations>]" return "wrong syntax: define <name> RandomTimer <timespec_start> <device> <timespec_stop> <timeToSwitch> [<variations>]"
if ( !defined $timeToSwitch ); if ( !defined $timeToSwitch );
@ -172,7 +170,8 @@ sub Define {
sub Undef { sub Undef {
my ( $hash, $arg ) = @_; my $hash = shift;
my $arg = shift // return;
RmInternalTimer( "RT_SetTimer", $hash ); RmInternalTimer( "RT_SetTimer", $hash );
RmInternalTimer( "RT_Exec", $hash ); RmInternalTimer( "RT_Exec", $hash );
@ -213,14 +212,14 @@ sub Attr {
} }
sub Set { sub Set {
my ( $hash, $arr, $h ) = @_; my ( $hash, @arr ) = @_;
return "no set value specified" if ( int(@$arr) < 2 ); return "no set value specified" if ( int(@arr) < 2 );
return "Unknown argument @$arr[1], choose one of execNow:noArg active:noArg inactive:noArg" return "Unknown argument $arr[1], choose one of execNow:noArg active:noArg inactive:noArg"
if ( @$arr[1] eq "?" ); if ( $arr[1] eq "?" );
my $name = shift @$arr; my $name = shift @arr;
my $v = join( " ", @$arr ); my $v = join( " ", @arr );
if ( $v eq "execNow" ) { if ( $v eq "execNow" ) {
Log3( $hash, 3, "[$name] set $name $v" ); Log3( $hash, 3, "[$name] set $name $v" );