Problem with updating Thermostat Schedule via 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

Problem with updating Thermostat Schedule via API

Post by effiguillaume » 21 Aug 2018, 17:16

Hello,

I have some troubles trying to update my thermostat's schedule with API's method "synchomeschedule".

I used to call "syncschedule" with this POST content :

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}]
It worked well for what I wanted, but now it's broken for some reason and I just get this error code :

Code: Select all

 {
    "error": {
        "code": 21,
        "message": "Invalid rooms_temp: some rooms aren't controlled"
    }
}
From what I understand now we should call "synchomeschedule" with the following POST content :

Code: Select all

access_token:<<my_access_token>>
schedule_id:<<my_schedule_id>>
home_id:<<my_home_id>>
hg_temp:8
away_temp:15
zones:[{"id":10,"name":"comfort_setpoint","temp":22,"type":0,"rooms":[????]},{"id":11,"name":"eco_setpoint","temp":15,"type":1,"rooms":[????]},{"id":12,"name":"frostprot_setpoint","temp":8,"type":2,"rooms":[????]},{"id":13,"name":"custom","temp":8,"type":3,"rooms":[????]},{"id":14,"name":"custom","temp":15,"type":5,"rooms":[????]}]
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}]
But all I get is a "missing argument(s)" error.
The documentation seems to be incomplete or at least very confusing regarding the content of the "rooms" item of "zones", it says "Array of id and therm_setpoint_temperature" but I tried putting "[<<room_id>>,15]", "[<<room_id>>]", etc. without success.

Could you please help me calling "synchomeschedule" properly, by providing some detailed example of a schedule modification ?

Thank you

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

Re: Problem with updating Thermostat Schedule via API

Post by effiguillaume » 14 Sep 2018, 10:37

Well I finally figured out myself how to use synchomeschedule properly.

The vague description of the documentation which says the content of the "rooms" item of "zones" is "an array of id and therm_setpoint_temperature", is in fact of the following structure :

Code: Select all

[{"id":<<room_1_id>>,"therm_setpoint_temperature":<<setpoint>>},{"id":"<<room_2_id>>","therm_setpoint_temperature":<<setpoint>>}, etc.]
The final POST request looks like :

Code: Select all

access_token:<<my_access_token>>
schedule_id:<<my_schedule_id>>
home_id:<<my_home_id>>
hg_temp:8
away_temp:15
zones:[{"id":10,"name":"comfort_setpoint","rooms":[{"id":"4060422649","therm_setpoint_temperature":22},{"id":"174447753","therm_setpoint_temperature":22}],"type":0},{"id":11,"name":"eco_setpoint","rooms":[{"id":"4060422649","therm_setpoint_temperature":15},{"id":"174447753","therm_setpoint_temperature":15}],"type":1},{"id":12,"name":"frostprot_setpoint","rooms":[{"id":"4060422649","therm_setpoint_temperature":8},{"id":"174447753","therm_setpoint_temperature":8}],"type":5}]
timetable:[{"zone_id":11,"m_offset":0},{"zone_id":10,"m_offset":400},{"zone_id":11,"m_offset":1200},{"zone_id":10,"m_offset":1860},{"zone_id":11,"m_offset":2640},{"zone_id":10,"m_offset":3280},{"zone_id":11,"m_offset":4080},{"zone_id":10,"m_offset":4720},{"zone_id":11,"m_offset":5520},{"zone_id":10,"m_offset":6160},{"zone_id":11,"m_offset":6960},{"zone_id":12,"m_offset":7600},{"zone_id":11,"m_offset":8400},{"zone_id":12,"m_offset":9060},{"zone_id":11,"m_offset":9840}]
And only then the request works.

Besides, some of my "type" numbers were not valid, despite the documentation which states the following numbers are :

Code: Select all

    0 = day
    1 = night
    2 = away
    3 = frost guard
    4 = custom
    5 = eco
    5 = comfort
I really think the documentation needs an update. The new API makes it difficult to change a schedule value.

Post Reply

Return to “Netatmo API”