fix change RemoveInternalTimer calls

This commit is contained in:
Marko Oldenburg 2020-03-26 08:26:44 +01:00
parent e0d0478495
commit a876205bd0

View File

@ -155,7 +155,7 @@ sub Define {
readingsSingleUpdate( $hash, "TimeToSwitch", $hash->{helper}{TIMETOSWITCH},
1 );
RemoveInternalTimer( "FHEM::RandomTimer::SetTimer", $hash );
RemoveInternalTimer( "SetTimer", $hash );
InternalTimer( "SetTimer", time(), "FHEM::RandomTimer::SetTimer", $hash,
0 );
@ -166,8 +166,8 @@ sub Undef {
my ( $hash, $arg ) = @_;
RemoveInternalTimer( "FHEM::RandomTimer::SetTimer", $hash );
RemoveInternalTimer( "FHEM::RandomTimer::Exec", $hash );
RemoveInternalTimer( "SetTimer", $hash );
RemoveInternalTimer( "Exec", $hash );
delete $modules{RandomTimer}{defptr}{ $hash->{NAME} };
return undef;
}
@ -184,7 +184,7 @@ sub Attr {
if ( $attrName ~~ [ "disable", "disableCond" ] ) {
# Schaltung vorziehen, damit bei einem disable abgeschaltet wird.
RemoveInternalTimer( "FHEM::RandomTimer::Exec", $hash );
RemoveInternalTimer( "Exec", $hash );
InternalTimer( "Exec", time() + 1, "FHEM::RandomTimer::Exec", $hash,
0 );
}
@ -212,7 +212,7 @@ sub Set {
Log3( $hash, 3, "[$name] is disabled, set execNow not possible" );
}
else {
RemoveInternalTimer( "FHEM::RandomTimer::Exec", $hash );
RemoveInternalTimer( "Exec", $hash );
InternalTimer( "Exec", time() + 1,
"FHEM::RandomTimer::Exec", $hash, 0 );
}
@ -429,7 +429,7 @@ sub Exec {
}
my $nextSwitch = time() + GetSecsToNextAbschaltTest($hash);
RemoveInternalTimer( "FHEM::RandomTimer::Exec", $hash );
RemoveInternalTimer( "Exec", $hash );
$hash->{helper}{NEXT_CHECK} =
strftime( "%d.%m.%Y %H:%M:%S", localtime($nextSwitch) );
InternalTimer( "Exec", $nextSwitch, "FHEM::RandomTimer::Exec", $hash, 0 );
@ -559,14 +559,14 @@ sub SetTimer {
my $secToMidnight = 24 * 3600 - ( 3600 * $hour + 60 * $min + $sec );
my $setExecTime = max( $now, $hash->{helper}{startTime} );
RemoveInternalTimer( "FHEM::RandomTimer::Exec", $hash );
RemoveInternalTimer( "Exec", $hash );
InternalTimer( "Exec", $setExecTime, "FHEM::RandomTimer::Exec", $hash, 0 );
if ( $hash->{helper}{REP} gt "" ) {
my $setTimerTime =
max( $now + $secToMidnight + 15, $hash->{helper}{stopTime} ) +
$hash->{helper}{TIMETOSWITCH} + 15;
RemoveInternalTimer( "FHEM::RandomTimer::SetTimer", $hash );
RemoveInternalTimer( "SetTimer", $hash );
InternalTimer( "SetTimer", $setTimerTime,
"FHEM::RandomTimer::SetTimer", $hash, 0 );
}
@ -689,8 +689,8 @@ sub InternalTimer {
sub RemoveInternalTimer {
my ( $modifier, $hash ) = @_;
my $timerName = "$hash->{NAME}_$modifier";
my $myHash = $hash->{TIMER}{$timerName};
my $myHash = $hash->{TIMER}{$timerName};
if ( defined($myHash) ) {
delete $hash->{TIMER}{$timerName};
Log3 $hash, 5, "[$hash->{NAME}] removing Timer: $timerName";