I’m developing my own device handler and I have an RGB light.
So, I get with setColorcommand a {hue:NN.NNN,saturation:NN.NNN} map, but I have to return a string. What has to be in that string, how does it have to be encoded? None of the documentation is specifying that. There’s just always “this is a string”.
And the ST application doesn’t like my output.
Hi, where do you have this issue, in a DTH or a command sent directly to the API?
I have a cloud connector from st-schema, so it’s almost a direct send
I think you are asking what form the color
attribute of the colorControl
capability takes and I believe it is a hex RGB string, so #RRGGBB
.
I’ll defer to others at this point as colour conversions aren’t one of my things, and I believe ST has its own ideas.
Ok, when you select a new color in the app, you receive a command request similar to:
{
"externalDeviceId": "device-id-value",
"commands": [
{
"component": "main",
"capability": "st.colorControl",
"command": "setColor",
"arguments": [
{
"saturation": 49,
"hue": 10.833333333333334
}
]
}
]
}
The response should include the new states for those attributes, not color, because it receives HEX values. Eg.
"deviceState": [
{
"externalDeviceId": "device-id-value",
"states": [
{
"component": "main",
"capability": "st.colorControl",
"attribute": "hue",
"value": 72
},
{
"component": "main",
"capability": "st.colorControl",
"attribute": "saturation",
"value": 10
}
]
}
]
It should be documented. Because the documentation lacks clarity
Thanks for the feedback @complynx , I’ll share your comments with our engineering team.
I have another question related to this capability. Is there any way to define what the Preset colors are that show in the mobile app?
Hi! Let me check with the engineering team and I’ll get back to you