From edee597e3661576d0f8014160721b3d9915fe615 Mon Sep 17 00:00:00 2001 From: Ellert <> Date: Thu, 23 Mar 2017 05:58:00 +0000 Subject: [PATCH] 98_DOIFtools.pm: real next timer handles DOIF's attribute weekdays git-svn-id: https://svn.fhem.de/fhem/trunk@13775 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/98_DOIFtools.pm | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 661aded5c..fbec0cfaa 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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. + - update: 98_DOIFtools: real next timer handles DOIF's attribute weekdays - update: 88_HMCCU: Introducing new client module HMCCURPC. - new: 98_Nmap: introducing new module to perform a network scan with Nmap and display information about the available network diff --git a/fhem/FHEM/98_DOIFtools.pm b/fhem/FHEM/98_DOIFtools.pm index 16a7cbb34..35090cd7f 100644 --- a/fhem/FHEM/98_DOIFtools.pm +++ b/fhem/FHEM/98_DOIFtools.pm @@ -701,11 +701,15 @@ sub DOIFtoolsRg } # calculate real date in userReadings sub DOIFtoolsNextTimer { - my ($timer_str) = @_; - $timer_str =~ /(\d\d).(\d\d).(\d\d\d\d) (\d\d):(\d\d):(\d\d)\|([0-8]+)/; - my $tdays = $7; - return "$1.$2.$3 $4:$5:$6" if (length($7)==0); + my ($timer_str,$tn) = @_; + $timer_str =~ /(\d\d).(\d\d).(\d\d\d\d) (\d\d):(\d\d):(\d\d)\|?(.*)/; + my $tstr = "$1.$2.$3 $4:$5:$6"; + return $tstr if (length($7) == 0); my $timer = timelocal($6,$5,$4,$1,$2-1,$3); + my $tdays = ""; + $tdays = $tn ? DOIF_weekdays($defs{$tn},$7) : $7; + $tdays =~/([0-8])/; + return $tstr if (length($1) == 0); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($timer); my $ilook = 0; my $we; @@ -739,8 +743,8 @@ sub DOIFtoolsNxTimer { my $ret = ""; my @ret; foreach my $key (keys %{$thash->{READINGS}}) { - if ($key =~ m/^timer_\d\d_c\d\d/ && $thash->{READINGS}{$key}{VAL} =~ m/.*\|[0-8]+/) { - $ret = AttrVal($pn,"DOIFtoolsReadingsPrefix","N_")."$key:$key.* \{DOIFtoolsNextTimer(ReadingsVal(\"$tn\",\"$key\",\"none\"))\}"; + if ($key =~ m/^timer_\d\d_c\d\d/ && $thash->{READINGS}{$key}{VAL} =~ m/\d\d.\d\d.\d\d\d\d \d\d:\d\d:\d\d\|.*/) { + $ret = AttrVal($pn,"DOIFtoolsReadingsPrefix","N_")."$key:$key.* \{DOIFtoolsNextTimer(ReadingsVal(\"$tn\",\"$key\",\"none\"),\"$tn\")\}"; push @ret, $ret if ($ret); } } @@ -1221,7 +1225,7 @@ sub DOIFtools_Get($@) foreach my $i (@doifList) { foreach my $key (keys %{$defs{$i}{READINGS}}) { - if ($key =~ m/^timer_\d\d_c\d\d/ && $defs{$i}{READINGS}{$key}{VAL} =~ m/.*\|[0-8]+/) { + if ($key =~ m/^timer_\d\d_c\d\d/ && $defs{$i}{READINGS}{$key}{VAL} =~ m/\d\d.\d\d.\d\d\d\d \d\d:\d\d:\d\d\|.*/) { push @ntL, $i; last; }