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

55_GDS.pm: restore really working version. Sorry for any inconveniences.

git-svn-id: https://svn.fhem.de/fhem/trunk@10223 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2015-12-21 18:29:12 +00:00
parent ebd5082102
commit 94e302eed1

View File

@ -42,6 +42,8 @@ use Archive::Extract;
use Net::FTP;
use XML::Simple;
use Data::Dumper;
eval "use GDSweblink";
no if $] >= 5.017011, warnings => 'experimental';
@ -417,6 +419,7 @@ sub GDS_Get($@) {
"conditionsmap:".$cmapList." ".
"forecasts:".$fcList." ".
"forecastsmap:".$fmapList." ".
"headlines ".
"radarmap:".$cmapList." ".
"warningsmap:"."Deutschland,Bodensee,".$bulaList." ".
"warnings:".$bulaList;
@ -454,6 +457,12 @@ 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){
@ -524,12 +533,6 @@ 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;
@ -804,7 +807,7 @@ sub __GDS_HTMLTail {
#
# Tools
sub gdsHeadlines($;$) {
sub gdsAlertsHeadlines($;$) {
my ($d,$sep) = @_;
my $text = "";
$sep = (defined($sep)) ? $sep : '|';
@ -816,6 +819,12 @@ sub gdsHeadlines($;$) {
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".
@ -959,7 +968,7 @@ sub getConditions($$@){
sub _readItem {
my ($line, $pos, $align, $item) = @_;
my $x;
Debug $line unless $align;
if ($align eq "l") {
$x = substr($line, $pos);
$x =~ s/ .+$//g; # after two spaces => next field
@ -1309,7 +1318,6 @@ 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;
@ -1877,6 +1885,7 @@ sub getListForecastStations($) {
eval {
foreach my $region (@regions) {
$data = "";
my $areaAndTime = 'Daten_'.$region.'_morgen_spaet';
while(($k, $v) = each %allForecastData){
if ($k eq $areaAndTime) {
@ -1917,7 +1926,8 @@ sub getListForecastStations($) {
#
###################################################################################################
#
# 2015-12-14 fixed empty stations list #45633
# 2015-11-26 fixed wrong region handling
# added gdsAlertsHeadlines()
#
# 2015-11-17 changed decodeCAPData - fix wrong cumulation (first try)
# fixed minor bugs
@ -2120,7 +2130,7 @@ sub getListForecastStations($) {
<br/>
Module uses following additional Perl modules:<br/><br/>
<code>Net::FTP, XML::Simple</code><br/><br/>
<code>Net::FTP, XML::Simple, Archive::Extract</code><br/><br/>
If not already installed in your environment,
please install them using appropriate commands from your environment.
@ -2199,24 +2209,25 @@ sub getListForecastStations($) {
<ul>Retrieve current conditions at selected station</ul>
<br/>
<code>get &lt;name&gt; forecasts &lt;region&gt;</code>
<br/><br/>
<ul>Retrieve forecasts for today and the following 3 days for selected region as text</ul>
<br/>
<code>get &lt;name&gt; conditionsmap &lt;region&gt;</code>
<br/><br/>
<ul>Retrieve map (imagefile) showing current conditions at selected station</ul>
<br/>
<code>get &lt;name&gt; forecasts &lt;region&gt;</code>
<br/><br/>
<ul>Retrieve forecasts for today and the following 3 days for selected region as text</ul>
<br/>
<code>get &lt;name&gt; forecastsmap &lt;stationName&gt;</code>
<br/><br/>
<ul>Retrieve map (imagefile) showing forecasts for selected region</ul>
<br/>
<code>get &lt;name&gt; headlines</code>
<code>get &lt;name&gt; headlines [separator]</code>
<br/><br/>
<ul>Returns a string, containing all alert headlines separated by |</ul>
<ul>Returns a string, containing all alert headlines. <br/>
Default separator is | but can be overriden.</ul>
<br/>
<code>get &lt;name&gt; help</code>
@ -2321,6 +2332,7 @@ sub getListForecastStations($) {
Readings will NOT be updated automatically</li>
</ul>
<br/><br/>
<b>Other events:</b>
<br/><br/>
<ul>
@ -2336,7 +2348,7 @@ sub getListForecastStations($) {
<ul>
<li>Module uses following additional Perl modules:<br/><br/>
<code>Net::FTP, XML::Simple</code><br/><br/>
<code>Net::FTP, XML::Simple, Archive::Extract</code><br/><br/>
If not already installed in your environment, please install them using appropriate commands from your environment.</li>
<br/><br/>
<li>Have fun!</li><br/>