mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
98_WeekdayTimer: fix sunday handling in some cases
git-svn-id: https://svn.fhem.de/fhem/trunk@27423 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4b7f6fa025
commit
f0831ef7d1
@ -1,5 +1,6 @@
|
||||
# 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.
|
||||
- bugfix: 98_WeekdayTimer: sunday handling in special cases
|
||||
- bugfix: 74_AMADDevice: much more bugfixes
|
||||
- change: Update Synology lib modules
|
||||
- bugfix: 72_FRITZBOX: Fehlerkorrekturen: u.a. Verhalten bei disable
|
||||
|
@ -331,7 +331,6 @@ sub _Profile {
|
||||
my $idx = 0;
|
||||
for my $st ( @{$hash->{SWITCHINGTIMES}} ) {
|
||||
my ($tage,$time,$parameter,$overrulewday) = _SwitchingTime ($hash, $st);
|
||||
|
||||
$idx++;
|
||||
for my $d (@{$tage}) {
|
||||
my @listeDerTage = ($d);
|
||||
@ -339,21 +338,21 @@ sub _Profile {
|
||||
|
||||
for my $day (@listeDerTage) {
|
||||
my $dayOfEchteZeit = $day;
|
||||
#####
|
||||
|
||||
if ($day < 7) {
|
||||
my $relativeDay = ($day - $wday ) % 7;
|
||||
#my $relativeDay = $day - $wday;
|
||||
#$relativeDay = $relativeDay + 7 if $relativeDay < 0 ;
|
||||
$dayOfEchteZeit = undef if ($hash->{helper}{WEDAYS}{$relativeDay} && $overrulewday);
|
||||
$dayOfEchteZeit = undef if $hash->{helper}{WEDAYS}{$relativeDay} && defined $overrulewday && $overrulewday !~ m{$day}x;
|
||||
} elsif ($day==7) {
|
||||
$dayOfEchteZeit = ($wday>=1&&$wday<=5) ? 6 : $wday; # ggf. Samstag
|
||||
} elsif ($day==8) {
|
||||
$dayOfEchteZeit = ($wday==0||$wday==6) ? 1 : $wday; # ggf. Montag
|
||||
}
|
||||
$dayOfEchteZeit = ($wday>=1&&$wday<=5) ? 6 : $wday if ($day==7); # ggf. Samstag $wday ~~ [1..5]
|
||||
$dayOfEchteZeit = ($wday==0||$wday==6) ? 1 : $wday if ($day==8); # ggf. Montag $wday ~~ [0, 6]
|
||||
if (defined $dayOfEchteZeit) {
|
||||
my $echtZeit = _getHHMMSS($hash, $dayOfEchteZeit, $time);
|
||||
$hash->{profile} {$day}{$echtZeit} = $parameter;
|
||||
$hash->{profile_IDX}{$day}{$echtZeit} = $idx;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
# ---- Zeitpunkte des aktuellen Tages mit EPOCH ermitteln --------------
|
||||
@ -427,17 +426,22 @@ sub _SwitchingTime {
|
||||
|
||||
my ($daylist, $time, $timeString, $para);
|
||||
my @st = split m{\|}xms, $switchingtime;
|
||||
my $overrulewday = 0;
|
||||
my $overrulewday;
|
||||
if ( @st == 2 || @st == 3 && $st[2] eq 'w') {
|
||||
$daylist = ($globalDaylistSpec ne '') ? $globalDaylistSpec : '0123456';
|
||||
$time = $st[0];
|
||||
$para = $st[1];
|
||||
$overrulewday = 1 if defined $st[2] && $st[2] eq 'w';
|
||||
$overrulewday = 'w' if defined $st[2] && $st[2] eq 'w';
|
||||
} elsif ( @st == 3 || @st == 4) {
|
||||
$daylist = $st[0];
|
||||
$time = $st[1];
|
||||
$para = $st[2];
|
||||
$overrulewday = 1 if defined $st[3] && $st[3] eq 'w' || $st[0] == 8;
|
||||
if ( defined $st[3] && $st[3] eq 'w' ) {
|
||||
$overrulewday = 'w';
|
||||
} elsif ($st[0] =~ m{8}x ) {
|
||||
$overrulewday = $daylist;
|
||||
$overrulewday =~ s{8}{}x;# was: $st[0] == 8; might be: $st[0] eq '8'?!?
|
||||
}
|
||||
}
|
||||
|
||||
my @tage = @{_daylistAsArray($hash, $daylist)};
|
||||
@ -529,7 +533,7 @@ sub _getHHMMSS {
|
||||
|
||||
# Zeitangabe verarbeiten.
|
||||
$time = qq{"$time"} if $time !~ m{\A\{.*\}\z}xms;
|
||||
my $date = $now+($d-$wday)*DAYSECONDS;
|
||||
my $date = $now+abs($d-$wday)*DAYSECONDS;
|
||||
my $timeString = '{ my $date='."$date;" .$time."}";
|
||||
my $eTimeString = AnalyzePerlCommand( $hash, $timeString ); # must deliver HH:MM[:SS]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user