Color_setting
devices.capabilities.color_setting
Color control for device lighting elements. The device may have one or more of the following functions:
- Changing the color of its lighting elements to any color from the HSV or RGB model.
- Changing the color temperature of its lighting elements.
- Playing back different visual effects.
Examples of such devices (you can also review the page with the description of the devices.types.light device type):
- Color light bulb.
- A regular white light bulb with the capability to change the temperature of its white color.
- An electric kettle with color-changing LED lights.
Common voice commands
-
Алиса, включи красный свет.
Translation: Alice, turn on red light.
-
Алиса, сделай свет теплее.
Translation: Alice, make the light warmer.
-
Алиса, поставь зеленый цвет на лампочке.
Translation: Alice, set the light bulb to green light.
-
Алиса, включи свет в режим вечеринки.
Translation: Alice, change the light to party mode.
Capability description
The structure is used in the response to the Information about user devices operation.
Capability parameters
Parameter |
Type |
Description |
Required |
type |
String |
Capability type. |
Yes |
retrievable |
Boolean |
If it's possible to request the state of this device capability. Acceptable values:
|
No |
reportable |
Boolean |
Indicates that the notification service reports the capability state change. Acceptable values:
|
No |
parameters |
Object |
|
Yes |
parameters
object
Parameter |
Type |
Description |
Required |
|||||||||||||||||||||||||||
color_model |
String |
Custom change of the color of device lighting elements. Acceptable values: |
Yes, if the |
|||||||||||||||||||||||||||
temperature_k |
Object |
Change in color temperature in kelvins. The range is specified in the additional The value will be converted to a color from the palette below. Limitation If the device supports a single temperature mode, select the closest value from the table and pass it. If you pass a value or range of values outside of the table, the user is offered the default color (white with the temperature of 4500 K). Color palette
|
Yes, if the |
|||||||||||||||||||||||||||
color_scene |
Object |
Changing the operating mode of the device's lighting elements according to the preset lighting themes and scenarios. |
Yes, if the |
temperature_k
object
Parameter |
Type |
Description |
Required |
min |
Integer |
The minimum acceptable color temperature in kelvins. |
No |
max |
Integer |
The maximum color temperature in kelvins. |
No |
color_scene
object
Parameter |
Type |
Description |
Required |
scenes |
Array of scene objects |
An array of |
Yes |
The scene
object included in the scenes
array
Parameter |
Type |
Description |
Required |
||||||||||||||||||||||||||||||||||
id |
String |
Lighting scenario ID. You can find the acceptable values in the list below. Lighting themes and scenarios
|
Yes |
Example of use
Yandex Smart Home requests the details of user devices from the provider. The provider responds that the user has a light bulb with color control.
curl -i -X GET 'https://example.com/v1.0/user/devices' \
-H 'Authorization: Bearer 123qwe456a...' \
-H 'X-Request-Id: ff36a3cc-ec...'
HTTP/1.1 200 OK
{
"request_id": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"payload": {
"user_id": "user-001",
"devices": [{
"id": "lamp-001-xdl",
"name": "лампочка",
"description": "умная лампочка xdl",
"room": "спальня",
"type": "devices.types.light",
"custom_data": {
"api_location": "rus"
},
"capabilities": [{
"type": "devices.capabilities.color_setting",
"retrievable": true,
"reportable": false,
"parameters": {
"color_model": "hsv",
"temperature_k": {
"max": 6500,
"min": 2700
},
"color_scene": {
"scenes": [{
"id": "party"
},
{
"id": "alarm"
},
{
"id": "fantasy"
},
{
"id": "reading"
}
]
}
}
}],
"device_info": {
"manufacturer": "Provider-01",
"model": "xdl 1",
"hw_version": "3.2",
"sw_version": "2.4"
}
}]
}
}
Current capability state
The structure is used in the response to the Information about the states of user devices operation and in the request body of the Notification about device state change operation.
Capability parameters
Parameter |
Type |
Description |
Required |
type |
String |
Capability type. |
Yes |
state |
Object |
Capability state parameters. |
Yes |
state
object
Parameter |
Type |
Description |
Required |
instance |
String |
Function name for this capability. Acceptable values: |
Yes |
value |
Object/Integer |
Function value for this capability. The format depends on the 1. If 2. If 3. If 4. If |
Yes |
value
object
Parameter |
Type |
Description |
Required |
h |
Integer |
The |
Yes, if |
s |
Integer |
The |
Yes, if |
v |
Integer |
Color value or brightness ( |
Yes, if |
Example of use
Yandex Smart Home requests the provider to change the state of the user device. The provider responds with the state of the user device.
curl -i -X POST 'https://example.com/v1.0/user/devices/query' \
-H 'Authorization: Bearer 123qwe456a...' \
-H 'X-Request-Id: ff36a3cc-ec...' \
-H 'Content-Type: application/json' \
-d '{
"devices":
[
{
"id": "lamp-001-xdl",
"custom_data": {
"api_location": "rus"
}
},
{
"id": "lamp-002-xdl",
"custom_data": {
"api_location": "rus"
}
},
{
"id": "lamp-003-xdl",
"custom_data": {
"api_location": "rus"
}
},
{
"id": "lamp-004-xdl",
"custom_data": {
"api_location": "rus"
}
}
]
}'
HTTP/1.1 200 OK
{
"request_id": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"payload": {
"devices": [
{
"id": "lamp-001-xdl",
"capabilities": [
{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "hsv",
"value": {
"h": 255,
"s": 100,
"v": 50
}
}
}
]
},
{
"id": "lamp-002-xdl",
"capabilities": [
{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "rgb",
"value": 13910520
}
}
]
},
{
"id": "lamp-003-xdl",
"capabilities": [
{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "temperature_k",
"value": 4500
}
}
]
},
{
"id": "lamp-004-xdl",
"capabilities": [
{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "scene",
"value": "party"
}
}
]
}
]
}
}
Change the state of the device capability
The structure is used in the response to the Change device state operation.
Capability parameters
Parameter |
Type |
Description |
Required |
type |
String |
Capability type. |
Yes |
state |
Object |
An object that describes the result of changing the state of the capability. |
Yes |
state
object
Parameter |
Type |
Description |
Required |
instance |
String |
Function name for this capability. Acceptable values: |
Yes |
action_result |
Object |
Result of changing the state of the device capability. |
No |
action_result
object
Parameter |
Type |
Description |
Required |
status |
String |
Status of the device capability state change. Acceptable values:
|
Yes |
error_code |
String |
An error code from the list of errors. If |
No |
error_message |
String |
Extended human-readable description of a possible error. It is displayed only in the Testing section of the developer console. |
No |
Example of use
Yandex Smart Home requests the provider to change the state of the user's devices. The provider responds with the result of user device state change.
curl -i -X POST 'https://example.com/v1.0/user/devices/action' \
-H 'Authorization: Bearer 123qwe456a...' \
-H 'X-Request-Id: ff36a3cc-ec...' \
-H 'Content-Type: application/json' \
-d '{
"payload": {
"devices": [{
"id": "lamp-001-xdl",
"custom_data": {
"api_location": "rus"
},
"capabilities": [{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "hsv",
"value": {
"h": 125,
"s": 25,
"v": 100
}
}
}]
},
{
"id": "lamp-002-xdl",
"custom_data": {
"api_location": "rus"
},
"capabilities": [{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "rgb",
"value": 14210514
}
}]
},
{
"id": "lamp-003-xdl",
"custom_data": {
"api_location": "rus"
},
"capabilities": [{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "temperature_k",
"value": 5100
}
}]
},
{
"id": "lamp-004-xdl",
"capabilities": [{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "scene",
"value": "party"
}
}]
}
]
}
}'
HTTP/1.1 200 OK
{
"request_id": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"payload": {
"devices": [{
"id": "lamp-001-xdl",
"capabilities": [{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "hsv",
"action_result": {
"status": "DONE"
}
}
}]
},
{
"id": "lamp-002-xdl",
"capabilities": [{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "rgb",
"action_result": {
"status": "DONE"
}
}
}]
},
{
"id": "lamp-003-xdl",
"capabilities": [{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "temperature_k",
"action_result": {
"status": "DONE"
}
}
}]
},
{
"id": "lamp-004-xdl",
"capabilities": [{
"type": "devices.capabilities.color_setting",
"state": {
"instance": "scene",
"action_result": {
"status": "DONE"
}
}
}]
}
]
}
}
List of "key": value
pairs separated by commas. The list is enclosed in curly brackets {}
.
{
"name": "John",
"surname": "Smith"
}
String enclosed in quotation marks, for example: "Hello, world"
.
Integer without quotes, for example, 25
.
An array of elements separated by a comma. As array items, you can use standard JSON elements: a string, number, true
, false
, object, or array. Arrays are enclosed in square brackets []
:
"cities": ["Moscow", "Tokyo", "New York"]
Boolean value without quotes: true
or false
.