ym88659208ym87991671
Posting device states (post state) | Documentation SmartMarket
Skip to main content

Posting device states (post state)

The vendor notifies Sber Smart Home of changes in the status of a user's device.

Sample case:

  1. The function state of the device has changed for some reason. For example, the light bulb was disconnected from the power or changed its color in the vendor's app.
  2. The vendor notifies Sber Smart Home of a change in the status of a user's device.
  3. Sber Smart Home updates the status of the device in the Salute mobile app, on SberPortal, SberBox and other devices supported with Salute assistants.

Query format

The vendor sends a notification to Sber Smart Home endpoint: https://partners.iot.sberdevices.ru/. For the headers, see Query headers.

POST /v1/state

Query body:

FieldTypeMandatory?Description
devicesdict<string, object>✔︎Devices with their state updated. For each device, the device ID in the vendor's system and the status of its functions are returned
ID<string>✔︎Device ID in the vendor's system
stateslist<object>✔︎List of function states (see Device state (state))
{
"devices": {
"id": {
"states": [
{
"key": string,
"value": {
"type": string,
"type_value": object
}
},
{
// ...
}
]
}
}
}

Response format

Sber Smart Home sends a response to the vendor's endpoint. For the headers, see Query headers.

Success response:

HTTP/1.1 200 OK

When an error occurs, Sber Smart Home may return:

  • A list of errors that contains error objects. Each object points to specific devices with their status not updated.
  • A common error that describes the problem as a whole and is returned when the problem cannot be juxtaposed with specific devices.

When the vendor returned the states of several devices and Sber Smart Home could change the states of some of them, but an error occurred when updating the rest, Sber Smart Home should send an error response, including the list of devices with their states not updated.

Device-specific error:

{
"errors": [
{
"id": string,
"code": integer,
"message": string
}
]
}

Common error:

{
"code": integer,
"message": string,
"details": list<string>
}

Sample query and response

The vendor posts a change in the online and on_off state of the socket functions.

Query:

curl -i -X POST /v1/devices HTTP/1.1 \
-H Host: example.com \
-H Content-Type: application/json \
-H Authorization: Bearer qwerty-1234-... \
-H X-Request-Id: abcd-0000-ifgh-...
{
"devices": {
"ABCD_003": {
"states": [
{
"key": "online",
"value": {
"type": "BOOL",
"bool_value": true
}
},
{
"key": "on_off",
"value": {
"type": "BOOL",
"bool_value": true
}
}
]
}
}
}

Success response:

HTTP/1.1 200 OK

Error response:

{
"errors": [
{
"id": "ABCD_003",
"code": 500,
"message": "System error"
}
]
}