mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
98_WeekdayTimer: fix timer admin
git-svn-id: https://svn.fhem.de/fhem/trunk@23516 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
df014bae56
commit
602ebebd86
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix: 98_WeekdayTimer: fix timer admin
|
||||||
- change: 10_WS980: fix num vs. string
|
- change: 10_WS980: fix num vs. string
|
||||||
- change: 55_DWD_OpenData: logging (forum #83097 msg #1114070)
|
- change: 55_DWD_OpenData: logging (forum #83097 msg #1114070)
|
||||||
- feature: 74_Unifi: get deviceData hinzugefügt
|
- feature: 74_Unifi: get deviceData hinzugefügt
|
||||||
|
@ -141,8 +141,12 @@ sub WeekdayTimer_Define {
|
|||||||
|
|
||||||
addToDevAttrList($name, "weekprofile") if $def =~ m{weekprofile}xms;
|
addToDevAttrList($name, "weekprofile") if $def =~ m{weekprofile}xms;
|
||||||
|
|
||||||
return InternalTimer(time(), \&WeekdayTimer_Start,$hash,0) if !$init_done;
|
if (!$init_done) {
|
||||||
return WeekdayTimer_Start($hash);
|
InternalTimer(time(), \&WeekdayTimer_Start,$hash,0) ;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
WeekdayTimer_Start($hash);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -757,13 +761,14 @@ sub WeekdayTimer_GlobalDaylistSpec {
|
|||||||
sub WeekdayTimer_SetTimerForMidnightUpdate {
|
sub WeekdayTimer_SetTimerForMidnightUpdate {
|
||||||
my $fnHash = shift;
|
my $fnHash = shift;
|
||||||
my $hash = $fnHash->{HASH} // $fnHash;
|
my $hash = $fnHash->{HASH} // $fnHash;
|
||||||
return if (!defined($hash));
|
return if !defined($hash);
|
||||||
|
|
||||||
my $now = time();
|
my $now = time();
|
||||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($now);
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($now);
|
||||||
|
|
||||||
my $midnightPlus5Seconds = getSwitchtimeEpoch ($now, 0, 0, 5, 1);
|
my $midnightPlus5Seconds = getSwitchtimeEpoch ($now, 0, 0, 5, 1);
|
||||||
resetRegisteredInternalTimer("SetTimerOfDay", $midnightPlus5Seconds, \&WeekdayTimer_SetTimerOfDay, $hash, 0);
|
RemoveInternalTimer($hash,\&WeekdayTimer_SetTimerOfDay);
|
||||||
|
InternalTimer($midnightPlus5Seconds, \&WeekdayTimer_SetTimerOfDay, $hash, 0) if !AttrVal($hash->{NAME},"disable",0);
|
||||||
$hash->{SETTIMERATMIDNIGHT} = 1;
|
$hash->{SETTIMERATMIDNIGHT} = 1;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -812,12 +817,12 @@ sub WeekdayTimer_SetTimerOfDay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$hash->{helper}{WEDAYS} = \%wedays;
|
$hash->{helper}{WEDAYS} = \%wedays;
|
||||||
$hash->{SETTIMERATMIDNIGHT} = $fnHash->{SETTIMERATMIDNIGHT}; WeekdayTimer_DeleteTimer($hash);
|
$hash->{SETTIMERATMIDNIGHT} = $fnHash->{SETTIMERATMIDNIGHT};
|
||||||
|
WeekdayTimer_DeleteTimer($hash);
|
||||||
WeekdayTimer_Profile ($hash);
|
WeekdayTimer_Profile ($hash);
|
||||||
WeekdayTimer_SetTimer ($hash);
|
WeekdayTimer_SetTimer ($hash) if !AttrVal($hash->{NAME},"disable",0);
|
||||||
delete $hash->{SETTIMERATMIDNIGHT};
|
delete $hash->{SETTIMERATMIDNIGHT};
|
||||||
$fnHash = { HASH => $hash };
|
WeekdayTimer_SetTimerForMidnightUpdate( $hash );
|
||||||
WeekdayTimer_SetTimerForMidnightUpdate( $fnHash );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,7 +937,6 @@ sub WeekdayTimer_delayedTimerInPast {
|
|||||||
Log3( $hash, 4, "[$hash->{NAME}] $device ".FmtDateTime($time)." ".($tim-$time)."s " );
|
Log3( $hash, 4, "[$hash->{NAME}] $device ".FmtDateTime($time)." ".($tim-$time)."s " );
|
||||||
|
|
||||||
for my $para ( @{$tipIpHash->{$device}{$time}} ) {
|
for my $para ( @{$tipIpHash->{$device}{$time}} ) {
|
||||||
#WeekdayTimer_RemoveInternalTimer(@$para[0], @$para[3]);
|
|
||||||
my $mHash = resetRegisteredInternalTimer(@$para[0],@$para[1],@$para[2],@$para[3],@$para[4]);
|
my $mHash = resetRegisteredInternalTimer(@$para[0],@$para[1],@$para[2],@$para[3],@$para[4]);
|
||||||
$mHash->{forceSwitch} = 1;
|
$mHash->{forceSwitch} = 1;
|
||||||
}
|
}
|
||||||
@ -1039,7 +1043,6 @@ sub WeekdayTimer_Update {
|
|||||||
$activeTimer = isAnActiveTimer ($hash, $dieGanzeWoche, $newParam, $overrulewday);
|
$activeTimer = isAnActiveTimer ($hash, $dieGanzeWoche, $newParam, $overrulewday);
|
||||||
$activeTimerState = isAnActiveTimer ($hash, $tage, $newParam, $overrulewday);
|
$activeTimerState = isAnActiveTimer ($hash, $tage, $newParam, $overrulewday);
|
||||||
Log3( $hash, 4, "[$name] Update - past timer activated" );
|
Log3( $hash, 4, "[$name] Update - past timer activated" );
|
||||||
#WeekdayTimer_RemoveInternalTimer("$idx", $hash);
|
|
||||||
resetRegisteredInternalTimer("$idx", $timToSwitch, \&WeekdayTimer_Update, $hash, 0) if ($timToSwitch > $now && ($activeTimerState||$activeTimer));
|
resetRegisteredInternalTimer("$idx", $timToSwitch, \&WeekdayTimer_Update, $hash, 0) if ($timToSwitch > $now && ($activeTimerState||$activeTimer));
|
||||||
} else {
|
} else {
|
||||||
$activeTimer = isAnActiveTimer ($hash, $tage, $newParam, $overrulewday);
|
$activeTimer = isAnActiveTimer ($hash, $tage, $newParam, $overrulewday);
|
||||||
@ -1169,7 +1172,6 @@ sub checkDelayedExecution {
|
|||||||
deleteSingleRegisteredInternalTimer($hash->{VERZOEGRUNG_IDX},$hash);
|
deleteSingleRegisteredInternalTimer($hash->{VERZOEGRUNG_IDX},$hash);
|
||||||
}
|
}
|
||||||
$hash->{VERZOEGRUNG_IDX} = $time;
|
$hash->{VERZOEGRUNG_IDX} = $time;
|
||||||
#WeekdayTimer_RemoveInternalTimer("$time", $hash);
|
|
||||||
resetRegisteredInternalTimer("$time", $nextRetry, \&WeekdayTimer_Update, $hash, 0);
|
resetRegisteredInternalTimer("$time", $nextRetry, \&WeekdayTimer_Update, $hash, 0);
|
||||||
$hash->{VERZOEGRUNG} = 1;
|
$hash->{VERZOEGRUNG} = 1;
|
||||||
return $verzoegerteAusfuehrung;
|
return $verzoegerteAusfuehrung;
|
||||||
@ -1225,7 +1227,6 @@ sub checkDelayedExecution {
|
|||||||
deleteSingleRegisteredInternalTimer($hash->{VERZOEGRUNG_IDX},$hash);
|
deleteSingleRegisteredInternalTimer($hash->{VERZOEGRUNG_IDX},$hash);
|
||||||
}
|
}
|
||||||
$hash->{VERZOEGRUNG_IDX} = $time;
|
$hash->{VERZOEGRUNG_IDX} = $time;
|
||||||
#WeekdayTimer_RemoveInternalTimer("$time", $hash);
|
|
||||||
resetRegisteredInternalTimer("$time", $nextRetry, \&WeekdayTimer_Update, $hash, 0);
|
resetRegisteredInternalTimer("$time", $nextRetry, \&WeekdayTimer_Update, $hash, 0);
|
||||||
$hash->{VERZOEGRUNG} = 1;
|
$hash->{VERZOEGRUNG} = 1;
|
||||||
return 1
|
return 1
|
||||||
@ -1358,22 +1359,26 @@ sub WeekdayTimer_Attr {
|
|||||||
delete $hash->{WDT_EVENTMAP};
|
delete $hash->{WDT_EVENTMAP};
|
||||||
}
|
}
|
||||||
$attr{$name}{$attrName} = $attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
|
return if (!$init_done);
|
||||||
|
return WeekdayTimer_Start($hash);
|
||||||
}
|
}
|
||||||
return if (!$init_done);
|
return if (!$init_done);
|
||||||
if( $attrName eq "disable" ) {
|
if( $attrName eq "disable" ) {
|
||||||
|
WeekdayTimer_DeleteTimer($hash);
|
||||||
|
###RemoveInternalTimer($fnHash);
|
||||||
readingsSingleUpdate ($hash, "disabled", $attrVal, 1);
|
readingsSingleUpdate ($hash, "disabled", $attrVal, 1);
|
||||||
return WeekdayTimer_SetTimerOfDay({ HASH => $hash}) if !$attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
}
|
return RemoveInternalTimer($hash,\&WeekdayTimer_SetTimerOfDay) if $attrVal;
|
||||||
if ( $attrName eq "enable" ) {
|
return WeekdayTimer_Start($hash);
|
||||||
return WeekdayTimer_SetTimerOfDay({ HASH => $hash});
|
#return WeekdayTimer_SetTimerOfDay( { HASH => $hash} ) if !$attrVal;
|
||||||
}
|
}
|
||||||
if ( $attrName eq "weekprofile" ) {
|
if ( $attrName eq "weekprofile" ) {
|
||||||
$attr{$name}{$attrName} = $attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
return WeekdayTimer_Start($hash);
|
#return WeekdayTimer_Start($hash);
|
||||||
}
|
}
|
||||||
if ( $attrName eq "switchInThePast" ) {
|
if ( $attrName eq "switchInThePast" ) {
|
||||||
$attr{$name}{$attrName} = $attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
return WeekdayTimer_SetTimerOfDay({ HASH => $hash});
|
return WeekdayTimer_Start($hash);
|
||||||
}
|
}
|
||||||
if ( $attrName eq "delayedExecutionCond" ) {
|
if ( $attrName eq "delayedExecutionCond" ) {
|
||||||
my %specials = (
|
my %specials = (
|
||||||
@ -1392,7 +1397,7 @@ sub WeekdayTimer_Attr {
|
|||||||
return "WDT_sendDelay is limited to 300 seconds" if $attrVal > 300;
|
return "WDT_sendDelay is limited to 300 seconds" if $attrVal > 300;
|
||||||
}
|
}
|
||||||
$attr{$name}{$attrName} = $attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
return WeekdayTimer_SetTimerOfDay({ HASH => $hash});
|
return WeekdayTimer_Start($hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user