diff --git a/fhem/CHANGED b/fhem/CHANGED index da7aef9c5..4bb856607 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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 diff --git a/fhem/FHEM/38_netatmo.pm b/fhem/FHEM/38_netatmo.pm index ae5fa5706..d0a5431ef 100644 --- a/fhem/FHEM/38_netatmo.pm +++ b/fhem/FHEM/38_netatmo.pm @@ -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);