mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
changed: logging optimized
git-svn-id: https://svn.fhem.de/fhem/trunk@3630 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
034d2f3c7c
commit
8cdea6fdf2
@ -6,7 +6,7 @@
|
||||
# An FHEM Perl module to retrieve data from "Deutscher Wetterdienst"
|
||||
#
|
||||
# Copyright: betateilchen ®
|
||||
# e-mail : fhem.development@betateilchen.de
|
||||
# e-mail: fhem.development@betateilchen.de
|
||||
#
|
||||
# This file is part of fhem.
|
||||
#
|
||||
@ -207,7 +207,7 @@ sub GDS_Define($$$) {
|
||||
my @a = split("[ \t][ \t]*", $def);
|
||||
|
||||
return "syntax: define <name> GDS <username> <password>" if(int(@a) != 4 );
|
||||
|
||||
my $name = $hash->{NAME};
|
||||
$hash->{helper}{USER} = $a[2];
|
||||
$hash->{helper}{PASS} = $a[3];
|
||||
$hash->{helper}{URL} = "ftp-outgoing2.dwd.de";
|
||||
@ -217,7 +217,7 @@ sub GDS_Define($$$) {
|
||||
$sList = getListStationsDropdown();
|
||||
retrieveFile($hash,"alerts");
|
||||
($aList, undef) = buildCAPList();
|
||||
|
||||
Log 3, "GDS $name created";
|
||||
$hash->{STATE} = "active";
|
||||
|
||||
return undef;
|
||||
@ -466,18 +466,18 @@ sub setHelp(){
|
||||
#
|
||||
|
||||
sub buildCAPList(){
|
||||
my $xml = new XML::Simple;
|
||||
$alertsXml = undef;
|
||||
$alertsXml = $xml->XMLin('/tmp/alerts', KeyAttr => {}, ForceArray => [ 'info', 'eventCode', 'area', 'geocode' ]);
|
||||
my $info = 0;
|
||||
my $area = 0;
|
||||
my $record = 0;
|
||||
my $n = 0;
|
||||
my $xml = new XML::Simple;
|
||||
$alertsXml = undef;
|
||||
$alertsXml = $xml->XMLin('/tmp/alerts', KeyAttr => {}, ForceArray => [ 'info', 'eventCode', 'area', 'geocode' ]);
|
||||
my $info = 0;
|
||||
my $area = 0;
|
||||
my $record = 0;
|
||||
my $n = 0;
|
||||
my ($capCity, $capCell, $capExit, @a, $list);
|
||||
|
||||
%capCityHash = ();
|
||||
%capCellHash = ();
|
||||
$aList = undef;
|
||||
%capCityHash = ();
|
||||
%capCellHash = ();
|
||||
$aList = undef;
|
||||
|
||||
while(1) {
|
||||
$area = 0;
|
||||
@ -508,9 +508,10 @@ sub buildCAPList(){
|
||||
|
||||
sub decodeCAPData($$){
|
||||
my ($hash, $datensatz) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $info = int($datensatz/100);
|
||||
my $area = $datensatz-$info*100;
|
||||
my $name = $hash->{NAME};
|
||||
my $loglevel = GetLogLevel($name,3);
|
||||
my $info = int($datensatz/100);
|
||||
my $area = $datensatz-$info*100;
|
||||
|
||||
my (%readings, @dummy, $i, $k, $n, $v, $t);
|
||||
|
||||
@ -519,6 +520,8 @@ sub decodeCAPData($$){
|
||||
my $_gdsLong = AttrVal($name,"gdsLong", 0);
|
||||
my $_gdsPolygon = AttrVal($name,"gdsPolygon", 0);
|
||||
|
||||
Log $loglevel, "GDS $name: Decoding CAP record #".$datensatz;
|
||||
|
||||
# topLevel informations
|
||||
@dummy = split(/\./, $alertsXml->{identifier});
|
||||
|
||||
@ -628,6 +631,7 @@ sub retrieveTextWarn($@){
|
||||
sub retrieveConditions($$@){
|
||||
my ($hash, $prefix, @a) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $loglevel = GetLogLevel($name,3);
|
||||
my $user = $hash->{helper}{USER};
|
||||
my $pass = $hash->{helper}{PASS};
|
||||
(my $myStation = utf8ToLatin1($a[2])) =~ s/_/ /g; # replace underscore in stationName by space
|
||||
@ -636,6 +640,8 @@ sub retrieveConditions($$@){
|
||||
my (%alignment, $dataFile, $decodeDummy, $debug, @files, $found, $ftp, $item, $line, %pos, %wx, $wx, %cread, $k, $v);
|
||||
|
||||
$debug = AttrVal($name, "gdsDebug", 0);
|
||||
|
||||
Log $loglevel, "GDS $name: Retrieving conditions data";
|
||||
|
||||
($dataFile, $found) = retrieveFile($hash,"conditions");
|
||||
open WXDATA, "/tmp/conditions";
|
||||
@ -697,6 +703,7 @@ sub retrieveFile($$;$){
|
||||
#
|
||||
my ($hash, $request, $parameter) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $loglevel = GetLogLevel($name,3);
|
||||
my $user = $hash->{helper}{USER};
|
||||
my $pass = $hash->{helper}{PASS};
|
||||
my $proxyName = AttrVal($name, "gdsProxyName", "");
|
||||
@ -731,6 +738,8 @@ sub retrieveFile($$;$){
|
||||
}
|
||||
}
|
||||
|
||||
Log $loglevel, "GDS $name: retrieving $dir".$dwd." from DWD server";
|
||||
|
||||
$found = 0;
|
||||
eval {
|
||||
$ftp = Net::FTP->new( "ftp-outgoing2.dwd.de",
|
||||
|
@ -1,27 +1,27 @@
|
||||
# $Id$
|
||||
##############################################################################
|
||||
#
|
||||
# 71_LISTENLIVE.pm
|
||||
# An FHEM Perl module for controlling ListenLive-enabled Mediaplayers
|
||||
# via network connection.
|
||||
# 71_LISTENLIVE.pm
|
||||
# An FHEM Perl module for controlling ListenLive-enabled Mediaplayers
|
||||
# via network connection.
|
||||
#
|
||||
# Copyright: betateilchen ®
|
||||
# e-mail : fhem.development@betateilchen.de
|
||||
# Copyright: betateilchen ®
|
||||
# e-mail: fhem.development@betateilchen.de
|
||||
#
|
||||
# This file is part of fhem.
|
||||
# This file is part of fhem.
|
||||
#
|
||||
# Fhem is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
# Fhem is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Fhem is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# Fhem is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
#
|
||||
|
@ -219,7 +219,7 @@ sub
|
||||
OWO_GetStatus($;$){
|
||||
my ($hash, $local) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $loglevel = AttrVal($name, "loglevel", 3);
|
||||
my $loglevel = GetLogLevel($name,3);
|
||||
$local = 0 unless(defined($local));
|
||||
|
||||
$attr{$name}{"owoInterval"} = 600 if(AttrVal($name,"owoInterval",0) < 600);
|
||||
@ -335,7 +335,7 @@ sub
|
||||
UpdateReadings($$$){
|
||||
my ($hash, $url, $prefix) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $loglevel = AttrVal($name, "loglevel", 3);
|
||||
my $loglevel = GetLogLevel($name,3);
|
||||
my ($jsonWeather, $response);
|
||||
$url .= "&APPID=".AttrVal($name, "owoApiKey", "");
|
||||
# $response = GetFileFromURL("$url");
|
||||
|
Loading…
Reference in New Issue
Block a user