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

27 comments

  • Comment author
    Leslie Community moderator

    Hi again Phil,

    Did you put the home_id value as URL parameter and not in the Body of the request ? 

    If yes and if it still fails, can you send me the exact request you send ? You can also use the try-it tool to test requests and see what could go wrong : https://dev.netatmo.com/apidocumentation/control#homestatus

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    mailpublic35

    Hello Leslie,

    As usual, your answer is highly valuable,  so thank you so much.

    Ok , it works now
    This is THE difference between these two functions :
    -> homesdata        -> home_id can be in the Body of the request
    -> homestatus        -> home_id MUST BE  as a parameter of the URL

    Am I right?
    Phil

    0
  • Comment author
    Leslie Community moderator

    Hi Phil, 

    • /homesdata : the home_id value is not mandatory. If you don't use it, you will retrieve the full list of Homes available for a same end-user account. But if you set one it's an URL parameter too (example : https://api.netatmo.com/api/homestatus?home_id=5a2fxxxxxxxxxxx)
    • /homestatus : the home_id field is mandatory in this call. It also has to be put as URL parameter

    If you test via the try-it out tool you'll get the cURL code sent to our servers. I think there is an encoding issue with the token you send to the /homesdata request according to the error you get

    Have a good day,

    Leslie - Community Manager

     

    0
  • Comment author
    mailpublic35

    Hi Leslie,

    Thank so much, for your explanations, this is crystal clear.
    Theses functions are now ok, using php.

    King regards
    Phil

    0
  • Comment author
    cadkey
    • Edited
     
    Since today I have error code 2 on a homestatus request: 
    {
      status: "ok",
      time_server: 1738105714,
      body: {
        home: {
          id: "xxxxxxxxxxxxxxxxxxxxx"
        },
        errors: [
          {
            code: 2,
            id: "yy:yy:yy:yy:yy:9e"
          }
        ]
      }
    }

     I masked my two ids from the json.
    I got the error with my php script which was working and on https://dev.netatmo.com/apidocumentation/control#homestatus
    I read that it was an error on your servers side.
    Can you repair please.
    THANKS

    0
  • Comment author
    mailpublic35
    • Edited

    Hi,
    I confirm, I got the same behavior ie error, however it can work or not.
    (french time)
    Yesterday morning : it was working
    Yesterday evening :  code 2
    This morning : It is working
    Of course no modification of the php script (netatmo_floodlight.php 
    available on github  user = phil353556)

    array(3) {
     ["status"]=>
     string(2) "ok"
     ["time_server"]=>
     int(1738087096)
     ["body"]=>
     array(2) {
       ["home"]=>
       array(1) {
         ["id"]=>
         string(24) "5xxxxxxxxxxxxxxxxxxxxxxxxc"
       }
       ["errors"]=>
       array(1) {
         [0]=>
         array(2) {
           ["code"]=>
           int(2)
           ["id"]=>
           string(17) "7xxxxxxxxxxx4"
         }
       }
     }
    }

    and the php script exits with these information, which is normal as the script must have a completly different return :-( 
    PHP Warning:  Undefined array key "modules" in xxxxxxxxxxxxxxxxxx/scripts/netatmo_floodlight.php on line 297
    PHP Warning:  foreach() argument must be of type array|object, null given in xxxxxxxxxxxxxxxxxx//scripts/netatmo_floodlight.php on line 297
    -----------------------------------------------------------------------------------
    ERROR Invalid device id

    I look at the webpage https://dev.netatmo.com/apidocumentation/control#homestatus
    code  2  means    Invalid access token
    strange as the access_token is refresh without any errors every three hours. I have full log of the process.

    Thanks for your help
    Phil

    0
  • Comment author
    cadkey

    Major problem yesterday on netatmo servers declared by many users: https://downdetector.fr/statut/netatmo/
    Which corresponds to the problem times for me.
    Note that Homestatus has regularly been in default for a few minutes each day for several months.
    Homedatas still working perfectly.

    0
  • Comment author
    mailpublic35

    @cadkey,  good catch (donwdetector)!

    Nothing written on this webpage :-( 
    https://helpcenter.netatmo.com/hc/en-us/sections/10390237686930-Service-notifications

    0
  • Comment author
    Leslie Community moderator

    Hi Phil & cadkey, 

    Indeed, we had a problem yesterday in the evening impacting the availability of devices (native apps + third-party apps). It seems resolved now

    I don't have more information for now about it as teams are currently investigating. I informed them also that it would have been nice to push the "problem banner" in the helpcenter

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    mailpublic35
    • Edited

    Hello Leslie,

    Thanks for your fast answer. It is appreciated as usual.
    This morning, I made several  tests (set floodlight on, off , auto with the same script  triggered with a on/off button via domoticz)   it works like a charm. 

    "I informed them also that it would have been nice to push the "problem banner" in the helpcenter" 
    Thank you

    suggestion: Why Netatmo doesn't have a global status webpage like other compagnies have?
    examples: status.proton.me  or https://connect.garmin.com/status/

    Have a good day
    Phil


    0
  • Comment author
    Leslie Community moderator

    Hello,

    For your information, more infos about the issue : 

    "We pushed an infrastructure release that went wrong, so we rollbacked it when we saw the slowly degradation of the users' services. The service was not totally down but degraded. It started to degrade around 16h45 (French hour) and was completely rollbacked at 19h. Logs show a complete recover of the system around 3AM"

    @Phil, we have a status page available here : https://health.netatmo.com/

    But the status changes are manual, and the developers don't necessarily have the reflex to update it

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    cadkey

    We take the same ones and we start again... Netatmo still down

    0
  • Comment author
    mailpublic35

    I confirm.

    code = 2 : means Invalid access token, however .. this is not the case, to the message returned by the server is not the right one.

    nothing there  helpcenter.netatmo.com/hc/fr
    nothing there too : health.netatmo.com/posts/dashboard

    And there is no network issue, so :-( 
    disapointed really
    Phil

    0
  • Comment author
    cadkey
    • Edited

    And it starts again this morning, still down since 7:54 a.m.
    Many users report a major malfunction



    When Netatmo tells us that everything is fine... 

     

    0
  • Comment author
    Leslie Community moderator

    Hello,

    Yes, I confirm that the calls to /homestatus are down (code 2) ... again :(

    They tried to re-launch the infra release (yesterday problem) and did a rollback at 23h. It was OK during the night but it seems that the problem occurs again this morning

    The customer support also asked the teams to activate the alert

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    mailpublic35

    Hello Leslie,
    Good luck to the IT Team ... difficult period

    down information are available on:
    - Mobile
    - helpcenter 
      (https://helpcenter.netatmo.com/hc/fr/articles/24326511460370-Service-Incident-30-01-25
        and https://helpcenter.netatmo.com/hc/en-us/articles/24326511460370-Service-Incident-30-01-25)
    - twitter 
    but not  yet (?) on health.netatmo.com :-(
    Phil
    Phil

    0
  • Comment author
    Leslie Community moderator

    Hi Phil,

    They just launched also the alert on the health center : https://health.netatmo.com/posts/dashboard

    According to the teams the problem should soon be resolved

    Have a good day,

    Leslie - Community Manager

     

    0
  • Comment author
    mailpublic35
    • Edited

    ok, perfect. / Thank you
    so I just look just one minute before the update :-) 
    The major concern in case of down period is about "home security"  and camera ..  no alert, no monitoring. That's a REAL issue. (cameras were impacted this early morning,  but seems ok now 09:28 GMT+1)

    0
  • Comment author
    mailpublic35

    Hello Leslie,

    One suggestion if I may: 
    ", I confirm that the calls to /homestatus are down (code 2) ... again :("
    Is it possible for futur, to not have a code 2 but a code meaning ....infrastructure issue ?
    It will enhance the management of return codes on the user/customer side.
    In this case (code 2) .. the user/customer focus on "Invalid access token"  which is not the way to go

    Thanks for your time
    Phil

    0
  • Comment author
    Leslie Community moderator

    Hi again,

    I'll suggest this to the developers ;)

    Have a good day (and week-end),

    Leslie - Community Manager

    0
  • Comment author
    mailpublic35

    Hello,   Thank you / Phil

    0
  • Comment author
    cadkey

    Hi,
    Again today many errors accessing getHomestatus even though everything was fine for a few days...
    You should follow this page regularly to be informed of any malfunctions of your servers.
    https://downdetector.fr/statut/netatmo/

    0
  • Comment author
    mailpublic35

    Hi cadkey,

    There is also https://downdetector.com/status/netatmo/  which is not focus only on France's  issues.
    The graph is slightly different

    For the configuration I have:  no problem today and the previous days.
    Both scripts run smoothly:
    - netatmo_manage_tokens.php    every three hours to keep a valid "access_token"
    - netatmo_floodlight.php,  triggered by a on/off bouton and then managed by "domoticz"

    good luck
    Phil

    0
  • Comment author
    cadkey

    No worries about the token, I have a script to process the json information. Errors have been regular since 11 p.m. last night on Homestatus. For the last four days, zero errors. I need to check devices every minute, a few errors are not annoying but several in a row prevent my monitoring routines from working correctly. It's a problem that didn't exist, which gets worse as soon as Netatmo makes a modification. This always corresponds to a detection pick on downdetector.fr. There is no coincidence ;)
    Netatmo does not warn of problems or very (too) late. I prefer to set up tests to be informed as early as possible and trigger scenarios in the event of a breakdown.
    I also do all my scripts in PHP, I don't use a home automation solution.

    07:01:17 erreur getHomestatus
    07:02:17 erreur getHomestatus
    07:28:18 erreur getHomestatus
    07:29:18 erreur getHomestatus
    07:30:17 erreur getHomestatus
    07:53:17 erreur getHomestatus
    07:54:17 erreur getHomestatus
    07:55:17 erreur getHomestatus
    07:56:20 erreur getHomestatus
    07:57:18 erreur getHomestatus
    07:58:17 erreur getHomestatus
    08:20:17 erreur getHomestatus
    08:22:17 erreur getHomestatus
    08:23:18 erreur getHomestatus
    08:24:16 erreur getHomestatus
    08:49:17 erreur getHomestatus
    08:50:17 erreur getHomestatus
    08:51:17 erreur getHomestatus
    08:52:17 erreur getHomestatus
    09:44:17 erreur getHomestatus
    09:45:23 erreur getHomestatus
    10:11:20 erreur getHomestatus
    10:12:17 erreur getHomestatus
    10:37:20 erreur getHomestatus
    10:38:17 erreur getHomestatus
    10:39:20 erreur getHomestatus
    10:40:17 erreur getHomestatus
    10:41:18 erreur getHomestatus
    11:07:16 erreur getHomestatus

    0
  • Comment author
    mailpublic35

    Hello,
    Ok
    ". I need to check devices every minute": interesting,  every minute is a high pace.

    Phil

    0
  • Comment author
    cadkey

    Hello,
    Yes, this is what I am currently doing. It remains compatible with the number of requests allowed, a homestatus and a homestatus. I am thinking of reducing the frequency, but the random errors on homestatus do not encourage me to do so at the moment. are you using webhook available with the netatmo API or like me only curl GET requests?

    0
  • Comment author
    mailpublic35

    Hello,
    I am curious,  about the need to have such frequency, to poll data :-) 
    Only curl GET requests, for now,  I will look to webhook 

    Ha ha ... i just request some data about floodlight everything works fine except one time ...  got "Invalid device id",     [ simple request to know it the floodlight of the camera is configured as auto, on or off ]
    a few seconds later,  same request is Ok


    @Leslie: clearly the message "Invalid device id"  is not appropriate as this is not the case

    Phil

    0

Please sign in to leave a comment.