Page 14 of 21

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 15:28
by wrietvel
Following my previous post, to be complete, I am on Domoticz Version: 2025.1 (build 16581)

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 17:39
by leef22
I made it work yesterday in the beta. After upgrade to build 16581, it's not working again and I can't make it work event after disabling and enabling after few hours - reauthentication or deleting and adding again. :( It ends with " Error: Netatmo: Invalid/no data received (refresh tokens)... HTTP/2 403 "

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 21:42
by homeJLB
When using the latest Beta, and disable the Netatmo Hardware.

Than re-enable the Hardware and you see the blocking Error
Also on the Hardware page when you select the Netatmo Hardware you see the Yellow message that the Tokens are not correct.

Then you click on the login button.

You will see a pop-up with the redirect to Netatmo authenthication and you must agree with the Connection from the App.

After this my setup is working with all my devices.

Also done this with a new installation.


kind regards

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 22:01
by homeJLB
So I to make the Login procedure clear;
Login 1.png
Login 1.png (27.17 KiB) Viewed 1069 times
Klik Login button
Login 2.png
Login 2.png (36.29 KiB) Viewed 1069 times
Give Login from Netatmo (E-mail and Password)

When correct you see a configuration Message;
Login 3.png
Login 3.png (26.09 KiB) Viewed 1069 times

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 22:02
by homeJLB
Then you get A confirmation Question;
Login 4.png
Login 4.png (30.92 KiB) Viewed 1068 times
you scroll to the bottom and click: "yes, I accept"
Login 5.png
Login 5.png (56.6 KiB) Viewed 1068 times

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 22:13
by DomoFlits
Great that if worked for you
unfortunately here I am still stuck (using beta 2025.1 build 16581)

Created a new app in dev.netatmo.com
In Domoticz I'v entered the Client ID and Client Secret and selected the weather station.
enabled the netatmo
used the login button.
Log says no:

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

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 22:24
by cadkey
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
Edit: Working again after Netatmo fixed the bug this morning

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 😉

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 22:25
by homeJLB
Do you get the 5 screens like I posted ?
You must first enable the Hardware and then you enter Client ID / Client Secret and select the correct scope for your device

If you make to much request on the server then your app gets blocked is my understanding.
So I recommend a 30 minutes disable the Netatmo Hardware

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 22:37
by homeJLB
This login procedure I have running on 16579 with docker and 16598 cloned from GitHub

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 22:53
by DomoFlits
I am already logged in, so screen 2 and 3 are skipped with me.

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 23:29
by homeJLB
cadkey 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 😉
In the Beta we use the

Code: Select all

#define NETATMO_API_URI "https://api.netatmo.com/"
as described by https://dev.netatmo.com/apidocumentation/oauth

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 19 March 2025 23:36
by homeJLB
DomoFlits wrote: Wednesday 19 March 2025 22:53 I am already logged in, so screen 2 and 3 are skipped with me.
Do you see the yellow tekst in the Hardware Page ?
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

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 20 March 2025 4:25
by cadkey
homeJLB wrote: Wednesday 19 March 2025 23:29 In the Beta we use the

Code: Select all

#define NETATMO_API_URI "https://api.netatmo.com/"
as described by https://dev.netatmo.com/apidocumentation/oauth
Check with nslookup, api.netatmo.com and api.netatmo.net return the same IP addresses. I use both.

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 20 March 2025 6:05
by DomoFlits
homeJLB wrote: Wednesday 19 March 2025 23:36
DomoFlits wrote: Wednesday 19 March 2025 22:53 I am already logged in, so screen 2 and 3 are skipped with me.
Do you see the yellow tekst in the Hardware Page ?
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
Yes I have the yellow text (otherwise the button will be greyed out.)

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 20 March 2025 10:20
by cadkey
Issue fixed with Netatmo, both query methods are now functional again. Everything is back to normal. 👍

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 20 March 2025 11:14
by dgilbert2
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...........
I'm in the same position as @DomoFlits, I have followed your specific advice but cannot get past "Error: Netatmo: Invalid/no data received".

Have you also experienced this particular error at some point?

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 20 March 2025 12:16
by leef22
cadkey wrote: Thursday 20 March 2025 10:20 Issue fixed with Netatmo, both query methods are now functional again. Everything is back to normal. 👍
What version are you on? What was your solution?
On beta 16581 all tries (remove and add, reauthenticate) ends with the same error " Error: Netatmo: Invalid/no data received (refresh tokens)... HTTP/2 403 " and the yellow message in the hardware page: tokens are invalid or expired. Funny is, the the beta version before seems to be running ok. :( Api.netatmo.com and api.netatmo.net resolve correctly to the same address.

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 20 March 2025 12:32
by phil35
Hi @cadkey :-)
hum no sure it was really fixed, as It doesn't work now, I checked twice
see my post dated "Tuesday 18 March 2025 16:59"
Phil

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 20 March 2025 14:09
by cadkey
@phil35
In PHP there are no more problems related to this failure.
I wasn't using a cURL query, I wrote the code yesterday and it worked directly, before this morning's fix. This morning's fix on the Netatmo side allowed my old URL query to work as before. I published my codes if it can help. I make calls to the API every minute and since I wrote the cURL query no errors, which is extremely rare with the homestatus query. At the same time I retested my URL query which was no longer working and it works since the Netatmo update this morning. In my opinion the API was modified yesterday morning, and only the URL query was bugged. For the cURL query I wrote it last night because I wasn't using it, and it worked without any problem by strictly following the homestatus API documentation. Check that you are strictly like the documentation, otherwise take my code with the cURL lines that you can adapt if you call a PHP function.
I only registered on this forum hoping to find a solution, as I don't use Domoticz. I suspected that the URL request could be problematic, so I searched on the cURL request side and posted the complete PHP code.
It is possible that the Netatmo API integration or plugin must be rewritten or modified in Domoticz. Ask the developer.

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 20 March 2025 16:20
by wrietvel
The new Netatmo login method as on 16581 stil does not work. Same problem as since Tuesday.