ym88659208ym87991671
Getting device functions (get features) | Documentation for developers

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:

  1. 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.
  2. Sber Smart Home returns a list including functions of the category.
  3. 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:

FieldTypeMandatory?Description
categorystring✔︎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:

FieldTypeMandatory?Description
featureslist<object>✔︎List of functions supported by devices of this category (see Device functions)
namestring✔︎Function name
data_typestring✔︎Type of data returned by the function
requiredboolIs 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": []
}
Sber process cookies only to personalize services according to Cookies Usage Policy. You can prevent the processing of cookies in your browser settings.