Re: Netatmo authentication changes Oct 2022
Posted: Wednesday 19 March 2025 15:28
Following my previous post, to be complete, I am on Domoticz Version: 2025.1 (build 16581)
Open source Home Automation System
https://forum.domoticz.com/
Code: Select all
2025-03-19 22:10:24.247 Status: Netatmo2: Use refresh token from database...
2025-03-19 22:10:24.247 Status: Netatmo2: Requesting refreshed tokens
2025-03-19 22:10:24.368 Error: Netatmo2: Invalid/no data received (refresh tokens)... HTTP/2 403
In the Beta we use thecadkey wrote: Wednesday 19 March 2025 22:24 I identified the problem. homestatus no longer works with a URL request as shown in netatmo.dev, only works with a cURL request like this one in PHP that I use via a class:
protected $_apiurl = 'https://api.netatmo.net/';
NO LONGER WORKS with URL request
public function getHomestatus()
{
$api_url = $this->_apiurl.'api/homestatus?home_id='.$this->_homeID.'&device_types=NLG&access_token='.$this->_accesstoken;
$response = @file_get_contents($api_url, false);
if ($response === false) return false;
$jsonDatas = json_decode($response, true);
return $jsonDatas['body']['home'];
}
WORKS with cURL request:
public function getHomestatus()
{
$author = 'Authorization: Bearer '.$this->_accesstoken;
$api_url = $this->_apiurl.'api/homestatus?home_id='.$this->_homeID.'&device_types=NLG';
$curl = curl_init($api_url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array('accept: application/json',$author,'Content-Type: application/json',);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
curl_close($curl);
if ($response === false) return false;
$jsonDatas = json_decode($response, true);
return $jsonDatas['body']['home'];
}
Adapt the code according to your use of a function or a class![]()
Code: Select all
#define NETATMO_API_URI "https://api.netatmo.com/"Do you see the yellow tekst in the Hardware Page ?DomoFlits wrote: Wednesday 19 March 2025 22:53 I am already logged in, so screen 2 and 3 are skipped with me.
Check with nslookup, api.netatmo.com and api.netatmo.net return the same IP addresses. I use both.homeJLB wrote: Wednesday 19 March 2025 23:29 In the Beta we use theas described by https://dev.netatmo.com/apidocumentation/oauthCode: Select all
#define NETATMO_API_URI "https://api.netatmo.com/"
Yes I have the yellow text (otherwise the button will be greyed out.)homeJLB wrote: Wednesday 19 March 2025 23:36Do you see the yellow tekst in the Hardware Page ?DomoFlits wrote: Wednesday 19 March 2025 22:53 I am already logged in, so screen 2 and 3 are skipped with me.
can you try to refresh your browser hardware page after enabling and then click the Login button when you see the yellow tekst.
Kind regards
I'm in the same position as @DomoFlits, I have followed your specific advice but cannot get past "Error: Netatmo: Invalid/no data received".homeJLB wrote: Wednesday 19 March 2025 21:42 When using the latest Beta, and disable the Netatmo Hardware.
Than re-enable the Hardware and you see the blocking Error...........
What version are you on? What was your solution?cadkey wrote: Thursday 20 March 2025 10:20 Issue fixed with Netatmo, both query methods are now functional again. Everything is back to normal.![]()