2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

55_GDS.pm: use setKeyValue/getKeyValue for credentials

git-svn-id: https://svn.fhem.de/fhem/trunk@10644 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2016-01-27 15:58:51 +00:00
parent d5ed051fea
commit 007e5e29f2
2 changed files with 44 additions and 20 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.
- change: 55_GDS.pm uses setKeyValue/getKeyValue for user credentials
- feature: new module 52_I2C_BME280.pm added (klausw) - feature: new module 52_I2C_BME280.pm added (klausw)
- bugfix: 52_I2C_PCA9685: bugfix for interaction with FRM - bugfix: 52_I2C_PCA9685: bugfix for interaction with FRM
- change: 49_SSCAM: changed DEF in order to remove credentials from string, - change: 49_SSCAM: changed DEF in order to remove credentials from string,
@ -19,10 +20,6 @@
- feature: 49_SSCam: Attribute "httptimeout" added - feature: 49_SSCam: Attribute "httptimeout" added
- feature: update is executed per default in the background - feature: update is executed per default in the background
- bugfix: FB_CALLLIST: fix "Use of uninitialized value" warnings on startup - 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. - change: 49_SSCam: Change of define-string related to rectime.
Note: see all changes of rectime usage in commandref Note: see all changes of rectime usage in commandref
or in Forum: or in Forum:

View File

@ -69,6 +69,7 @@ sub GDS_Initialize($) {
$hash->{UndefFn} = "GDS_Undef"; $hash->{UndefFn} = "GDS_Undef";
$hash->{GetFn} = "GDS_Get"; $hash->{GetFn} = "GDS_Get";
$hash->{SetFn} = "GDS_Set"; $hash->{SetFn} = "GDS_Set";
$hash->{RenameFn} = "GDS_Rename";
$hash->{ShutdownFn} = "GDS_Shutdown"; $hash->{ShutdownFn} = "GDS_Shutdown";
# $hash->{NotifyFn} = "GDS_Notify"; # $hash->{NotifyFn} = "GDS_Notify";
$hash->{NOTIFYDEV} = "global"; $hash->{NOTIFYDEV} = "global";
@ -289,14 +290,23 @@ sub GDS_Define($$$) {
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my @a = split("[ \t][ \t]*", $def); my @a = split("[ \t][ \t]*", $def);
return "syntax: define <name> GDS <username> <password> [<host>]" if(int(@a) != 4 ); my $skuser = getKeyValue($name."_user");
# return "You must not define more than one gds device!" if int(devspec2array('TYPE=GDS')); my $skpass = getKeyValue($name."_pass");
my $skhost = getKeyValue($name."_host");
unless(defined($skuser) && defined($skpass)) {
return "syntax: define <name> GDS <username> <password> [<host>]" 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}{URL} = defined($a[4]) ? $a[4] : "ftp-outgoing2.dwd.de";
$hash->{helper}{INTERVAL} = 1200; $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: created");
Log3($name, 4, "GDS $name: tempDir=".$tempDir); Log3($name, 4, "GDS $name: tempDir=".$tempDir);
@ -315,6 +325,21 @@ sub GDS_Undef($$) {
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
my $url = '/gds'; my $url = '/gds';
delete $data{FWEXT}{$url} if int(devspec2array('TYPE=GDS')) == 1; 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; return undef;
} }
@ -1208,9 +1233,9 @@ sub retrieveData($$){
sub _retrieveFILE { sub _retrieveFILE {
my ($hash) = shift; my ($hash) = shift;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $user = $hash->{helper}{USER}; my $user = getKeyValue($name."_user");
my $pass = $hash->{helper}{PASS}; my $pass = getKeyValue($name."_pass");
my $host = $hash->{helper}{URL}; my $host = getKeyValue($name."_host");
my $proxyName = AttrVal($name, "gdsProxyName", ""); my $proxyName = AttrVal($name, "gdsProxyName", "");
my $proxyType = AttrVal($name, "gdsProxyType", ""); my $proxyType = AttrVal($name, "gdsProxyType", "");
my $passive = AttrVal($name, "gdsPassiveFtp", 1); my $passive = AttrVal($name, "gdsPassiveFtp", 1);
@ -1270,9 +1295,9 @@ sub _abortedFILE {
sub _retrieveCONDITIONS { sub _retrieveCONDITIONS {
my ($hash) = shift; my ($hash) = shift;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $user = $hash->{helper}{USER}; my $user = getKeyValue($name."_user");
my $pass = $hash->{helper}{PASS}; my $pass = getKeyValue($name."_pass");
my $host = $hash->{helper}{URL}; my $host = getKeyValue($name."_host");
my $proxyName = AttrVal($name, "gdsProxyName", ""); my $proxyName = AttrVal($name, "gdsProxyName", "");
my $proxyType = AttrVal($name, "gdsProxyType", ""); my $proxyType = AttrVal($name, "gdsProxyType", "");
my $passive = AttrVal($name, "gdsPassiveFtp", 1); my $passive = AttrVal($name, "gdsPassiveFtp", 1);
@ -1359,9 +1384,9 @@ sub _abortedCONDITIONS {
sub _retrieveCAPDATA { sub _retrieveCAPDATA {
my ($hash) = shift; my ($hash) = shift;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $user = $hash->{helper}{USER}; my $user = getKeyValue($name."_user");
my $pass = $hash->{helper}{PASS}; my $pass = getKeyValue($name."_pass");
my $host = $hash->{helper}{URL}; my $host = getKeyValue($name."_host");
my $proxyName = AttrVal($name, "gdsProxyName", ""); my $proxyName = AttrVal($name, "gdsProxyName", "");
my $proxyType = AttrVal($name, "gdsProxyType", ""); my $proxyType = AttrVal($name, "gdsProxyType", "");
my $passive = AttrVal($name, "gdsPassiveFtp", 1); my $passive = AttrVal($name, "gdsPassiveFtp", 1);
@ -1584,9 +1609,9 @@ sub __findCAPWarnCellId($$){
sub _retrieveFORECAST { sub _retrieveFORECAST {
my ($hash) = shift; my ($hash) = shift;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $user = $hash->{helper}{USER}; my $user = getKeyValue($name."_user");
my $pass = $hash->{helper}{PASS}; my $pass = getKeyValue($name."_pass");
my $host = $hash->{helper}{URL}; my $host = getKeyValue($name."_host");
my $proxyName = AttrVal($name, "gdsProxyName", ""); my $proxyName = AttrVal($name, "gdsProxyName", "");
my $proxyType = AttrVal($name, "gdsProxyType", ""); my $proxyType = AttrVal($name, "gdsProxyType", "");
my $passive = AttrVal($name, "gdsPassiveFtp", 1); 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) # 2016-01-01 fixed use txt file instead html for conditions (adopt DWD changes)
# #
# 2015-12-31 fixed conditions retrieval on startup # 2015-12-31 fixed conditions retrieval on startup