Getting device models (get models)
Last updated on May 17, 2023
The agent app installed on the controller requests from Sber Smart Home a list of device models supported by the Smart Home.
Use case example:
- When loading, the agent app compiles a control - a dropdown list indicating currently supported models. To complete the list, the agent requests the list of supported models from Sber Smart Home.
- Sber Smart Home returns a list of models.
- 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/models
Response format
Sber Smart Home sends the response to the agent app. For the headers, see Query headers.
Success response:
Field | Type | Mandatory? | Description |
models | list<object> | ✔︎ | List of device models (see Device model (model)) |
{
"models": [
{
"id": string,
"manufacturer": string,
"model": string,
"hw_version": string,
"sw_version": string,
"description": string,
"category": string,
"features": [
"online": string,
"on_off": string
// ...
],
"dependencies": {
"func_name": {
"key": string,
"value": [
{
"type": string,
"type_value": object
},
{
// ...
}
]
},
{
// ...
}
}
},
{
// ...
}
]
}
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 device models supported by the Smart Home. Sber Smart Home returns one model - the lamp model.
Query:
curl -i -X GET /v1/mqtt-gate/models 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:
{
"models": [
{
"id": "QWERTY123",
"manufacturer": "Factory",
"model": "SM0123456789",
"hw_version": "3.2",
"sw_version": "5.7",
"description": "About device",
"category": "light",
"features": [
"online",
"on_off"
]
}
]
}
Error response:
{
"code": 500,
"message": "Internal server error",
"details": []
}