98_RandomTimer.pm: change timer names to RT_* (->fhemdebug)

git-svn-id: https://svn.fhem.de/fhem/trunk@22731 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User
2020-09-04 13:03:12 +00:00
parent d192320ca4
commit cb7d854b59

View File

@@ -162,8 +162,8 @@ sub Define {
readingsSingleUpdate( $hash, "TimeToSwitch", $hash->{helper}{TIMETOSWITCH}, readingsSingleUpdate( $hash, "TimeToSwitch", $hash->{helper}{TIMETOSWITCH},
1 ); 1 );
RmInternalTimer( "SetTimer", $hash ); RmInternalTimer( "RT_SetTimer", $hash );
MkInternalTimer( "SetTimer", time(), \&SetTimer, $hash, 0 ); MkInternalTimer( "RT_SetTimer", time(), \&RT_SetTimer, $hash, 0 );
return; return;
} }
@@ -172,8 +172,8 @@ sub Undef {
my ( $hash, $arg ) = @_; my ( $hash, $arg ) = @_;
RmInternalTimer( "SetTimer", $hash ); RmInternalTimer( "RT_SetTimer", $hash );
RmInternalTimer( "Exec", $hash ); RmInternalTimer( "RT_Exec", $hash );
delete $modules{RandomTimer}{defptr}{ $hash->{NAME} }; delete $modules{RandomTimer}{defptr}{ $hash->{NAME} };
return; return;
} }
@@ -190,8 +190,8 @@ sub Attr {
if ( $attrName =~ m{\A disable(Cond)? \z}xms ) { if ( $attrName =~ m{\A disable(Cond)? \z}xms ) {
# Immediately execute next switch check # Immediately execute next switch check
RmInternalTimer( "Exec", $hash ); RmInternalTimer( "RT_Exec", $hash );
MkInternalTimer( "Exec", time() + 1, \&Exec, $hash, 0 ); MkInternalTimer( "RT_Exec", time() + 1, \&RT_Exec, $hash, 0 );
} }
if ( $attrName eq 'offState' ) { if ( $attrName eq 'offState' ) {
@@ -226,8 +226,8 @@ sub Set {
Log3( $hash, 3, "[$name] is disabled, set execNow not possible" ); Log3( $hash, 3, "[$name] is disabled, set execNow not possible" );
} }
else { else {
RmInternalTimer( "Exec", $hash ); RmInternalTimer( "RT_Exec", $hash );
MkInternalTimer( "Exec", time() + 1, \&Exec, $hash, 0 ); MkInternalTimer( "RT_Exec", time() + 1, \&RT_Exec, $hash, 0 );
} }
return; return;
} }
@@ -238,8 +238,8 @@ sub Set {
} }
my $statevalue = $v eq "active" ? "activated" : $v; my $statevalue = $v eq "active" ? "activated" : $v;
readingsSingleUpdate( $hash, "state", $statevalue, 1 ); readingsSingleUpdate( $hash, "state", $statevalue, 1 );
RmInternalTimer( "Exec", $hash ); RmInternalTimer( "RT_Exec", $hash );
MkInternalTimer( "Exec", time() + 1, \&Exec, $hash, 0 ); MkInternalTimer( "RT_Exec", time() + 1, \&RT_Exec, $hash, 0 );
return; return;
} }
return; return;
@@ -355,7 +355,7 @@ sub down {
return; return;
} }
sub Exec { sub RT_Exec {
my $myHash = shift // return; my $myHash = shift // return;
my $hash = GetHashIndirekt( $myHash, ( caller(0) )[3] ); my $hash = GetHashIndirekt( $myHash, ( caller(0) )[3] );
@@ -455,10 +455,10 @@ sub Exec {
} }
my $nextSwitch = time() + getSecsToNextAbschaltTest($hash); my $nextSwitch = time() + getSecsToNextAbschaltTest($hash);
RmInternalTimer( "Exec", $hash ); RmInternalTimer( "RT_Exec", $hash );
$hash->{helper}{NEXT_CHECK} = $hash->{helper}{NEXT_CHECK} =
strftime( "%d.%m.%Y %H:%M:%S", localtime($nextSwitch) ); strftime( "%d.%m.%Y %H:%M:%S", localtime($nextSwitch) );
MkInternalTimer( "Exec", $nextSwitch, \&Exec, $hash, 0 ); MkInternalTimer( "RT_Exec", $nextSwitch, \&RT_Exec, $hash, 0 );
return; return;
} }
@@ -559,7 +559,7 @@ sub setSwitchmode {
return; return;
} }
sub SetTimer { sub RT_SetTimer {
my $myHash = shift // return; my $myHash = shift // return;
my $hash = GetHashIndirekt( $myHash, ( caller(0) )[3] ); my $hash = GetHashIndirekt( $myHash, ( caller(0) )[3] );
return if ( !defined($hash) ); return if ( !defined($hash) );
@@ -583,15 +583,15 @@ sub SetTimer {
my $secToMidnight = 24 * 3600 - ( 3600 * $hour + 60 * $min + $sec ); my $secToMidnight = 24 * 3600 - ( 3600 * $hour + 60 * $min + $sec );
my $setExecTime = max( $now, $hash->{helper}{startTime} ); my $setExecTime = max( $now, $hash->{helper}{startTime} );
RmInternalTimer( "Exec", $hash ); RmInternalTimer( "RT_Exec", $hash );
MkInternalTimer( "Exec", $setExecTime, \&Exec, $hash, 0 ); MkInternalTimer( "RT_Exec", $setExecTime, \&RT_Exec, $hash, 0 );
if ( $hash->{helper}{REP} gt "" ) { if ( $hash->{helper}{REP} gt "" ) {
my $setTimerTime = my $setTimerTime =
max( $now + $secToMidnight + 15, $hash->{helper}{stopTime} ) + max( $now + $secToMidnight + 15, $hash->{helper}{stopTime} ) +
$hash->{helper}{TIMETOSWITCH} + 15; $hash->{helper}{TIMETOSWITCH} + 15;
RmInternalTimer( "SetTimer", $hash ); RmInternalTimer( "RT_SetTimer", $hash );
MkInternalTimer( "SetTimer", $setTimerTime, \&SetTimer, $hash, 0 ); MkInternalTimer( "RT_SetTimer", $setTimerTime, \&RT_SetTimer, $hash, 0 );
} }
return; return;
} }