From 0714cab33c1a05b3e5959205c45a4de69ac0ea07 Mon Sep 17 00:00:00 2001 From: moises <> Date: Sun, 7 Oct 2018 19:05:13 +0000 Subject: [PATCH] 38_netatmo: changed weathermap calls to new endpoints git-svn-id: https://svn.fhem.de/fhem/trunk@17485 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/38_netatmo.pm | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 08ebc1387..d1c470c47 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. + - change: 38_netatmo: changed weathermap calls to new endpoints - feature: 5.9 released - 2018-10-07 (5.9) diff --git a/fhem/FHEM/38_netatmo.pm b/fhem/FHEM/38_netatmo.pm index 51fe95137..4a1802ac3 100644 --- a/fhem/FHEM/38_netatmo.pm +++ b/fhem/FHEM/38_netatmo.pm @@ -902,6 +902,7 @@ netatmo_checkConnection($) my $name = $hash->{NAME}; return undef if($hash->{network} eq "ok"); + return undef if(!defined($hash->{access_token})); Log3 $name, 3, "$name: refreshing connection information"; @@ -1109,7 +1110,8 @@ netatmo_initDevice($) if(IsDisabled($name) || !defined($name)) { RemoveInternalTimer($hash); - $hash->{STATE} = "Disabled"; + #$hash->{STATE} = "Disabled"; + readingsSingleUpdate($hash, "active", "disabled", 1); return undef; } @@ -1186,7 +1188,8 @@ netatmo_initDevice($) if(IsDisabled($name) || !defined($name)) { RemoveInternalTimer($hash); - $hash->{STATE} = "Disabled"; + #$hash->{STATE} = "Disabled"; + readingsSingleUpdate($hash, "active", "disabled", 1); return undef; } @@ -1588,19 +1591,19 @@ netatmo_getPublicDevices($$;$$$$) if( $blocking ) { my($err,$data) = HttpUtils_BlockingGet({ - url => "https://".$iohash->{helper}{apiserver}."/api/getpublicdata", + url => "https://".$iohash->{helper}{apiserver}."/api/getpublicmeasures", timeout => 10, noshutdown => 1, - data => { access_token => $iohash->{access_token}, lat_ne => $lat_ne, lon_ne => $lon_ne, lat_sw => $lat_sw, lon_sw => $lon_sw }, + data => { access_token => $iohash->{access_token}, lat_ne => $lat_ne, lon_ne => $lon_ne, lat_sw => $lat_sw, lon_sw => $lon_sw, quality => 1, divider => 8, limit => 4, zoom => 10, date_end => 'last' }, }); return netatmo_dispatch( {hash=>$hash,type=>'publicdata'},$err,$data ); } else { HttpUtils_NonblockingGet({ - url => "https://".$iohash->{helper}{apiserver}."/api/getpublicdata", + url => "https://".$iohash->{helper}{apiserver}."/api/getpublicmeasures", timeout => 60, noshutdown => 1, - data => { access_token => $iohash->{access_token}, lat_ne => $lat_ne, lon_ne => $lon_ne, lat_sw => $lat_sw, lon_sw => $lon_sw, filter => 'true' }, + data => { access_token => $iohash->{access_token}, lat_ne => $lat_ne, lon_ne => $lon_ne, lat_sw => $lat_sw, lon_sw => $lon_sw, quality => 1, divider => 8, limit => 4, zoom => 10, date_end => 'last' }, hash => $hash, type => 'publicdata', callback => \&netatmo_dispatch, @@ -2542,7 +2545,8 @@ netatmo_poll($) if(IsDisabled($name) || !defined($name)) { RemoveInternalTimer($hash); - $hash->{STATE} = "Disabled"; + #$hash->{STATE} = "Disabled"; + readingsSingleUpdate($hash, "active", "disabled", 1); return undef; }