Netatmo authentication changes Oct 2022

Moderator: leecollings

homeJLB
Posts: 109
Joined: Tuesday 16 October 2018 23:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: Belgium
Contact:

Re: Netatmo authentication changes Oct 2022

Post by homeJLB »

I believe the problem is with some curl options, and my guess is the user-agent.

Code: Select all

void HTTPClient::SetGlobalOptions(void *curlobj)
{
	CURL *curl=(CURL *)curlobj;
	curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);
	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_curl_data);
	curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
	curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
	curl_easy_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, 1L);
	curl_easy_setopt(curl, CURLOPT_USERAGENT, m_sUserAgent.c_str());
	curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, m_iConnectionTimeout);
	curl_easy_setopt(curl, CURLOPT_TIMEOUT, m_iTimeout);
	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, m_bVerifyPeer ? 1L : 0);
	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, m_bVerifyHost ? 2L : 0); //allow self signed certificates
	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
	std::string domocookie = szUserDataFolder + "domocookie.txt";
	curl_easy_setopt(curl, CURLOPT_COOKIEFILE, domocookie.c_str());
	curl_easy_setopt(curl, CURLOPT_COOKIEJAR, domocookie.c_str());
}
chrominator
Posts: 19
Joined: Sunday 25 December 2016 7:27
Target OS: Linux
Domoticz version: 2024.7
Contact:

Re: Netatmo authentication changes Oct 2022

Post by chrominator »

Could be.

I've just compiled a version after having added a user agent, and it works fine (start/restart/reboot).
Since it is not the first time I compile a version that works first and fails after a while, I'll wait a bit before saying it's successful.
chrominator
Posts: 19
Joined: Sunday 25 December 2016 7:27
Target OS: Linux
Domoticz version: 2024.7
Contact:

Re: Netatmo authentication changes Oct 2022

Post by chrominator »

Still working....

Code: Select all

2025-04-05 10:21:58.050 Status: Netatmo: Requesting new access_token
2025-04-05 10:21:58.579 Status: Netatmo: HttpUrl: https://api.netatmo.com/oauth2/token?
2025-04-05 10:21:58.579 Status: Netatmo: HttpData: grant_type=refresh_token&refresh_token=58373dfakedata28d1de3|cab06etoken_refreshed59f45&client_id=67client_id6afa3&client_secret=PE0client_secretkn
2025-04-05 10:21:58.580 Status: Netatmo: ExtraHeaders: User-Agent: Domoticz/Version 2025.1 (build 16611)
2025-04-05 10:21:58.580 Status: Netatmo: ExtraHeaders: Content-Type: application/x-www-form-urlencoded;charset=UTF-8;
2025-04-05 10:21:58.581 Status: Netatmo: returnHeader: HTTP/2 200
2025-04-05 10:21:58.581 Status: Netatmo: returnHeader: date: Sat, 05 Apr 2025 08:21:58 GMT
2025-04-05 10:21:58.581 Status: Netatmo: returnHeader: content-type: application/json
2025-04-05 10:21:58.582 Status: Netatmo: returnHeader: cache-control: no-store
2025-04-05 10:21:58.582 Status: Netatmo: returnHeader: x-azure-ref: 20250405T082158Z-17dc6868955nc685hC1PRAzd480000000280000000006ra0
2025-04-05 10:21:58.583 Status: Netatmo: returnHeader: x-cache: CONFIG_NOCACHE
2025-04-05 10:21:58.583 Status: Netatmo: returnHeader:
2025-04-05 10:21:58.584 Status: Netatmo: We refreshed our token ...
2025-04-05 10:21:58.584 Status: Netatmo: Login 1
2025-04-05 10:21:58.585 Status: Netatmo: Get HomesData Details
2025-04-05 10:21:58.753 Status: Netatmo: Home id Thermostat updated.
2025-04-05 10:21:58.753 Status: Netatmo: Home Status Details, size (number of homes) is 1
2025-04-05 10:21:58.977 Netatmo: General/Percentage ( Thermostat - Bat. Lvl)
2025-04-05 10:21:58.986 Netatmo: Setpoint (Consigne Netatmo)
2025-04-05 10:21:58.998 Netatmo: Temp (Netatmo)
2025-04-05 10:21:59.001 Netatmo: Light/Switch (Chauffage)
2025-04-05 10:21:59.006 Netatmo: Light/Switch (Planning Thermostat)
2025-04-05 10:21:59.010 Netatmo: Light/Switch (Thermostat - Mode)
2025-04-05 10:21:59.013 Status: Netatmo: Parse Persons
2025-04-05 10:21:59.013 Status: Netatmo: HomeStatus parsed
2025-04-05 10:21:59.183 Status: Netatmo: Status 1
I think I will issue a PR. :D
jcb2
Posts: 34
Joined: Wednesday 04 January 2023 7:30
Target OS: Linux
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by jcb2 »

Hello,
Good news, thanks for your job !
chrominator
Posts: 19
Joined: Sunday 25 December 2016 7:27
Target OS: Linux
Domoticz version: 2024.7
Contact:

Re: Netatmo authentication changes Oct 2022

Post by chrominator »

PR issued.

Now we just have to keep our fingers crossed that it works for everyone.
cadkey
Posts: 14
Joined: Wednesday 19 March 2025 17:08
Target OS: Linux
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by cadkey »

chrominator wrote: Saturday 05 April 2025 9:34 I've just compiled a version after having added a user agent, and it works fine (start/restart/reboot).
Since it is not the first time I compile a version that works first and fails after a while, I'll wait a bit before saying it's successful.
https://github.com/domoticz/domoticz/is ... 2764622607
jcb2
Posts: 34
Joined: Wednesday 04 January 2023 7:30
Target OS: Linux
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by jcb2 »

Hello,
With the new beta 16619 of today it is ok for me.
I hope for future also :)
phil35
Posts: 21
Joined: Wednesday 02 September 2020 8:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: France
Contact:

Re: Netatmo authentication changes Oct 2022

Post by phil35 »

Hello,
When this beta will release as a stable version?
Thanks for the work done.
Phil
Production platform uses domoticz v2023.1
Production platform (for Netatmo and Zigbee) uses domoticz v2024.7
User avatar
waltervl
Posts: 5741
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Netatmo authentication changes Oct 2022

Post by waltervl »

As soon as you confirmed the betas are working for Netatmo....
If you are using Netatmo I would advise to use the latest beta as soon as possible. There is no other major issue in beta (other than in current stable....)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
jcb2
Posts: 34
Joined: Wednesday 04 January 2023 7:30
Target OS: Linux
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by jcb2 »

Hello,
Finnaly this new beta is not good for me:

Code: Select all

2025-04-08 07:32:13.758 Error: Météo: Error data ... url: https://api.netatmo.com/api/getstationsdata?&get_favorites=true&, response: {"error":{"code":3,"message":"Access token expired"}}
2025-04-08 07:32:13.925 Error: Météo: Error data ... url: https://api.netatmo.com/api/homesdata?&get_favorites=true&, response: {"error":{"code":3,"message":"Access token expired"}}
No luck

PS : after one restart, the connexion is ready.
Wimpi
Posts: 11
Joined: Sunday 07 January 2024 12:52
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Belgium
Contact:

Re: Netatmo authentication changes Oct 2022

Post by Wimpi »

After update to Version: 2025.1 (build 16626)

Netatmo works again, thanks!!! :D
cadkey
Posts: 14
Joined: Wednesday 19 March 2025 17:08
Target OS: Linux
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by cadkey »

Hello everyone.
I'm glad I could help the Domoticz community by proposing the header solution with user-agent:
https://github.com/domoticz/domoticz/is ... 2764622607
And taken up by @chrominator to make the PR. 👍
I don't know Domoticz, but I do know the Netatmo API.
Hopefully that was the only problem.
jcb2
Posts: 34
Joined: Wednesday 04 January 2023 7:30
Target OS: Linux
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by jcb2 »

Hello,
For me also OK with beta 16626 !
I hope for an long time :)

Thanks for your effort.
GJKNL
Posts: 41
Joined: Monday 31 October 2016 9:33
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by GJKNL »

Also updated to 16626. Netatmo works for a few hours, then I get
Error: Netatmo: Error data ... url: https://api.netatmo.com/api/getstations ... rites=true&, response: {
2025-04-09 15:43:03.991 "error": {
2025-04-09 15:43:03.991 "code": 3,
2025-04-09 15:43:03.991 "message": "Access token expired"
2025-04-09 15:43:03.991 }
2025-04-09 15:43:03.991 }
2025-04-09 15:43:04.146 Error: Netatmo: Error data ... url: https://api.netatmo.com/api/homesdata?& ... rites=true&, response: {
2025-04-09 15:43:04.146 "error": {
2025-04-09 15:43:04.146 "code": 3,
2025-04-09 15:43:04.146 "message": "Access token expired"
2025-04-09 15:43:04.146 }
2025-04-09 15:43:04.146 }
After updating Netatmo in Domoticz it starts working again for a few hours.
Did I miss something? I have read this threat a few times , but sometimes it is a bit acabadabra for me.
Wimpi
Posts: 11
Joined: Sunday 07 January 2024 12:52
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Belgium
Contact:

Re: Netatmo authentication changes Oct 2022

Post by Wimpi »

GJKNL wrote: Wednesday 09 April 2025 15:55 Also updated to 16626. Netatmo works for a few hours, then I get
Error: Netatmo: Error data ... url: https://api.netatmo.com/api/getstations ... rites=true&, response: {
2025-04-09 15:43:03.991 "error": {
2025-04-09 15:43:03.991 "code": 3,
2025-04-09 15:43:03.991 "message": "Access token expired"
2025-04-09 15:43:03.991 }
2025-04-09 15:43:03.991 }
2025-04-09 15:43:04.146 Error: Netatmo: Error data ... url: https://api.netatmo.com/api/homesdata?& ... rites=true&, response: {
2025-04-09 15:43:04.146 "error": {
2025-04-09 15:43:04.146 "code": 3,
2025-04-09 15:43:04.146 "message": "Access token expired"
2025-04-09 15:43:04.146 }
2025-04-09 15:43:04.146 }
After updating Netatmo in Domoticz it starts working again for a few hours.
Did I miss something? I have read this threat a few times , but sometimes it is a bit acabadabra for me.

Today the same problem …
Ik works for a couple of hours … and then the same problems
cadkey
Posts: 14
Joined: Wednesday 19 March 2025 17:08
Target OS: Linux
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by cadkey »

@JurgenLB fixed the issue here:
https://github.com/domoticz/domoticz/pull/6297
GJKNL
Posts: 41
Joined: Monday 31 October 2016 9:33
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by GJKNL »

For the time being, I added a data timeout of 30 mins in the Netatmo hardware. This seems to work for now.
jcb2
Posts: 34
Joined: Wednesday 04 January 2023 7:30
Target OS: Linux
Domoticz version:
Contact:

Re: Netatmo authentication changes Oct 2022

Post by jcb2 »

Hello,
I have also this new issue from this night.
One restart does not solve the issue.
Probably need to wait a little bit to retry.
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: Netatmo authentication changes Oct 2022

Post by sailmich »

cadkey wrote: Thursday 10 April 2025 0:23 @JurgenLB fixed the issue here:
https://github.com/domoticz/domoticz/pull/6297
Not for me. I'm on domoticz beta 16626. I always get errors after a couple of hours.
Spoiler: show

Code: Select all

 2025-04-15 14:11:13.036 Error: Netatmo: Error data ... url: https://api.netatmo.com/api/homesdata?&get_favorites=true&, response: {
2025-04-15 14:11:13.036 "error": {
2025-04-15 14:11:13.036 "code": 3,
2025-04-15 14:11:13.036 "message": "Access token expired" 
To get rid of it I do have to hit the update button for netatmo on domoticz hardware page.
Cheers
User avatar
waltervl
Posts: 5741
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Netatmo authentication changes Oct 2022

Post by waltervl »

@gizmocuz is a couple of weeks absent pull requests and beta builds have some delay.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest