fixed token usage and refresh
This commit is contained in:
parent
1534939516
commit
5100a1c97b
@ -388,7 +388,7 @@ sub EaseeWallbox_LoadToken {
|
|||||||
. localtime($tokenLifeTime);
|
. localtime($tokenLifeTime);
|
||||||
|
|
||||||
# if token is about to expire, refresh him
|
# if token is about to expire, refresh him
|
||||||
if ( ( $tokenLifeTime - 45 ) < gettimeofday() ) {
|
if ( ( $tokenLifeTime - 3700 ) < gettimeofday() ) {
|
||||||
Log3 $name, 5,
|
Log3 $name, 5,
|
||||||
"EaseeWallbox $name" . ": "
|
"EaseeWallbox $name" . ": "
|
||||||
. "Token will expire soon, refreshing";
|
. "Token will expire soon, refreshing";
|
||||||
@ -449,7 +449,7 @@ sub EaseeWallbox_NewTokenRequest {
|
|||||||
# token lifetime management
|
# token lifetime management
|
||||||
if ( defined($decoded_data) ) {
|
if ( defined($decoded_data) ) {
|
||||||
$hash->{TOKEN_LIFETIME}
|
$hash->{TOKEN_LIFETIME}
|
||||||
= gettimeofday() + $decoded_data->{'expires_in'};
|
= gettimeofday() + $decoded_data->{'expiresIn'};
|
||||||
}
|
}
|
||||||
$hash->{TOKEN_LIFETIME_HR} = localtime( $hash->{TOKEN_LIFETIME} );
|
$hash->{TOKEN_LIFETIME_HR} = localtime( $hash->{TOKEN_LIFETIME} );
|
||||||
Log3 $name, 5,
|
Log3 $name, 5,
|
||||||
|
Loading…
Reference in New Issue
Block a user