ym88659208ym87991671
Step 4. Connecting an agent and configuring messaging | Documentation for developers

Step 4. Connecting an agent and configuring messaging

Last updated on December 22, 2024
  1. Install the MQTT client on the controller or computer. For example, MXTTX is suitable for a PC.

  2. In the MQTT client, enter the data to connect to the Sber Smart Home cloud. The fields in your software may be named differently, use similar in meaning:

    • Name — Sber Smart Home or other convenient.
    • Client ID — an arbitrary identifier of your MQTT client or controller.
    • Host — the address of the MQTT server of the Sber Smart Home. You learned it in step 1. For example, mqtts://mqtt-partners.iot.sberdevices.ru.
    • Port — the port used. You also learned it in step 1. For example, 8883.
    • Username, Password — the username and password received for the agent or controller in step 1.
  3. Create devices based on the models installed in step 3. For example, to create a temperature and humidity sensor based on the my_temp_sensor model, send the following message to the topic sberdevices/v1/username/up/config:

    {
    "devices": [
    {
    "id": "temp1",
    "name": "temp1",
    "default_name": "temp1",
    "model_id": "my_temp_sensor"
    }
    ]
    }

    Please note that the model_id must match the ID of one of the models you created in Studio in step 3.

  4. To send messages with device status, use the topic sberdevices/v1/username/up/status. For example, to transmit the current temperature and a sign of a connection for a temperature and humidity sensor with the identifier temp1:

    {
    "devices":{
    "temp1":{
    "states":[
    {
    "key":"online",
    "value":{"type":"BOOL","bool_value":true}
    },
    {
    "key":"temperature",
    "value":{"type":"INTEGER","integer_value":256}
    }
    ]
    }
    }
    }
  5. Check that everything worked. In the Salute Android app or in the web version of the Salute app log in with the same phone number that you used to register in Studio. Then click

    Add
    Устройства других производителей (Devices from other manufacturers), select the agent or controller and update the list of devices.

    The devices you created will be added to the list of devices. If you added a temperature and humidity sensor from the examples above, you will see it in the application with a temperature of 25.6 °C.

    The added devices can be fully used: added to scenarios, transferred between rooms of a smart home, etc. Read more in the Sber Smart Home Help for users.

  6. If necessary, configure the MQTT client to process messages from the Sber smart home cloud. For a list of all topics, see Protocol for MQTT integrations.

Sber process cookies only to personalize services according to Cookies Usage Policy. You can prevent the processing of cookies in your browser settings.