Create Thermostat Schedule with API

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
Post Reply
effiguillaume
Posts: 5
Joined: 05 Dec 2017, 10:28

Create Thermostat Schedule with API

Post by effiguillaume » 05 Dec 2017, 11:34

Hello,

I am trying to change my thermostat's schedule via Netatmo API, but I fail to do so with Postman.

As I understand, to create a new schedule we have to call /api/createnewschedule with POST arguments :

Code: Select all

access_token
device_id
module_id
zones
timetable
name
Documentation says I have to pass an array of data for zones and timetable, but I don't understand how to format this array.
It shows a JSON-like array, embedded in parentheses as an example, but API answers me an error (error code 21 : "Invalid Array arg").

For example, I try to send this post request on api.netatmo.com/api/createnewschedule with the following data :

Code: Select all

access_token: myaccesstoken
device_id: 70:ee:50:0b:19:16
module_id: 04:00:00:0b:32:76
zones: ({"id": 0,"temp": 17,"type": 0},{"id": 1,"temp": 16,"type": 1},{"id": 3,"temp": 17,"type": 8},{"id": 4,"temp": 16,"type": 5},{"id": 2,"temp": 12,"type": 2},{"id": 5,"temp": 7,"type": 3}↵)
timetable: ({"id":2,"m_offset":0},{"id":1,"m_offset":360},{"id":2,"m_offset":180},{"id":2,"m_offset":1440},{"id":1,"m_offset":1800},{"id":2,"m_offset":2520},{"id":2,"m_offset":2880},{"id":1,"m_offset":3240},{"id":2,"m_offset":3960},{"id":2,"m_offset":4320},{"id":1,"m_offset":4680},{"id":2,"m_offset":5400},{"id":2,"m_offset":5760},{"id":1,"m_offset":6120},{"id":2,"m_offset":6840},{"id":2,"m_offset":7200},{"id":1,"m_offset":7560},{"id":2,"m_offset":8280},{"id":2,"m_offset":8640},{"id":1,"m_offset":9000},{"id":2,"m_offset":9720})
name: testSchedule
and I get :

Code: Select all

{
    "error": {
        "code": 21,
        "message": "Invalid array arg"
    }
}
as a response.

I suspect my zones and timetable parameters are not well formated for the API, but how should I do then ?
Thank you

ramroot
Posts: 3
Joined: 29 Dec 2017, 00:03

Re: Create Thermostat Schedule with API

Post by ramroot » 29 Dec 2017, 22:42

Hello,
it seems Netatmo has changed the needed data in the API. Especially, it needs "rooms temperature".
The guide hasn't been updated

Céline
Posts: 37
Joined: 20 Nov 2017, 18:17

Re: Create Thermostat Schedule with API

Post by Céline » 03 Jan 2018, 11:42

Hello effiguillaume,

Try replacing the '(' with '[' like: ' zones: [{"id" '
Céline - Netatmo Team :D

effiguillaume
Posts: 5
Joined: 05 Dec 2017, 10:28

Re: Create Thermostat Schedule with API

Post by effiguillaume » 03 Jan 2018, 11:54

Yes, thank you, I managed to create and update my schedule but haven't posted since then, sorry.
Replacing '(' by '[' did the trick.
In fact I had a second problem (not shown in my example) because apparently offsets have to be in ascending order in the timetable. My app did not bother sorting the offsets generated and that's why it didn't work.

Thank you for your support.

ramroot
Posts: 3
Joined: 29 Dec 2017, 00:03

Re: Create Thermostat Schedule with API

Post by ramroot » 03 Jan 2018, 12:26

Can you send the way you've done it ?
I still have problems with Python using requests library
Which way are you doing the requests ?

Have you only got thermostat or some valves with it ?

Céline
Posts: 37
Joined: 20 Nov 2017, 18:17

Re: Create Thermostat Schedule with API

Post by Céline » 03 Jan 2018, 15:34

@ramroot, the API is not working with valves for now but we're working on it.
Céline - Netatmo Team :D

effiguillaume
Posts: 5
Joined: 05 Dec 2017, 10:28

Re: Create Thermostat Schedule with API

Post by effiguillaume » 03 Jan 2018, 15:49

I'm doing my requests using libcurl, my app is a C++ application.
I can't post my code right here but basically all I did was a POST request using this POST data :

Code: Select all

access_token:<<my_access_token>>
device_id:70:ee:ee:ee:ee:ff
module_id:04:ee:00:00:ee:ff
zones:[{"id":10,"name":"comfort_setpoint","temp":22,"type":0},{"id":11,"name":"eco_setpoint","temp":15,"type":1},{"id":12,"name":"frostprot_setpoint","temp":8,"type":2},{"id":13,"name":"custom","temp":8,"type":3},{"id":14,"name":"custom","temp":15,"type":5}]
timetable:[{"id":11,"m_offset":0},{"id":10,"m_offset":360},{"id":11,"m_offset":1000},{"id":10,"m_offset":1800},{"id":11,"m_offset":2520},{"id":10,"m_offset":3240},{"id":11,"m_offset":3960},{"id":10,"m_offset":4680},{"id":11,"m_offset":5400},{"id":10,"m_offset":6120},{"id":11,"m_offset":6840},{"id":10,"m_offset":7500},{"id":11,"m_offset":8280},{"id":10,"m_offset":9000},{"id":11,"m_offset":9720}]
And it's working fine.

ramroot
Posts: 3
Joined: 29 Dec 2017, 00:03

Re: Create Thermostat Schedule with API

Post by ramroot » 03 Jan 2018, 22:05

Céline wrote:@ramroot, the API is not working with valves for now but we're working on it.
Ok, but even if I'd like to sync the timetable, syncschedule detects I have valves and prevents me from using the way which is described in the documentation of dev.netatmo.com
When I use the anticipation algorithm, the boiler starts too early in the morning. So I'd like to sync the timetable on my own, especially by using an algorithm.
You said API for valves will come in Q1 2018. I hope it will be very soon during Q1!
Thanks

Post Reply

Return to “Netatmo API”