A MQTT External broker device lets the user create a client to receive data published by a MQTT broker on a specific topic.
Configuration parameters of the MQTT External broker device must be inserted in the proper panel in the device creation page or, if already created, in its edit page. The required fields are:
- URL, MQTT broker address;
- Client ID, arbitrary identification value of your client;
- Topic, the topic where data is published;
- Username, username to connect to the broker (if required);
- Password, password to connect to the broker (if required);
- Transformation function, body of a javacscript function that processes the published data, it must return an object in the supported Databoom format.
- The format of the object to return is:
{
'device': '<deviceToken>',
'date': <jsDate>,
'signals' : [
{
'name': <signalToken>,
'value': <signalValue>
}
]
} - In the function the following variables are available:
- payload, byte content of the data published on the topic, buffer Node.js;
- moment, variable to refer the Moment.js library;
- momentTimezone, variable to refer the Moment Timezone library;
- The format of the object to return is:
- OAuth token, user's key created in the Credentials section. It is uset to forward to Databoom the data processed from the transformation function.
Configuration completed!
Once the procedure has been completed, Databoom starts to record data from the MQTT External broker. To examine your data and have a correct representation, follow the instructions in Edit/validation of a signal.
0 Comments