Thingsboard MQTT Connector Module

About the ThingsBoard MQTT Connector Module:

The ThingsBoard Connector Module enables you to connect devices within a Niagara station to a ThingsBoard instance via MQTT using a device extension.

thingsBoardConnector-rt.jar - Version 1.6 (502.7 KB)

Note: The JAR is compiled against 4.7 meaning it can run in platforms 4.7 or greater. The module is unsigned and will require the user to sign it because it can be run in 4.9+.

How to use the ThingsBoard Connector

:exclamation: The installation process expects that you already have a running instance of Thingsboard and the broker is accessible from the Niagara station via the internet or local network.

Installing the service:

  1. Install the thingsBoardConnector-rt.jar into your Niagara platform where you will be running the service.
  2. Open the thingsBoardConnector pallette in workbench and add the MqttService to the stations service tree.
  3. Open the property sheet of the service and enter your Things Board broker details. Save, and enabled the service.

Using the Mqtt Device Extension:

Either manually or programmatically (using the program service), add the MqttDeviceExt to the devices you wish to post telemetry from to Thingsboard.

Currently there is no option to hand pick the points that will be published to the Thingsboard broker. However there are two configurable properties:

Traverse Folders
By default traverse folders is enabled. This means that the device extension will traverse all folders beneath the root “Points” folder and post the telemetry to the broker.

If traverse folders is disabled, the extension will only publish the immediate child components of the root “Points” to the broker.

Currently the thingsBoardConnector supports posting Numeric, Boolean, String & Enum types.

Key Format
In Thingboard telemetry is posted as { key: value } objects. The key format property allows you to BFormat the originator, which in our case is the point name of the telemetry.

For example:
If our point name is ZnTmp and our BFormat is %name% then our telemetry payload would become { ZnTmp: value } where value is equal to the current value of the object. There may be times where you don’t want to use the originator. In this case you can simple write the string name of the key in the key format property.

When an MqttDeviceExt is added to a device it self registers to the service. The property “Registered Device Count” on the MqttService indicates the number of registered devices.

Final Step:

Enable the MqttService, right-click the service and invoke the “Connect Broker” action. If the broker connects the status message will update the indicate “Connected”. If there is an issue connecting to the the broker, the status message will display the error. Detailed debugging can be enabled by unhiding the property “debugging” on the service and enabling it. You should then monitor the platform console for the debugging message.

If the broker connected successfully :partying_face: the telemetry will begin publishing to the broker at the interval define in the “Post Telemetry Interval” property on the server. However to test the publish with immediate effect you may manually invoke the action “Post Telemetry” on the service.

If you have any issues, feature request or anything else. Please feel free to ask for help on this topic.

Great write up and review - I have it on my Station. Question does it have to be a device? I placed it in a folder - it still get the points IF the folder is on a device but if its not it does not register it

You’re testing me, it has been a long time! I think it does but from memory under the service I added a container for mapping random points that aren’t under a device

EDIT: I did not, I just checked the source, it needs to be a device.

this an open source project or something your team/company has developed?

Just something I developed in my own time. Probably could use with some further work. Happy to make it open sourced

Yeah i think it needs some TLC was throwing some faults and freezing the station/wb
I dont have any “devices” so was just adding in devices that were in fault it was registering devices and points using 4.14 maybe that had something to do with it. If you are not interested in doing it let me know and I will take a look with some friends. I might ask the question to you why not make an Auth scheme to attach to a generic MQTT device rather than make your own one? i guess it takes the quess work out of the topic and combinging the payload?

Haven’t forgot, just on holidays :+1:

Hi Giantsbane, could you please point us to the code repo?