2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-15 03:59:11 +00:00

38_netatmo: changed token refresh to internal reading

git-svn-id: https://svn.fhem.de/fhem/trunk@29116 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
moises 2024-08-28 08:14:37 +00:00
parent 2aa184b31a
commit 36512fd20f
2 changed files with 9 additions and 3 deletions

View File

@ -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
- bugfix: 38_netatmo: changed token refresh to internal reading
- feature: 70_PylonLowVoltage: new attr waitTimeBetweenRS485Cmd
- feature: 70_PylonLowVoltage: implement pylon groups
- bugfix: 36_Shelly.pm: reading 'ble' (bluetooth) fixed

View File

@ -11,7 +11,7 @@
#
#
##############################################################################
# Release 31 / 2024-06-17
# Release 32 / 2024-08-27
package main;
@ -824,7 +824,7 @@ netatmo_refreshToken($;$)
return undef if($hash->{helper}{last_refresh} > (gettimeofday()-30));
$hash->{helper}{last_refresh} = int(gettimeofday());
if( defined($hash->{access_token}) && defined($hash->{expires_at}) ) {
if( $nonblocking && defined($hash->{access_token}) && defined($hash->{expires_at}) ) {
my ($seconds) = gettimeofday();
return undef if( $seconds < $hash->{expires_at} - 600 );
}
@ -1051,7 +1051,12 @@ netatmo_connect($)
return undef if(IsDisabled($name) || !defined($name));
netatmo_getToken($hash);
if(defined(ReadingsVal($name, ".refreshtoken", undef))){
$hash->{helper}{refresh_token} = ReadingsVal($name, ".refreshtoken", undef);
$hash->{refresh_token} = ReadingsVal($name, ".refreshtoken", undef);
}
netatmo_refreshToken($hash);
#netatmo_getAppToken($hash);
InternalTimer(gettimeofday()+60+int(rand(60)), "netatmo_poll", $hash);