mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
73_GardenaSmartBridge: fix rename passwordstore bug
git-svn-id: https://svn.fhem.de/fhem/trunk@21292 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ef703ae5ba
commit
bdc73be463
@ -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.
|
||||||
|
- bugfix: 73_GardenaSmartBridge: fix rename passwordstore bug
|
||||||
- feature: 73_WaterCalculator: New Attribute DecimalPlace
|
- feature: 73_WaterCalculator: New Attribute DecimalPlace
|
||||||
- feature: 73_GasCalculator: New Attribute DecimalPlace
|
- feature: 73_GasCalculator: New Attribute DecimalPlace
|
||||||
- feature: 73_ElectricityCalculator: New Attribute DecimalPlace
|
- feature: 73_ElectricityCalculator: New Attribute DecimalPlace
|
||||||
|
@ -423,7 +423,7 @@ sub Set($@) {
|
|||||||
return "please set Attribut gardenaAccountEmail first"
|
return "please set Attribut gardenaAccountEmail first"
|
||||||
if ( AttrVal( $name, 'gardenaAccountEmail', 'none' ) eq 'none' );
|
if ( AttrVal( $name, 'gardenaAccountEmail', 'none' ) eq 'none' );
|
||||||
return "please set gardenaAccountPassword first"
|
return "please set gardenaAccountPassword first"
|
||||||
if ( not defined( ReadPassword($hash) ) );
|
if ( not defined( ReadPassword($hash,$name) ) );
|
||||||
return "token is up to date"
|
return "token is up to date"
|
||||||
if ( defined( $hash->{helper}{session_id} ) );
|
if ( defined( $hash->{helper}{session_id} ) );
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ sub Set($@) {
|
|||||||
return "usage: $cmd <password>" if ( @args != 1 );
|
return "usage: $cmd <password>" if ( @args != 1 );
|
||||||
|
|
||||||
my $passwd = join( ' ', @args );
|
my $passwd = join( ' ', @args );
|
||||||
StorePassword( $hash, $passwd );
|
StorePassword( $hash, $name, $passwd );
|
||||||
|
|
||||||
}
|
}
|
||||||
elsif ( lc $cmd eq 'deleteaccountpassword' ) {
|
elsif ( lc $cmd eq 'deleteaccountpassword' ) {
|
||||||
@ -448,11 +448,11 @@ sub Set($@) {
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
my $list = "getDevicesState:noArg getToken:noArg"
|
my $list = "getDevicesState:noArg getToken:noArg"
|
||||||
if ( defined( ReadPassword($hash) ) );
|
if ( defined( ReadPassword($hash,$name) ) );
|
||||||
$list .= " gardenaAccountPassword"
|
$list .= " gardenaAccountPassword"
|
||||||
if ( not defined( ReadPassword($hash) ) );
|
if ( not defined( ReadPassword($hash,$name) ) );
|
||||||
$list .= " deleteAccountPassword:noArg"
|
$list .= " deleteAccountPassword:noArg"
|
||||||
if ( defined( ReadPassword($hash) ) );
|
if ( defined( ReadPassword($hash,$name) ) );
|
||||||
return "Unknown argument $cmd, choose one of $list";
|
return "Unknown argument $cmd, choose one of $list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,7 +950,7 @@ sub getToken($) {
|
|||||||
if ( AttrVal( $name, 'gardenaAccountEmail', 'none' ) eq 'none' );
|
if ( AttrVal( $name, 'gardenaAccountEmail', 'none' ) eq 'none' );
|
||||||
return readingsSingleUpdate( $hash, 'state',
|
return readingsSingleUpdate( $hash, 'state',
|
||||||
'please set gardena account password first', 1 )
|
'please set gardena account password first', 1 )
|
||||||
if ( not defined( ReadPassword($hash) ) );
|
if ( not defined( ReadPassword($hash,$name) ) );
|
||||||
readingsSingleUpdate( $hash, 'state', 'get token', 1 );
|
readingsSingleUpdate( $hash, 'state', 'get token', 1 );
|
||||||
|
|
||||||
delete $hash->{helper}{session_id}
|
delete $hash->{helper}{session_id}
|
||||||
@ -967,7 +967,7 @@ sub getToken($) {
|
|||||||
'"sessions": {"email": "'
|
'"sessions": {"email": "'
|
||||||
. AttrVal( $name, 'gardenaAccountEmail', 'none' )
|
. AttrVal( $name, 'gardenaAccountEmail', 'none' )
|
||||||
. '","password": "'
|
. '","password": "'
|
||||||
. ReadPassword($hash) . '"}',
|
. ReadPassword($hash,$name) . '"}',
|
||||||
undef,
|
undef,
|
||||||
undef
|
undef
|
||||||
);
|
);
|
||||||
@ -976,10 +976,10 @@ sub getToken($) {
|
|||||||
"GardenaSmartBridge ($name) - send credentials to fetch Token and locationId";
|
"GardenaSmartBridge ($name) - send credentials to fetch Token and locationId";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub StorePassword($$) {
|
sub StorePassword($@) {
|
||||||
|
|
||||||
my ( $hash, $password ) = @_;
|
my ( $hash, $name, $password ) = @_;
|
||||||
my $index = $hash->{TYPE} . "_" . $hash->{NAME} . "_passwd";
|
my $index = $hash->{TYPE} . "_" . $name . "_passwd";
|
||||||
my $key = getUniqueId() . $index;
|
my $key = getUniqueId() . $index;
|
||||||
my $enc_pwd = "";
|
my $enc_pwd = "";
|
||||||
|
|
||||||
@ -1002,11 +1002,10 @@ sub StorePassword($$) {
|
|||||||
return "password successfully saved";
|
return "password successfully saved";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub ReadPassword($) {
|
sub ReadPassword($$) {
|
||||||
|
|
||||||
my ($hash) = @_;
|
my ( $hash, $name ) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $index = $hash->{TYPE} . "_" . $name . "_passwd";
|
||||||
my $index = $hash->{TYPE} . "_" . $hash->{NAME} . "_passwd";
|
|
||||||
my $key = getUniqueId() . $index;
|
my $key = getUniqueId() . $index;
|
||||||
my ( $password, $err );
|
my ( $password, $err );
|
||||||
|
|
||||||
@ -1052,8 +1051,8 @@ sub Rename(@) {
|
|||||||
|
|
||||||
my ( $new, $old ) = @_;
|
my ( $new, $old ) = @_;
|
||||||
my $hash = $defs{$new};
|
my $hash = $defs{$new};
|
||||||
|
|
||||||
StorePassword( $hash, ReadPassword($hash) );
|
StorePassword( $hash, $new, ReadPassword($hash,$old) );
|
||||||
setKeyValue( $hash->{TYPE} . "_" . $old . "_passwd", undef );
|
setKeyValue( $hash->{TYPE} . "_" . $old . "_passwd", undef );
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
|
@ -66,7 +66,7 @@ use warnings;
|
|||||||
use POSIX;
|
use POSIX;
|
||||||
use FHEM::Meta;
|
use FHEM::Meta;
|
||||||
use Time::Local;
|
use Time::Local;
|
||||||
our $VERSION = '1.6.5';
|
our $VERSION = '1.6.6';
|
||||||
|
|
||||||
# try to use JSON::MaybeXS wrapper
|
# try to use JSON::MaybeXS wrapper
|
||||||
# for chance of better performance + open code
|
# for chance of better performance + open code
|
||||||
@ -629,7 +629,7 @@ sub WriteReadings($$) {
|
|||||||
readingsBulkUpdate(
|
readingsBulkUpdate(
|
||||||
$hash, 'state',
|
$hash, 'state',
|
||||||
(
|
(
|
||||||
ReadingsVal( $name, 'outlet-valve_open', 'readingsValError' ) == 1
|
ReadingsVal( $name, 'outlet-valve_open', 0 ) == 1
|
||||||
? RigRadingsValue( $hash, 'open' )
|
? RigRadingsValue( $hash, 'open' )
|
||||||
: RigRadingsValue( $hash, 'closed' )
|
: RigRadingsValue( $hash, 'closed' )
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user