From e2b4fa322dc6af6ad9c5b48fc6e929f6a6510523 Mon Sep 17 00:00:00 2001 From: betateilchen Date: Mon, 14 Dec 2015 22:18:27 +0000 Subject: [PATCH] 55_GDS.pm: fixed empty stations list git-svn-id: https://svn.fhem.de/fhem/trunk@10176 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/55_GDS.pm | 49 ++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/fhem/FHEM/55_GDS.pm b/fhem/FHEM/55_GDS.pm index 893c86412..7bba8f75b 100644 --- a/fhem/FHEM/55_GDS.pm +++ b/fhem/FHEM/55_GDS.pm @@ -42,8 +42,6 @@ use Archive::Extract; use Net::FTP; use XML::Simple; -use Data::Dumper; - eval "use GDSweblink"; no if $] >= 5.017011, warnings => 'experimental'; @@ -301,7 +299,7 @@ sub GDS_Define($$$) { Log3($name, 4, "GDS $name: tempDir=".$tempDir); _GDS_addExtension("GDS_CGI","gds","GDS Files"); - + retrieveData($hash,'conditions'); readingsSingleUpdate($hash, 'state', 'active',1); return undef; @@ -419,7 +417,6 @@ sub GDS_Get($@) { "conditionsmap:".$cmapList." ". "forecasts:".$fcList." ". "forecastsmap:".$fmapList." ". - "headlines ". "radarmap:".$cmapList." ". "warningsmap:"."Deutschland,Bodensee,".$bulaList." ". "warnings:".$bulaList; @@ -457,12 +454,6 @@ sub GDS_Get($@) { break; } - when("headlines"){ - return "Error: Alerts disabled by attribute." unless AttrVal($name,'gdsUseAlerts',0); - $parameter //= "|"; - return gdsAlertsHeadlines($name,$parameter); - } - when("warningsmap"){ # retrieve map: warnings if(length($parameter) != 2){ @@ -533,6 +524,12 @@ sub GDS_Get($@) { break; } + when("headlines"){ + return "Error: Alerts disabled by attribute." unless AttrVal($name,'gdsUseAlerts',0); + $result = gdsHeadlines($name); + break; + } + when("conditions"){ getConditions($hash, "g", @a); break; @@ -807,7 +804,7 @@ sub __GDS_HTMLTail { # # Tools -sub gdsAlertsHeadlines($;$) { +sub gdsHeadlines($;$) { my ($d,$sep) = @_; my $text = ""; $sep = (defined($sep)) ? $sep : '|'; @@ -819,12 +816,6 @@ sub gdsAlertsHeadlines($;$) { return $text; } -sub gdsHeadlines($;$) { - my $text = "GDS error: gdsHeadlines() is deprecated. Please use gdsAlertsHeadlines()"; - Log 1, $text; - return $text; -} - sub setHelp(){ return "Use one of the following commands:\n". sepLine(35)."\n". @@ -1318,6 +1309,7 @@ sub _finishedCONDITIONS { $hash->{GDS_CONDITIONS_READ} = int(time()); my $cf = AttrVal($name,'gdsSetCond',0); + return unless $cf; # GDS_GetUpdate($hash,1) if $cf; my @b; push @b, undef; @@ -1885,7 +1877,6 @@ sub getListForecastStations($) { eval { foreach my $region (@regions) { - $data = ""; my $areaAndTime = 'Daten_'.$region.'_morgen_spaet'; while(($k, $v) = each %allForecastData){ if ($k eq $areaAndTime) { @@ -1926,8 +1917,7 @@ sub getListForecastStations($) { # ################################################################################################### # -# 2015-11-26 fixed wrong region handling -# added gdsAlertsHeadlines() +# 2015-12-14 fixed empty stations list #45633 # # 2015-11-17 changed decodeCAPData - fix wrong cumulation (first try) # fixed minor bugs @@ -2130,7 +2120,7 @@ sub getListForecastStations($) {
Module uses following additional Perl modules:

- Net::FTP, XML::Simple, Archive::Extract

+ Net::FTP, XML::Simple

If not already installed in your environment, please install them using appropriate commands from your environment. @@ -2209,25 +2199,24 @@ sub getListForecastStations($) {
- get <name> conditionsmap <region> -

- -
- get <name> forecasts <region>


+ get <name> conditionsmap <region> +

+ +
+ get <name> forecastsmap <stationName>


- get <name> headlines [separator] + get <name> headlines

- +
get <name> help @@ -2337,7 +2326,7 @@ sub getListForecastStations($) {