Bug with setHue and setSaturation commands for devices with colorControl capabilities

,

Hello, while debugging a Homebridge plugin, I might have found an issue with the SmartThings API. Indeed, the REST API seems to make an invalid cast and returns an error when trying to set hue or saturation with a POST request to https://api.smartthings.com/v1/devices/<device-id>/commands and the following body :

[{
    "capability":"colorControl",
    "command":"setHue",
    "arguments":[53]
}]

The response I got is :

{
    "requestId": "88CB09C5-A653-403F-83EB-32CEBA28A6AB",
    "error": {
        "code": "connector failed",
        "message": "java.lang.Integer cannot be cast to java.util.Map",
        "details": []
    }
}

The same issue occur with the setSaturation command, however using setColor works as expected.
Is there a place I can send an official bug report for this issue ?

Color control commands references : Production Capabilities | SmartThings Developers

Welcome to the SmartThings Community, @obrassard!

Have you tried adding the “component” property as well? For example:

{
  "commands": [
    {
      "component": "main",
      "capability": "colorControl",
      "command": "setHue",
      "arguments": [53]
    }
  ]
}

Also, it will depend on the device’s controller (Edge Driver, ST Schema, etc.) because it must have implemented a handler for each command.
Remember that even though the capability has certain commands, it doesn’t mean the device controller also supports it, that depends on the developer/Partner.
The command sent from the SmartThings app when we select a new color is “setColor”.

It is strange, I’ve been making some tests and I cannot reproduce the error even after removing some properties. This command request is being sent from Homebridge, right? My tests were using Postman.

Hello @nayelyz thank you for your answer ! I tried adding "component": "main" to the body of the request, but I got the same cast error.

Indeed, the command is being sent from a Homebridge Plugin, however I tested it in Postman as well and got the same error.

I couldn’t say if the device’s controller implements a handler for this command, it’s a Teckin (Tuya) device. Is there a way to verify this ?

what happens if you send the command using the format I shared above? This is just to check if it can cause the error for that specific device. I’ve been making tests with a virtual device using your exact command and I always get “ACCEPTED”:

Did you install the device through the SmartThings app, right? I see that the Tuya integration is Cloud-to-Cloud, which means you linked your account and the devices were discovered. In this case, the manufacturer is the one that configures the integration and we cannot modify it on our side but we can investigate the error further to determine where it is failing.
To verify the device is using an ST Schema integration, list the devices, look for the “Teckin” device, and see if its type is “VIPER”.

what happens if you send the command using the format I shared above?

I tried with your command and the result was the same :slight_smile:

Did you install the device through the SmartThings app, right? I see that the Tuya integration is Cloud-to-Cloud, which means you linked your account and the devices were discovered.

Yes indeed, I linked the device to SmartThings by connecting my Globe Suite account (which is actually the same thing as SmartLife/Tuya) to SmartThings and the devices from Globe Suite were automatically added into SmartThings. (Globe Suite is listed in the “Linked Services” setting in the SmartThings app)

To verify the device is using an ST Schema integration, look for the “Teckin” device, and see if its type is “VIPER”.

It is indeed a VIPER device

{
            "deviceId": "...",
            "name": "c2c-rgbw-color-bulb",
            "label": "Ampoule 2",
            "manufacturerName": "SmartThings",
            "presentationId": "SmartThings-smartthings-c2c-rgbw-color-bulb",
            "locationId": "...",
            "roomId": "...",
            "components": [
                {
                    "id": "main",
                    "label": "main",
                    "capabilities": [
                        {
                            "id": "switch",
                            "version": 1
                        },
                        {
                            "id": "switchLevel",
                            "version": 1
                        },
                        {
                            "id": "colorControl",
                            "version": 1
                        },
                        {
                            "id": "colorTemperature",
                            "version": 1
                        },
                        {
                            "id": "refresh",
                            "version": 1
                        },
                        {
                            "id": "healthCheck",
                            "version": 1
                        }
                    ],
                    "categories": [
                        {
                            "name": "Light",
                            "categoryType": "manufacturer"
                        }
                    ]
                }
            ],
            "createTime": "2022-11-29T04:19:00.650Z",
            "profile": {
                "id": "...."
            },
            "viper": {
                "uniqueIdentifier": "...",
                "manufacturerName": "Tuya Inc.",
                "modelName": "light",
                "swVersion": "23.123.231",
                "hwVersion": "v1 US bulb"
            },
            "type": "VIPER",
            "restrictionTier": 0,
            "allowed": []
        }

ok, I will ask the team about the error thrown here, do you remember the timestamp when you executed the command?
Was it a few seconds before your reply?

I just made the same request on postman at 2022-12-01 23:29:39 UTC

The request id is : DEC4B3C9-7E49-4563-9322-DD30EE3906F4

2 Likes

Hi, @obrassard.

I checked with the engineering team and they mentioned it is due to an error thrown by the Partner’s cloud. They checked more details and noticed it was because the partner’s Schema connector doesn’t support the commands setHue and setSaturation.
And, it could be because of the following: