Autogenerated Smart Things sends a bad request for Thermostat Cooling Setpoint

I was tryinng to implement a Smart Thermostat device using using the webhooks method (Schema Connector). I created a new device profile using smart things developer workspace. Everything works fine but the Cooling Setpoing. Checking the logs gives me
[{“errorEnum”:“BAD-RESPONSE”,“detail”:“Schema error: should have required property ‘unit’ for attribute ‘coolingSetpoint’ in capability ‘st.thermostatCoolingSetpoint’”}]}],“originatingInteractionType”:“commandResponse”}
Not sure how to proceed as this is my first project. Any help would be appreciated.

Welcome to the SmartThings Community, @Soham_Korgaonkar!

There are some capabilities that require the unit in their events, one of them is thermostatCoolingSetpoint, in this case, you should send the same unit you’re using in your location.

  1. To verify if a capability requires the unit in the events, you can use this CLI command:
smartthings capabilities thermostatCoolingSetpoint -j

There’s a property called “required”, for example:

"attributes": {
    "coolingSetpoint": {
        "schema": {
            "title": "Temperature",
            "type": "object",
            "properties": {
                "value": {
                    "title": "TemperatureValue",
                    "type": "number",
                    "minimum": -460,
                    "maximum": 10000
                "unit": {
                    "type": "string",
                    "enum": [
            "additionalProperties": false,
            "required": [//This one
        "setter": "setCoolingSetpoint",
        "enumCommands": []
  1. To get the details of your location (and see the value set in “Temperature Scale”), you can make a request to the API (locations endpoint) or use this command:
smartthings locations location-id

Thanks for the quick response, but this doesn’t solve my issue.

In my case, the Smart Things App is generating the event when I change the temperature from the app. This generated event doesn’t contain the unit parameter but only the value, hence causing the error.

Is there a way to modify the event generated by the smart things app?

That’s right, the unit is not included in the events, so, you need to include them directly in the commandResponse, for example:

.commandHandler((accessToken, response, devices) => {
    for (const device of devices) {
      const deviceResponse = response.addDevice(device.externalDeviceId);
      for (const cmd of device.commands) {
        const state = {
          component: cmd.component,
          capability: cmd.capability
        if (cmd.capability === 'st.thermostatCoolingSetpoint') {
          state.attribute = 'coolingSetpoint';
          state.value = deviceStates.coolingSetpoint = cmd.arguments[0];
          state.unit ='C'; //***here
        } else {

Hello, thanks for the solution

I have understood the solution but am having problems implementing it. I am using the Glitch example!/scratched-branch-attempt
The above is my project url. When i tried implementing the provides solution, I was not able to find the commandHandler. Can you help me with implementing the provided solution for the glitch example?

ok, I believe that’s an old version of an ST Schema sample, I’ll create a report for the documentation so the correct sample link is included there. Thank you for bringing this to our attention

Please, remix the sample included in this post:

The command handler is in the file connector.js and line 26 and you’ll see a similar structure to the one I shared above.
In this case, you’ll have to add handlers for all the capabilities or a condition to know when to use mapSTCommandsToState which I believe can save you some lines of code :smiley:

1 Like

Thank you so much

The new version fixed all the errors and warnings I was getting previously. Also, this version of ST Schema is much easier to follow and understand.

1 Like