Page 19 of 21

Re: Netatmo authentication changes Oct 2022

Posted: Saturday 05 April 2025 1:05
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());
}

Re: Netatmo authentication changes Oct 2022

Posted: Saturday 05 April 2025 9:34
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.

Re: Netatmo authentication changes Oct 2022

Posted: Saturday 05 April 2025 10:27
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

Re: Netatmo authentication changes Oct 2022

Posted: Saturday 05 April 2025 13:04
by jcb2
Hello,
Good news, thanks for your job !

Re: Netatmo authentication changes Oct 2022

Posted: Saturday 05 April 2025 13:39
by chrominator
PR issued.

Now we just have to keep our fingers crossed that it works for everyone.

Re: Netatmo authentication changes Oct 2022

Posted: Saturday 05 April 2025 18:12
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

Re: Netatmo authentication changes Oct 2022

Posted: Monday 07 April 2025 12:32
by jcb2
Hello,
With the new beta 16619 of today it is ok for me.
I hope for future also :)

Re: Netatmo authentication changes Oct 2022

Posted: Monday 07 April 2025 20:59
by phil35
Hello,
When this beta will release as a stable version?
Thanks for the work done.
Phil

Re: Netatmo authentication changes Oct 2022

Posted: Monday 07 April 2025 21:04
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....)

Re: Netatmo authentication changes Oct 2022

Posted: Monday 07 April 2025 21:32
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.

Re: Netatmo authentication changes Oct 2022

Posted: Tuesday 08 April 2025 20:16
by Wimpi
After update to Version: 2025.1 (build 16626)

Netatmo works again, thanks!!! :D

Re: Netatmo authentication changes Oct 2022

Posted: Tuesday 08 April 2025 21:02
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.

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 09 April 2025 8:30
by jcb2
Hello,
For me also OK with beta 16626 !
I hope for an long time :)

Thanks for your effort.

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 09 April 2025 15:55
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.

Re: Netatmo authentication changes Oct 2022

Posted: Wednesday 09 April 2025 21:44
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

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 10 April 2025 0:23
by cadkey
@JurgenLB fixed the issue here:
https://github.com/domoticz/domoticz/pull/6297

Re: Netatmo authentication changes Oct 2022

Posted: Thursday 10 April 2025 12:08
by GJKNL
For the time being, I added a data timeout of 30 mins in the Netatmo hardware. This seems to work for now.

Re: Netatmo authentication changes Oct 2022

Posted: Friday 11 April 2025 9:13
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.

Re: Netatmo authentication changes Oct 2022

Posted: Tuesday 15 April 2025 14:32
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

Re: Netatmo authentication changes Oct 2022

Posted: Tuesday 15 April 2025 14:59
by waltervl
@gizmocuz is a couple of weeks absent pull requests and beta builds have some delay.