IoT - Mqtt

  1. How to setup support of IoT devices

In the main menu, click on “Account” icon. In the panel that opens on the left, click on the “IoT/Settings” button. The settings panel for working with IoT devices is displayed. In the Password mqtt field, enter your password. Username is displayed at the top of the panel. Service broker url: tcp://onebrella.eu:8701. To connect to the mqtt broker, the client must send a record of type CONNECT. In this message, you must pass username and password defined in the “IoT/Settings” panel. In the CONNACK response packet, the broker returns: "CONNECTION_ACCEPTED" if the connection is successful, or "CONNECTION_REFUSED_BAD_USER_NAME_OR_PASSWORD" otherwise.

To publish data, records of the PUBLISH type are used. These entries specify "topic" and "value" (Payload). From the "topic" element service forms the "imei" of the object and the identifier of the passed parameter. The item after the last “/” in "topic" is considered as the parameter identifier. The line from the beginning to the last “/” is considered as an "imei" of an object. The "topic" string is converted to upper case and in "imei" all “/” are replaced by “_”.

Examples:

topic   : KITCHEN/WORK/H2
message : 67

If the KITCHEN_WORK object does not exist, then it is created in the account's root group. If the attribute of the H2 object has not been defined before, it is added to the object via script.

You can send multiple object parameters in one message. To do this, the message must be in JSON format:

topic   : KITCHEN/WORK/DATA
message : {"param1":110,"param2":"on","param3":25.4,"param4":4.5}

If any of the given parameters is not previously defined, it is created to the parameter of the object via the script.

You can override the type of the passed parameter in the script, and also change its name. Example

.module Declare
Attr Integer param1 "Voltage"
Attr String param2 "Status"
Attr String param3 "param3"
Attr Double param4 "Temperature"
  1. IoT Script

In the object's Basic Info panel, you can:

Back Directory Next