Smart Si - Error updating schedule

Hello,

I am having some issues updating a Smart Si's program. Here's the full HTTP transaction: http://pastebin.com/JhAKBE8t and formatted JSON: http://pastebin.com/1vvkeCi7

{
"status": {
"code": 4,
"message": "Serialization error. Error mapping request thermostat. "
}
}

I've also tried setting all 48 climate blocks to "home" with no luck.

Any help would be greatly appreciated.

Thanks,
Nick
1 person has
this problem
+1
Reply
  • Hi Nick,
    Your request is not formatted correctly. The climate object is part of the program object along with the schedule, however in all your requests (which I checked in our server logs) you have the climates on a different level to the schedule.

    For example, this fails:
    {
    "selection": {
    "selectionType": "thermostats",
    "selectionMatch": "211178XXXXXX",
    "includeRuntime": false,
    "includeExtendedRuntime": false,
    "includeElectricity": false,
    "includeSettings": false,
    "includeLocation": false,
    "includeProgram": false,
    "includeEvents": false,
    "includeDevice": false,
    "includeTechnician": false,
    "includeUtility": false,
    "includeAlerts": false,
    "includeWeather": false,
    "includeOemConfig": false,
    "includeEquipmentStatus": false,
    "includeNotificationSettings": false,
    "includePrivacy": false,
    "includeVersion": false,
    "includeSecuritySettings": false,
    "includeSensors": false
    },
    "thermostat": {
    "program": {
    "schedule": [
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"]
    ]
    },
    "climates": [{
    "name": "Awake",
    "climateRef": "wakeup",
    "isOccupied": true,
    "isOptimized": false,
    "coolFan": "auto",
    "heatFan": "auto",
    "vent": "off",
    "ventilatorMinOnTime": 20,
    "owner": "system",
    "type": "program",
    "colour": 15900982,
    "coolTemp": 780,
    "heatTemp": 700,
    "sensors": [{
    "id": "ei:0:1",
    "name": ""
    }]
    }, {
    "name": "Away",
    "climateRef": "away",
    "isOccupied": false,
    "isOptimized": true,
    "coolFan": "auto",
    "heatFan": "auto",
    "vent": "off",
    "ventilatorMinOnTime": 20,
    "owner": "system",
    "type": "program",
    "colour": 9021815,
    "coolTemp": 800,
    "heatTemp": 620,
    "sensors": [{
    "id": "ei:0:1",
    "name": ""
    }]
    }, {
    "name": "Home",
    "climateRef": "home",
    "isOccupied": true,
    "isOptimized": false,
    "coolFan": "auto",
    "heatFan": "auto",
    "vent": "off",
    "ventilatorMinOnTime": 20,
    "owner": "system",
    "type": "program",
    "colour": 13560055,
    "coolTemp": 780,
    "heatTemp": 700,
    "sensors": [{
    "id": "ei:0:1",
    "name": ""
    }]
    }, {
    "name": "Sleep",
    "climateRef": "sleep",
    "isOccupied": true,
    "isOptimized": false,
    "coolFan": "auto",
    "heatFan": "auto",
    "vent": "off",
    "ventilatorMinOnTime": 20,
    "owner": "system",
    "type": "program",
    "colour": 2179683,
    "coolTemp": 800,
    "heatTemp": 620,
    "sensors": [{
    "id": "ei:0:1",
    "name": ""
    }]
    }]
    }
    }


    Changing it slightly to remove the "}" after the schedule so the climates are on the same level as the schedule (and adding a corresponding one at the bottom to ensure valid json) fixes it:
    {
    "selection": {
    "selectionType": "thermostats",
    "selectionMatch": "211178XXXXXX",
    "includeRuntime": false,
    "includeExtendedRuntime": false,
    "includeElectricity": false,
    "includeSettings": false,
    "includeLocation": false,
    "includeProgram": false,
    "includeEvents": false,
    "includeDevice": false,
    "includeTechnician": false,
    "includeUtility": false,
    "includeAlerts": false,
    "includeWeather": false,
    "includeOemConfig": false,
    "includeEquipmentStatus": false,
    "includeNotificationSettings": false,
    "includePrivacy": false,
    "includeVersion": false,
    "includeSecuritySettings": false,
    "includeSensors": false
    },
    "thermostat": {
    "program": {
    "schedule": [
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"],
    ["sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "sleep", "wakeup", "wakeup", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "home", "sleep"]
    ],
    "climates": [{
    "name": "Awake",
    "climateRef": "wakeup",
    "isOccupied": true,
    "isOptimized": false,
    "coolFan": "auto",
    "heatFan": "auto",
    "vent": "off",
    "ventilatorMinOnTime": 20,
    "owner": "system",
    "type": "program",
    "colour": 15900982,
    "coolTemp": 780,
    "heatTemp": 700,
    "sensors": [{
    "id": "ei:0:1",
    "name": ""
    }]
    }, {
    "name": "Away",
    "climateRef": "away",
    "isOccupied": false,
    "isOptimized": true,
    "coolFan": "auto",
    "heatFan": "auto",
    "vent": "off",
    "ventilatorMinOnTime": 20,
    "owner": "system",
    "type": "program",
    "colour": 9021815,
    "coolTemp": 800,
    "heatTemp": 620,
    "sensors": [{
    "id": "ei:0:1",
    "name": ""
    }]
    }, {
    "name": "Home",
    "climateRef": "home",
    "isOccupied": true,
    "isOptimized": false,
    "coolFan": "auto",
    "heatFan": "auto",
    "vent": "off",
    "ventilatorMinOnTime": 20,
    "owner": "system",
    "type": "program",
    "colour": 13560055,
    "coolTemp": 780,
    "heatTemp": 700,
    "sensors": [{
    "id": "ei:0:1",
    "name": ""
    }]
    }, {
    "name": "Sleep",
    "climateRef": "sleep",
    "isOccupied": true,
    "isOptimized": false,
    "coolFan": "auto",
    "heatFan": "auto",
    "vent": "off",
    "ventilatorMinOnTime": 20,
    "owner": "system",
    "type": "program",
    "colour": 2179683,
    "coolTemp": 800,
    "heatTemp": 620,
    "sensors": [{
    "id": "ei:0:1",
    "name": ""
    }]
    }]
    }
    }
    }


    This should solve your problem.

    Hope it helps.
    Scott
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Hi Scott,

    Thanks a lot for the help. My first attempts did include the climates array as a child of the thermostat object which I now know is incorrect. However, I still get the same result when both the climates and schedule arrays are nested inside of program.

    I compared my failed request (http://pastebin.com/JhAKBE8t) to your suggested request and they appear to match.

    Here is how the JSON object is being created in code. I opted to use a dynamic construction for troubleshooting:


    dynamic jsonWrapper = new
    {
    selection = new
    {
    selectionType = SelectionType.Thermostats.GetStringValue(),
    selectionMatch = thermostatSchedulesPairs.ThermostatId,
    },
    thermostat = new
    {
    program = new
    {
    schedule = scheduleList.ToArray(),
    climates = selectedThermostat.Program.Climates
    },
    }
    };


    Please note the schedule and climates are both wrapped inside program.

    Edit: I've copied your suggested json object and I get the same error when making the request manually using a REST client.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Hi Nick,
    The problem I'm seeing in our logs is regarding the sensors object within the climates in your POST Thermostat request.

    Please ensure those details match the details you see when you make your GET Thermostat call with includeSensors=true.

    Scott
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Hi Scott,

    That information helped solve the problem. If I set the climate sensors lists to null, the POST request works.

    The strange part is I'm re-attaching the climates that I receive from a GET thermostat request directly to the POST climate object.

    climates = selectedThermostat.Program.Climates

    The actual objects: https://ghostbin.com/paste/hkkwc

    Here is the initial GET transaction: https://ghostbin.com/paste/73ywe . The climate sensors match up in the POST but the request fails.

    I guess I'll add some logic to null out the climate sensors.

    Thanks again,

    Nick
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned