API /homesdata and /homestatus

mailpublic35

Hello,

I followed the documentation:
https://dev.netatmo.com/apidocumentation/control#homestatus
and
https://dev.netatmo.com/apidocumentation/control#homesdata

The schema to use is identical, so copy paste between the code,  except  the word homestatus to be replaced by homesdata.  The parameters gateway_types  or  device_types   are not used. I try basic request so only home_id

It works perfectly for homedata, however for homestatus the result is:

 Connection #0 to host api.netatmo.com left intact
array(1) {
 ["error"]=>
 array(2) {
   ["message"]=>
   string(55) "Unexpected token '-', "----------"... is not valid JSON"
   ["code"]=>
   int(400)
 }
}

The token is the same for both functions.
Any idea?
Thanks
Phil

0

Comments

66 comments

  • Comment author
    mailpublic35

    ok, 
    On my side, I'm decomissionning  Synology NAS.  
    Replaced by raspberry pi

    0
  • Comment author
    cadkey

    Hi @mailpublic35,
    I'm interested to know why you no longer use deconz in docker. Is there a forum where it is possible to discuss please? here we can only post public messages, no messaging between members :(

    0
  • Comment author
    mailpublic35

    Hello,
    I never use it in docker, yet.  I will not write never :-)  but as today it is not the case.
    Let you have a try here: https://forum.domoticz.com/

    0
  • Comment author
    cadkey

    Api homestatus command doesn't work since 10 am.
    Is this another server outage? Did you change the API without warning? Please let us know when something changes, again!!

    0
  • Comment author
    cadkey

    I generated a new client application, no changes, homestatus returns an empty json while refresh token is generated correctly. Only homedatas works 

    0
  • Comment author
    Leslie Community moderator

    Hello @cadkey,

    What is the error code received when you call /homestatus ? 

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    cadkey

    Ni error for refresh token

    Homesdatas json is good

    Homestatus json is empty, non error 

    Since more than 24 hours now

    0
  • Comment author
    cadkey
    • Edited

    refresh token is good since I get the json from homedatas. and for homestatus the json is empty as if the refreshtoken was not accepted. your api does not return me a correct response. it has worked for months, and since yesterday around 6:00 am, no more response from homestatus. I have three apps on the API. all three return the same empty json.

    0
  • Comment author
    Leslie Community moderator

    Can you check if you currently put the access_token value as URL parameter and not in the header of the /homestatus request ? (Bearer + access_token value)

    It seems that it's not accepted anymore since yesterday. I warned the developers about it and they are checking that

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    cadkey
    • Edited

    Same problem with your page https://dev.netatmo.com/apidocumentation/control#homestatus

    0
  • Comment author
    mailpublic35

    Hello Leslie,
    I read what you wrote:
    "Can you check if you currently put the access_token value as URL parameter and not in the header of the /homestatus request ? (Bearer + access_token value)
    It seems that it's not accepted anymore since yesterday. I warned the developers about it and they are checking that"

    That's very interesting .. as there a major problem with software domoticz since .. yesterday
    Have a look over there: https://forum.domoticz.com/viewtopic.php?p=324449, many users complain about.
    I do not changed anything on my side , see my post from phil35
    But now the message is : "Error: Netatmo: Invalid/no data received..."
    Should it be the reason why?
    Thanks
    Phil

    0
  • Comment author
    cadkey

    It's a shame. I've been strictly following the syntax explained in netatmo.dev for two years. It hasn't worked for over 24 hours. Even the tool in netatmo.dev no longer works. And of course, there's no information from netatmo, no updated documents, no alerts.

    0
  • Comment author
    cadkey
    • Edited

    If something has changed, post a valid example of a curl request and a valid example of a url request, that's the minimum. What are you playing at netatmo? Post working lines of curl and http code, not useless sentences.

    You make changes and you don't document anything. Seriously!

    Here are the two https requests I've been using for over two years and have always worked: for almost 48 hours the https homestatus request has stopped working. Please post the correct syntax in reply, if it exists, because I think you've broken the API for homestatus.

     

    https://api.netatmo.net/api/homesdata?access_token=5axxxxxxxxxxxxxxxxxxxxx41|4ce5yyyyyyyyyyyyyyyyyyyyyyyyyyyyyya8

    https://api.netatmo.net/api/homestatus?home_id=5ezzzzzzzzzzzzzzzzzz61&device_types=NLG&access_token=5axxxxxxxxxxxxxxxxxxxxx41|4ce5yyyyyyyyyyyyyyyyyyyyyyyyyyyyyya8

    0
  • Comment author
    cadkey
    • Edited

    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'];

    }

    0
  • Comment author
    Leslie Community moderator

    Hello,

    a fix was pushed to re-allow the access_token value as query parameter (it was a "simple" encoding problem)

    Can you please try and give me a feedback ?

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    cadkey

    Hello, I did a test that is still in progress, going back to my old code. It seems to work as before, with a cURL request and also with a URL request that no longer worked. Thanks. But please notify us of the changes, and publish the modifications, the API documentation on netatmo.dev has not been up to date for months.

    0
  • Comment author
    Leslie Community moderator

    Thanks for the feedback

    This was not a wanted change but a bug. We are currently doing infrastructure changes leading us at the end to have a better visibility over API calls by endpoints, by users, and by developer apps. It will be very helpful for teams - and for me - to investigate problems. These changes are supposed to be seamless, but this precise case they didn't correctly check the behaviour when the token is in query string

    Concerning the documentation there is an ongoing project to update it 

    @Phil, it could be linked to that. Can you please check ? The Domoticz forum seems down right now so I can't check here :(

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    mailpublic35

    Hello @Leslie,

    I checked twice ... nothing better, same result,  not working
    As I wrote before, nothing change on the hardware(pi) nothing change on the software (domoticz 2024.7),   It was not the first time, the pi was rebooted,  got a new key from api.netatmo.com,  filled up the field with the new code and let's go.  
    But since monday, It doesn't work anymore 

    2025-03-20 12:17:05.244 Status: Netatmo: Worker started...
    2025-03-20 12:17:10.598 Error: Netatmo: Invalid/no data received...
    ..
    2025-03-20 12:17:40.972 Error: Netatmo: Invalid/no data received...

    Phil
     
    0
  • Comment author
    cadkey
    • Edited

    Hello, Surprisingly, I modified my code yesterday to make a cURL request in accordance with the API documentation, because my URL request was no longer working. Since this morning, I have tested my two codes and everything works. I have no errors, which is rather rare these days on homestatus requests.

    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 Netatmo's side made my old URL query work as before.

    0
  • Comment author
    cadkey
    • Edited

    @Leslie

    Now homesdatas AND homestatus errors since 3:00 PM.

    code 21 invalid home_id from homestatus, normal because homesdatas doesn't work!

    So the problem is homesdatas. empty json response

    3:34 p.m. no more errors. Don't touch anything please!

    0
  • Comment author
    Leslie Community moderator

    @Phil, 

    I finally took a look at the Domoticz forum, it seems like redoing a clean /authorize request fixed the problem for some users but not all

    What I would advise : go to https://home.netatmo.com/ > Parameters > My account > Third-party app > choose the app linked to Domoticz > Revoke access

    I guess from the messages that there is also a devices deactivation feature, it could be good to do it also but I don't know what it really does

    Then, redo the linking process to Domoticz by following their procedure (the Netatmo pop-up to grant user's access and so on)

    It should launch a "fully clean" authentication process, maybe the problem comes from that

    If it's just this, the solution is pretty simple. Otherwise, I'll see with the Netatmo developers if they have more ideas. Fingers crossed !

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    cadkey
    • Edited

    Same errors since 4:00 PM. Can you read user messages or check when you make changes please? This is very annoying.

    And also answer if possible... thank you

    0
  • Comment author
    Leslie Community moderator

    @cadkey,

    We didn't push any modification today and I don't have any similar feedback. I see many 400 errors corresponding to your user id but for now I don't have more info. I asked the developers to help me decoding the logs 

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    cadkey
    • Edited

    OK thanks. And here we go again since 5 p.m., the same errors.

    Oddly enough, exactly the same times, from 4:00 PM to 4:34 PM and then from 5:00 PM to 5:34 PM, 6:00 PM to 6:34 PM. Errors on homesdatas, which returns an empty json.

    It looks like I'm exceeding the number of requests set by quotas, rather than an API or request issue. Did you change any quotas today? My number of requests hasn't changed.

    0
  • Comment author
    cadkey

    Hello @Leslie,

    I switched to the cadkeynetatmo3 app on my Netatmo account at 5:25 AM today and I no longer have any errors. I had the same normal result with cadkeynetatmo2 used previously. It worked fine for several hours and suddenly I had errors for about 30 minutes every hour. Let's see if the problem reoccurs.

    0
  • Comment author
    mailpublic35

    @Leslie, hello,

    I desactivated the current webapp
    I created a new webapp (client id = 67dd225c05f4c830c50c6172)
    I obtain the code,  put in domoticz, as usual but
    same result

    2025-03-21 09:27:44.487 Status: Netatmo: Worker stopped...
    2025-03-21 09:27:44.490 Status: Netatmo: Worker started...
    2025-03-21 09:27:49.806 Error: Netatmo: Invalid/no data received...

    Phil
    0
  • Comment author
    Leslie Community moderator

    Hello,

    @cadkey, indeed I see that for now you only have 200 OK responses. I have a training next Tuesday to learn how to better interpret the logs with the new deployed internal tool 

    "It looks like I'm exceeding the number of requests set by quotas, rather than an API or request issue." <= it looks like something like this, but it should show a 429 quota exceeded error in that case. We didn't change the max call rates, but put in place a system to enforce the declared quotas - previously in some cases it was possible to get over the requests limits - (https://health.netatmo.com/posts/details/PJ8FMS1, routes are migrated one by one since the 12 and the beginning of your problem corresponds to the day we migrated /homestatus). For now it seems stable for you, even if the number of calls is still 80 per hour. Maybe a specific problem with cadkeynetatmo2 app ? Anyway I'll see with the developers if it's not the case anymore 

     

    @Phil, the latest activity I have is the 19/03 at 19:47:20. After that, it seems that no calls are received by our servers (so, no response, not even a 400). I suspect something in the Domoticz code avoiding to correctly send the request. I don't know how it's done, but maybe a problem of simple/double quotes around the access_token value sent ? The invalid_grant error makes me think of this

    I'll check with the developers if there can be a process on our side that blocks the Domoticz app

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    mailpublic35

    Hello,
    @Leslie
    I have two process accessing netatmo servers:
    1/  a personal script shared on github to manage token, every three hours. It works as a charm

    2/ Domoticz to get mesures from netatmo devices (temperatures, rain ...)
    " I suspect something in the Domoticz code avoiding to correctly send the request." 
    ok, BUT nothing has changed on my side ,  no upgrade of domoticz, still version 2024.7
    From the domoticz view the latest correct update was on March 13th at 09:41:56AM
    I may sent you via https://dev.netatmo.com/contact-us-form  the IP source, if it can help / tell me

    .
    2025-03-21 11:59:22.239  Error: Netatmo: Invalid/no data received...
    2025-03-21 11:59:40.358  Status: Netatmo: Worker stopped...
    2025-03-21 11:59:40.359  Status: Netatmo: Worker started...
    2025-03-21 11:59:45.726  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:00:16.137  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:00:46.489  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:01:16.793  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:01:47.160  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:02:17.598  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:02:48.078  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:03:18.417  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:03:48.730  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:04:19.038  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:04:49.404  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:05:19.770  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:05:50.078  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:06:20.558  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:06:50.903  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:07:21.312  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:07:51.668  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:08:22.016  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:08:52.326  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:09:22.681  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:09:53.012  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:10:23.431  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:10:53.780  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:11:24.128  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:11:54.489  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:12:24.900  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:12:55.270  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:13:25.641  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:13:56.008  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:14:26.374  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:14:56.679  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:15:27.105  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:15:57.687  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:16:28.084  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:16:58.432  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:17:28.798  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:17:59.328  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:18:29.691  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:19:00.036  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:19:30.392  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:20:00.693  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:20:31.003  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:21:01.311  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:21:31.676  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:22:02.036  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:22:21.446  Status: Netatmo: Worker stopped...
    2025-03-21 12:22:21.447  Status: Netatmo: Worker started...
    2025-03-21 12:22:26.807  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:22:57.163  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:23:27.561  Error: Netatmo: Invalid/no data received...
    2025-03-21 12:23:57.936  Error: Netatmo: Invalid/no data received...






    0
  • Comment author
    cadkey

    @Leslie, thank you for your reply. I agree with you, I actually think I have no API problems since you fixed the bug yesterday morning. It works very well. Indeed, I must have exceeded the quotas per hour since my blockage was always at a specific time. I didn't think I would reach the quota, I checked my code just in case. I realized that I was making two identical requests in a row on homesdatas, a stupid mistake on my part that I corrected. I will limit certain requests and temporarily use two apps alternately to avoid exceeding the quotas. From a general point of view on Github, I don't see any specific problems reported by other users regarding your API, proof that it works. Thank you again and have a good day.

    0
  • Comment author
    Leslie Community moderator

    Hello @Phil,

    Seems like the Domoticz build 16583 can solve the problem. Could you please tell me if it's the case ?

    Have a good day,

    Leslie - Community Manager

    0

Please sign in to leave a comment.