fixed token usage and refresh

This commit is contained in:
Matthias Sandmann 2022-03-17 10:13:09 +01:00
parent 1534939516
commit 5100a1c97b

View File

@ -388,7 +388,7 @@ sub EaseeWallbox_LoadToken {
. localtime($tokenLifeTime);
# if token is about to expire, refresh him
if ( ( $tokenLifeTime - 45 ) < gettimeofday() ) {
if ( ( $tokenLifeTime - 3700 ) < gettimeofday() ) {
Log3 $name, 5,
"EaseeWallbox $name" . ": "
. "Token will expire soon, refreshing";
@ -449,7 +449,7 @@ sub EaseeWallbox_NewTokenRequest {
# token lifetime management
if ( defined($decoded_data) ) {
$hash->{TOKEN_LIFETIME}
= gettimeofday() + $decoded_data->{'expires_in'};
= gettimeofday() + $decoded_data->{'expiresIn'};
}
$hash->{TOKEN_LIFETIME_HR} = localtime( $hash->{TOKEN_LIFETIME} );
Log3 $name, 5,