Getting device functions (get features)
Last updated on May 17, 2023
The agent application on the controller sends a request to the Sber Smart Home to receive a list of functions, which is supported by the device category.
Use case example:
- When loading, the agent app compiles a control - a dropdown list indicating functions supported by devices of a certain category. To complete the list, the agent sends the relevant query to Sber Smart Home.
- Sber Smart Home returns a list including functions of the category.
- The agent app compiles a dropdown list indicating currently supported models.
Request format
A request is sent to the information API endpoint, the address of which is sent in a message indicating the global configuration. For the headers, see Query headers.
GET /v1/mqtt-gate/categories/<category>/features
Request parameters:
Field | Type | Mandatory? | Description |
category | string | ✔︎ | Device category name (see Description of devices) |
Response format
Sber Smart Home sends the response to the agent app. For the headers, see Query headers.
Success response:
Field | Type | Mandatory? | Description |
features | list<object> | ✔︎ | List of functions supported by devices of this category (see Device functions) |
name | string | ✔︎ | Function name |
data_type | string | ✔︎ | Type of data returned by the function |
required | bool | Is the function mandatory for the category or not |
{
"features": [
{
"name": string,
"data_type": string,
"required": boolean
},
// ...
]
}
If an error occurs, a Common error (common error) object is returned:
{
"code": integer,
"message": string,
"details": list<string>
}
Sample query and response
The agent app requests the list of functions for the light category. Sber Smart Home returns a list of functions.
Query:
curl -i -X GET /v1/mqtt-gate/categories/light/features HTTP/1.1 \
-H Host: example.com \
-H Content-Type: application/json \
-H Authorization: Basic qwerty-1234-... \
-H X-Request-Id: abcd-0000-ifgh-...
Success response:
{
"features": [
{
"name": "light_brightness",
"data_type": "INTEGER"
},
{
"name": "light_colour",
"data_type": "COLOUR"
},
{
"name": "light_colour_temp",
"data_type": "INTEGER"
},
{
"name": "light_mode",
"data_type": "ENUM"
},
{
"name": "on_off",
"data_type": "BOOL",
"required": true
},
{
"name": "online",
"data_type": "BOOL",
"required": true
}
]
}
Error response:
{
"code": 500,
"message": "Internal server error",
"details": []
}