From 9bbafdb386ecfa3d607580b5befb24837150c3c8 Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Tue, 7 Apr 2015 19:07:00 +0000 Subject: [PATCH] 55_GDS.pm: fixed a_X_valid calculation git-svn-id: https://svn.fhem.de/fhem/trunk@8396 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/55_GDS.pm | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 2c902c592..ac19bba47 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. + - Bugfix: 55_GDS - use onset for a_X_valid calculation - Bugfix: Update of set-command introducing ReadBackDelay - attribute - feature: SYSMON: new reading 'cpu_model_name' - feature: FB_CALLMONITOR: new set command rereadCache diff --git a/fhem/FHEM/55_GDS.pm b/fhem/FHEM/55_GDS.pm index a3942dd16..d00ec63cb 100644 --- a/fhem/FHEM/55_GDS.pm +++ b/fhem/FHEM/55_GDS.pm @@ -683,7 +683,7 @@ sub decodeCAPData($$$){ $readings{"a_".$anum."_effective"} = $alertsXml->{info}[$info]{effective} if($_gdsAll); $readings{"a_".$anum."_onset"} = $alertsXml->{info}[$info]{onset}; $readings{"a_".$anum."_expires"} = $alertsXml->{info}[$info]{expires}; - $readings{"a_".$anum."_valid"} = checkCAPValid($readings{"a_".$anum."_expires"}); + $readings{"a_".$anum."_valid"} = checkCAPValid($readings{"a_".$anum."_onset"},$readings{"a_".$anum."_expires"}); $readings{"a_".$anum."_onset_local"} = capTrans($readings{"a_".$anum."_onset"}); $readings{"a_".$anum."_expires_local"} = capTrans($readings{"a_".$anum."_expires"}); $readings{"a_".$anum."_sent_local"} = capTrans($readings{"a_".$anum."_sent"}); @@ -740,14 +740,21 @@ sub decodeCAPData($$$){ # return (12-$gt[2]); # } -sub checkCAPValid($){ - my ($expires) = @_; +sub checkCAPValid($$){ + my ($onset,$expires) = @_; my $valid = 0; my $offset = _calctz(time,localtime(time))*3600; # used from 99_SUNRISE_EL + my $t = (time - $offset); + + $onset =~ s/T/ /; + $onset =~ s/\+/ \+/; + $onset = time_str2num($onset); + $expires =~ s/T/ /; $expires =~ s/\+/ \+/; $expires = time_str2num($expires); - $valid = 1 if($expires gt (time-$offset)); + + $valid = 1 if($onset lt $t && $expires gt $t); return $valid; } @@ -1317,6 +1324,8 @@ sub gdsHeadlines($;$) { # # 2015-01-30 changed use own FWEXT instead of HTTPSRV # +# 2015-04-07 fixed a_X_valid calculation: use onset, too +# #################################################################################################### # # Further informations