diff --git a/fhem/CHANGED b/fhem/CHANGED index aed3d01fe..f46b5a06f 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. + - change: 55_GDS.pm uses setKeyValue/getKeyValue for user credentials - feature: new module 52_I2C_BME280.pm added (klausw) - bugfix: 52_I2C_PCA9685: bugfix for interaction with FRM - change: 49_SSCAM: changed DEF in order to remove credentials from string, @@ -19,10 +20,6 @@ - feature: 49_SSCam: Attribute "httptimeout" added - feature: update is executed per default in the background - bugfix: FB_CALLLIST: fix "Use of uninitialized value" warnings on startup - - feature: *** 2016-01-17 - *** Do not worry about a lot of updates. Many modules were - *** modified only to support the new commandref mechanism for - *** automatic classification of helper and command modules. - change: 49_SSCam: Change of define-string related to rectime. Note: see all changes of rectime usage in commandref or in Forum: diff --git a/fhem/FHEM/55_GDS.pm b/fhem/FHEM/55_GDS.pm index 42995fb3f..38b0712d8 100644 --- a/fhem/FHEM/55_GDS.pm +++ b/fhem/FHEM/55_GDS.pm @@ -69,6 +69,7 @@ sub GDS_Initialize($) { $hash->{UndefFn} = "GDS_Undef"; $hash->{GetFn} = "GDS_Get"; $hash->{SetFn} = "GDS_Set"; + $hash->{RenameFn} = "GDS_Rename"; $hash->{ShutdownFn} = "GDS_Shutdown"; # $hash->{NotifyFn} = "GDS_Notify"; $hash->{NOTIFYDEV} = "global"; @@ -289,14 +290,23 @@ sub GDS_Define($$$) { my $name = $hash->{NAME}; my @a = split("[ \t][ \t]*", $def); - return "syntax: define GDS []" if(int(@a) != 4 ); -# return "You must not define more than one gds device!" if int(devspec2array('TYPE=GDS')); + my $skuser = getKeyValue($name."_user"); + my $skpass = getKeyValue($name."_pass"); + my $skhost = getKeyValue($name."_host"); + + unless(defined($skuser) && defined($skpass)) { + return "syntax: define GDS []" if(int(@a) < 4 ); + } - $hash->{helper}{USER} = $a[2]; - $hash->{helper}{PASS} = $a[3]; $hash->{helper}{URL} = defined($a[4]) ? $a[4] : "ftp-outgoing2.dwd.de"; $hash->{helper}{INTERVAL} = 1200; + setKeyValue($name."_user",$a[2]) unless(defined($skuser)); + setKeyValue($name."_pass",$a[3]) unless(defined($skpass)); + setKeyValue($name."_host",$hash->{helper}{URL}) unless(defined($skhost)); + + $hash->{DEF} = undef; + Log3($name, 4, "GDS $name: created"); Log3($name, 4, "GDS $name: tempDir=".$tempDir); @@ -315,6 +325,21 @@ sub GDS_Undef($$) { RemoveInternalTimer($hash); my $url = '/gds'; delete $data{FWEXT}{$url} if int(devspec2array('TYPE=GDS')) == 1; + setKeyValue($name."_user",undef); + setKeyValue($name."_pass",undef); + setKeyValue($name."_host",undef); + return undef; +} + +sub GDS_Rename() { + my ($new,$old) = @_; + setKeyValue($new."_user",getKeyValue($old."_user")); + setKeyValue($new."_pass",getKeyValue($old."_pass")); + setKeyValue($new."_host",getKeyValue($old."_host")); + + setKeyValue($old."_user",undef); + setKeyValue($old."_pass",undef); + setKeyValue($old."_host",undef); return undef; } @@ -1208,9 +1233,9 @@ sub retrieveData($$){ sub _retrieveFILE { my ($hash) = shift; my $name = $hash->{NAME}; - my $user = $hash->{helper}{USER}; - my $pass = $hash->{helper}{PASS}; - my $host = $hash->{helper}{URL}; + my $user = getKeyValue($name."_user"); + my $pass = getKeyValue($name."_pass"); + my $host = getKeyValue($name."_host"); my $proxyName = AttrVal($name, "gdsProxyName", ""); my $proxyType = AttrVal($name, "gdsProxyType", ""); my $passive = AttrVal($name, "gdsPassiveFtp", 1); @@ -1270,9 +1295,9 @@ sub _abortedFILE { sub _retrieveCONDITIONS { my ($hash) = shift; my $name = $hash->{NAME}; - my $user = $hash->{helper}{USER}; - my $pass = $hash->{helper}{PASS}; - my $host = $hash->{helper}{URL}; + my $user = getKeyValue($name."_user"); + my $pass = getKeyValue($name."_pass"); + my $host = getKeyValue($name."_host"); my $proxyName = AttrVal($name, "gdsProxyName", ""); my $proxyType = AttrVal($name, "gdsProxyType", ""); my $passive = AttrVal($name, "gdsPassiveFtp", 1); @@ -1359,9 +1384,9 @@ sub _abortedCONDITIONS { sub _retrieveCAPDATA { my ($hash) = shift; my $name = $hash->{NAME}; - my $user = $hash->{helper}{USER}; - my $pass = $hash->{helper}{PASS}; - my $host = $hash->{helper}{URL}; + my $user = getKeyValue($name."_user"); + my $pass = getKeyValue($name."_pass"); + my $host = getKeyValue($name."_host"); my $proxyName = AttrVal($name, "gdsProxyName", ""); my $proxyType = AttrVal($name, "gdsProxyType", ""); my $passive = AttrVal($name, "gdsPassiveFtp", 1); @@ -1584,9 +1609,9 @@ sub __findCAPWarnCellId($$){ sub _retrieveFORECAST { my ($hash) = shift; my $name = $hash->{NAME}; - my $user = $hash->{helper}{USER}; - my $pass = $hash->{helper}{PASS}; - my $host = $hash->{helper}{URL}; + my $user = getKeyValue($name."_user"); + my $pass = getKeyValue($name."_pass"); + my $host = getKeyValue($name."_host"); my $proxyName = AttrVal($name, "gdsProxyName", ""); my $proxyType = AttrVal($name, "gdsProxyType", ""); my $passive = AttrVal($name, "gdsPassiveFtp", 1); @@ -1939,6 +1964,8 @@ sub getListForecastStations($) { # ################################################################################################### # +# 2016-01-27 changed use setKeyValue/getKeyValue for username and password +# # 2016-01-01 fixed use txt file instead html for conditions (adopt DWD changes) # # 2015-12-31 fixed conditions retrieval on startup