Rate Limit?

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
fduval_netatmo
Posts: 160
Joined: 27 Nov 2013, 09:22

Re: Rate Limit?

Post by fduval_netatmo » 07 May 2014, 19:23

cmikula : Can you send us your app name or your client_id for us to investigate on your app ?

thanks
Fabien - Netatmo team

cmikula
Posts: 4
Joined: 07 May 2014, 18:40

Re: Rate Limit?

Post by cmikula » 07 May 2014, 19:43

App-Name: enigma2-netatmo
ClientID: 517e9f21187759727300000c

eedomus_support
Posts: 1
Joined: 09 May 2014, 11:33

Re: Rate Limit?

Post by eedomus_support » 09 May 2014, 12:09

Hi,

we're facing a similar issue with our app "Netatmo for eedomus" (533056ba1b77591379f33ef8)

API polling is done each 10 minutes and many users are facing the "Application usage reached" message.
Do you confirm that the message is the same whereas the usage is reached globally by the app or locally by the user ?

Best regards

paqueuc
Posts: 5
Joined: 11 Apr 2014, 22:32

Re: Rate Limit?

Post by paqueuc » 22 May 2014, 21:21

Hello,

And do you confirm that if my script (not written by me) doesn't show error but brings back an empty file (9 times on 10 tries :cry: ), it is due to the same rate limit ?

The script refreshes every 10 minutes. I am the only user. Can you remove it, please ?

App name : LOXONE-PAC
Client id : 5377de6b1c7759239a7730a2

Thanks,

fduval_netatmo
Posts: 160
Joined: 27 Nov 2013, 09:22

Re: Rate Limit?

Post by fduval_netatmo » 23 May 2014, 09:30

Paqueuc,
- Your application has only one user, but if you make requests every 10 min, you should not reach the rate limit.
- What is your script, does it handles all kind of errors?

regards
Last edited by fduval_netatmo on 28 May 2014, 10:13, edited 1 time in total.
Fabien - Netatmo team

paqueuc
Posts: 5
Joined: 11 Apr 2014, 22:32

Re: Rate Limit?

Post by paqueuc » 28 May 2014, 08:03

Hello Fduval :

Here is the script I use on a Synology NAS (not my copyright) :

Code: Select all

<?php

// Script développé par Cédric Locqueneux. http://maison-et-domotique.com
// Synthase: http://www.maison-et-domotique.com/scripts/netatmo.php?login=VOTRE_EMAIL&password=MOTDEPASSE

$password=$_GET['password'];
$username=$_GET['login'];

if (isset($_GET['box']))
{
    $box=$_GET['box'];
}

$app_id = 'XXXXXXXXXXXXXXXXXX (given by Netatmo';
$app_secret = 'YYYYYYYYYYYYYYY (given by Netatmo)';

$token_url = "https://api.netatmo.net/oauth2/token";
$postdata = http_build_query(
        array(
            'grant_type' => "password",
            'client_id' => $app_id,
            'client_secret' => $app_secret,
            'username' => $username,
            'password' => $password
    )
);

$opts = array('http' =>
	array(
		'method'  => 'POST',
		'header'  => 'Content-type: application/x-www-form-urlencoded',
		'content' => $postdata
	)
);

$context  = stream_context_create($opts);
$response = file_get_contents($token_url, false, $context);

$params = null;
$params = json_decode($response, true);
$api_url = "https://api.netatmo.net/api/getuser?access_token=" . $params['access_token'];
$requete = @file_get_contents($api_url);

$url_devices = "https://api.netatmo.net/api/devicelist?access_token=" .  $params['access_token'];
$resulat_device = @file_get_contents($url_devices);	

$json_devices = json_decode($resulat_device,true);
$module_interne = $json_devices["body"]["devices"][0]["_id"];
$module_externe = $json_devices["body"]["modules"][0]["_id"];
$module_additionnel1 = $json_devices["body"]["modules"][1]["_id"];
$module_additionnel2 = $json_devices["body"]["modules"][2]["_id"];
$module_additionnel3 = $json_devices["body"]["modules"][3]["_id"];

$url_mesures_internes = "https://api.netatmo.net/api/getmeasure?access_token=" .  $params['access_token'] . "&device_id=" . $module_interne . "&scale=max&type=Temperature,CO2,Humidity,Pressure,Noise&date_end=last";
$mesures_internes = @file_get_contents($url_mesures_internes);

$url_mesures_externes = "https://api.netatmo.net/api/getmeasure?access_token=" .  $params['access_token'] . "&device_id=" . $module_interne . "&module_id=" . $module_externe . "&scale=max&type=Temperature,Humidity&date_end=last";
$mesures_externes = @file_get_contents($url_mesures_externes);

if (!empty($module_additionnel1)) {
	$url_mesures_additionnel1 = "https://api.netatmo.net/api/getmeasure?access_token=" .  $params['access_token'] . "&device_id=" . $module_interne . "&module_id=" . $module_additionnel1 . "&scale=max&type=Temperature,CO2,Humidity&date_end=last";
	$mesures_additionnel1 = file_get_contents($url_mesures_additionnel1);
	$json_mesures_additionnel1 = json_decode($mesures_additionnel1, true);
	$temperature_additionnel1 = $json_mesures_additionnel1["body"][0]["value"][0][0];
	$co2_additionnel1 = $json_mesures_additionnel1["body"][0]["value"][0][1];
	$humidite_additionnel1 = $json_mesures_additionnel1["body"][0]["value"][0][2];
}
if (!empty($module_additionnel2)) {
	$url_mesures_additionnel2 = "https://api.netatmo.net/api/getmeasure?access_token=" .  $params['access_token'] . "&device_id=" . $module_interne . "&module_id=" . $module_additionnel2 .  "&scale=max&type=Temperature,CO2,Humidity&date_end=last";
	$mesures_additionnel2 = file_get_contents($url_mesures_additionnel2);
	$json_mesures_additionnel2 = json_decode($mesures_additionnel2, true);
	$temperature_additionnel2 = $json_mesures_additionnel2["body"][0]["value"][0][0];
	$co2_additionnel2 = $json_mesures_additionnel2["body"][0]["value"][0][1];
	$humidite_additionnel2 = $json_mesures_additionnel2["body"][0]["value"][0][2];
}
if (!empty($module_additionnel3)) {
	$url_mesures_additionnel3 = "https://api.netatmo.net/api/getmeasure?access_token=" .  $params['access_token'] . "&device_id=" . $module_interne . "&module_id=" . $module_additionnel3 .  "&scale=max&type=Temperature,CO2,Humidity&date_end=last";
	$mesures_additionnel3 = file_get_contents($url_mesures_additionnel3);	
	$json_mesures_additionnel3 = json_decode($mesures_additionnel3, true);
	$temperature_additionnel3 = $json_mesures_additionnel3["body"][0]["value"][0][0];
	$co2_additionnel3 = $json_mesures_additionnel3["body"][0]["value"][0][1];
	$humidite_additionnel3 = $json_mesures_additionnel3["body"][0]["value"][0][2];
}	

$json_mesures_internes = json_decode($mesures_internes, true);
$json_mesures_externes = json_decode($mesures_externes, true);

$temperature_interne = $json_mesures_internes["body"][0]["value"][0][0];
$co2 = $json_mesures_internes["body"][0]["value"][0][1];
$humidite_interne = $json_mesures_internes["body"][0]["value"][0][2];
$pression = $json_mesures_internes["body"][0]["value"][0][3];
$bruit = $json_mesures_internes["body"][0]["value"][0][4];
$temperature_externe = $json_mesures_externes["body"][0]["value"][0][0];
$humidite_externe = $json_mesures_externes["body"][0]["value"][0][1];

if (isset($_GET['box']))
{
    switch ($box)
	{
	case 'zibase' :
		$temperature_interne = $temperature_interne * 10;
		$pression = $pression * 10;
		$temperature_externe = $temperature_externe * 10;
		if (!empty($module_additionnel1)) {
			$temperature_additionnel1 = $temperature_additionnel1 * 10;
		}
		if (!empty($module_additionnel2)) {
			$temperature_additionnel2 = $temperature_additionnel2 * 10;
		}
		if (!empty($module_additionnel3)) {
			$temperature_additionnel3 = $temperature_additionnel3 * 10;
		}
	  break;
	case 'eedomus' :
	  break;
	case 'vera' :
	  break;
	}
}

	echo '<?xml version="1.0" encoding="utf8" ?>';
	echo "<netatmo>";
	echo "<temperature_interieure>" . $temperature_interne  . "</temperature_interieure>";
	echo "<co2>" . $co2  . "</co2>";
	echo "<humidite_interieure>" . $humidite_interne  . "</humidite_interieure>";
	echo "<pression>" . $pression  . "</pression>";
	echo "<niveau_sonore>" . $bruit  . "</niveau_sonore>";
	echo "<temperature_exterieure>" . $temperature_externe  . "</temperature_exterieure>";	
 	echo "<humidite_exterieure>" . $humidite_externe  . "</humidite_exterieure>";
	if (!empty($module_additionnel1)) {
		echo "<temperature_additionnel1>" . $temperature_additionnel1  . "</temperature_additionnel1>";
		echo "<co2_additionnel1>" . $co2_additionnel1  . "</co2_additionnel1>";
		echo "<humidite_additionnel1>" . $humidite_additionnel1  . "</humidite_additionnel1>";
	}
	if (!empty($module_additionnel2)) {
		echo "<temperature_additionnel2>" . $temperature_additionnel2  . "</temperature_additionnel2>";
		echo "<co2_additionnel2>" . $co2_additionnel2  . "</co2_additionnel2>";
		echo "<humidite_additionnel2>" . $humidite_additionnel2  . "</humidite_additionnel2>";
	}
	if (!empty($module_additionnel3)) {
		echo "<temperature_additionnel3>" . $temperature_additionnel3  . "</temperature_additionnel3>";
		echo "<co2_additionnel3>" . $co2_additionnel3  . "</co2_additionnel3>";
		echo "<humidite_additionnel3>" . $humidite_additionnel3  . "</humidite_additionnel3>";	
	}
	echo "</netatmo>";
	
?>
When the script refreshes, I got this when it doesn't work :

Code: Select all

<?xml version="1.0" encoding="utf8" ?><netatmo><temperature_interieure></temperature_interieure><co2></co2><humidite_interieure></humidite_interieure><pression></pression><niveau_sonore></niveau_sonore><temperature_exterieure></temperature_exterieure><humidite_exterieure></humidite_exterieure></netatmo>
and this when it works :

Code: Select all

<?xml version="1.0" encoding="utf8" ?><netatmo><temperature_interieure>22.1</temperature_interieure><co2>659</co2><humidite_interieure>65</humidite_interieure><pression>1009</pression><niveau_sonore>46</niveau_sonore><temperature_exterieure>16.2</temperature_exterieure><humidite_exterieure>82</humidite_exterieure></netatmo>
So I don't really know what errors occur. I only know that I don't have the information back. And I found this thread... Is there a relation ?

Thanks for your help,

Regards,

fduval_netatmo
Posts: 160
Joined: 27 Nov 2013, 09:22

Re: Rate Limit?

Post by fduval_netatmo » 28 May 2014, 09:28

Your script suggests that all your requests are going well, that you have 3 additional modules and one external. Their position in the response is not checked or verified.
I suggest you rewrite it and consider the server responses to see in which request your error happens (Then, it will be much easier for you to debug it).

Regards,
Fabien - Netatmo team

wxstorm
Posts: 37
Joined: 17 Dec 2013, 14:49

Re: Rate Limit?

Post by wxstorm » 06 Jun 2014, 12:38

It looks like I have the same problem with the rate limit.

App-Name: MeteoWare Plus
Client-id: 52b0b6011b775986ebd74cac

Can you increase also my rate limit please?

Regards,
Christian

wxstorm
Posts: 37
Joined: 17 Dec 2013, 14:49

Re: Rate Limit?

Post by wxstorm » 24 Nov 2016, 18:15

wxstorm wrote:It looks like I have the same problem with the rate limit.

App-Name: MeteoWare Plus
Client-id: 52b0b6011b775986ebd74cac

Can you increase also my rate limit please?

Regards,
Christian
Are there IP-based restrictions? For several days now I can only download the data only partially.

PhilHornby
Posts: 83
Joined: 26 Oct 2016, 14:51
Location: Stockport, UK
Contact:

Re: Rate Limit?

Post by PhilHornby » 25 Nov 2016, 03:38

wxstorm wrote:Are there IP-based restrictions?
I think there are ... and I think they are much more restrictive than those published in the support documentation.

I've just started playing around with Thermometer API - my first experiment was to see if I could write a sensor for PRTG.

I got it working OK, but it doesn't stay working :( ... after about 7 hours, calls to the API just time out. Changing IP address (by mobile phone tethering, VPN or changing my Cable Modem MAC address) all make it start working again ... for another 7 hours. I'm calling the API at the rate of once every 5 minutes - well within the published limits.

Client id: 5824a4e77a757064b18c2ae0

Post Reply

Return to “Netatmo API”