2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

55_GDS.pm: fixed a_X_valid calculation

git-svn-id: https://svn.fhem.de/fhem/trunk@8396 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2015-04-07 19:07:00 +00:00
parent b15ce016cb
commit 9bbafdb386
2 changed files with 14 additions and 4 deletions

View File

@ -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: 55_GDS - use onset for a_X_valid calculation
- Bugfix: Update of set-command introducing ReadBackDelay - attribute - Bugfix: Update of set-command introducing ReadBackDelay - attribute
- feature: SYSMON: new reading 'cpu_model_name' - feature: SYSMON: new reading 'cpu_model_name'
- feature: FB_CALLMONITOR: new set command rereadCache - feature: FB_CALLMONITOR: new set command rereadCache

View File

@ -683,7 +683,7 @@ sub decodeCAPData($$$){
$readings{"a_".$anum."_effective"} = $alertsXml->{info}[$info]{effective} if($_gdsAll); $readings{"a_".$anum."_effective"} = $alertsXml->{info}[$info]{effective} if($_gdsAll);
$readings{"a_".$anum."_onset"} = $alertsXml->{info}[$info]{onset}; $readings{"a_".$anum."_onset"} = $alertsXml->{info}[$info]{onset};
$readings{"a_".$anum."_expires"} = $alertsXml->{info}[$info]{expires}; $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."_onset_local"} = capTrans($readings{"a_".$anum."_onset"});
$readings{"a_".$anum."_expires_local"} = capTrans($readings{"a_".$anum."_expires"}); $readings{"a_".$anum."_expires_local"} = capTrans($readings{"a_".$anum."_expires"});
$readings{"a_".$anum."_sent_local"} = capTrans($readings{"a_".$anum."_sent"}); $readings{"a_".$anum."_sent_local"} = capTrans($readings{"a_".$anum."_sent"});
@ -740,14 +740,21 @@ sub decodeCAPData($$$){
# return (12-$gt[2]); # return (12-$gt[2]);
# } # }
sub checkCAPValid($){ sub checkCAPValid($$){
my ($expires) = @_; my ($onset,$expires) = @_;
my $valid = 0; my $valid = 0;
my $offset = _calctz(time,localtime(time))*3600; # used from 99_SUNRISE_EL 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/T/ /;
$expires =~ s/\+/ \+/; $expires =~ s/\+/ \+/;
$expires = time_str2num($expires); $expires = time_str2num($expires);
$valid = 1 if($expires gt (time-$offset));
$valid = 1 if($onset lt $t && $expires gt $t);
return $valid; return $valid;
} }
@ -1317,6 +1324,8 @@ sub gdsHeadlines($;$) {
# #
# 2015-01-30 changed use own FWEXT instead of HTTPSRV # 2015-01-30 changed use own FWEXT instead of HTTPSRV
# #
# 2015-04-07 fixed a_X_valid calculation: use onset, too
#
#################################################################################################### ####################################################################################################
# #
# Further informations # Further informations