Skip to main content

ThingsBoard

ThingsBoard is an IoT Platform to manage Edge devices and process data streams. The hopit Edge ThingsBoard Target features Data streaming, Namespace discovery, Device Twin synchronization and remote Tasks execution. The communication protocol used to communicate with ThingsBoard is MQTT.

For further information visit the ThingsBoard documentation.

Configuration

ThingsBoard

A virtual device must be created on ThingsBoard and the transport type of the device profile must be MQTT.

The credentials for hopit Edge can be:

  • Access Token: Access Token from the IoT Device is used as Username in Target settings.
  • MQTT Basic Authentication: ClientID, Username and Password are set in ThingsBoard and the same are used in Target settings.

hopit Edge

The ThingsBoard Target has the following parameters:

  • Host (required): Host name of the ThingsBoard instance
  • Client ID: MQTT client ID, if not set generated automatically.
  • Username: The desired user name.
  • Password: The login password.
  • QoS: Quality of Service, select from:
    • AtMostOnce
    • AtLeastOnce
    • ExactlyOnce
  • ProtocolVersion: MQTT protocol version, select from:
    • V310
    • V311
    • V500
  • TargetType: The type is always ThingsBoard for this Target.

For the common parameters, see the Introduction.

Corresponding Edge configuration and Device Twin definition to activate the ThingsBoard Target service:
https://localhost:5050/Targets
ThingsBoard Target Settings

Data Streaming

MQTT messages will be sent to the /telemetry topic. All signals will be added to a flat JSON format.

A sample message could be

{
"signal-1": "value-1",
"signal-2": "value-2"
}

Signals can be also read with Regex matcher. See the Router documentation for details.

Signal discovery is available for this Target. See the Introduction for more details.

For information how signals are named and labeled in Data Lakes, please read the Data Lake documentation.

Device Twin

Device Twin updates are synchronized using the topic v1/devices/me/attributes if the Target is enabled in the Device Twin settings.

Report

If the Device Twin is changed on the Edge, all settings are published as JSON message to the Client Attribute DeviceTwinReported. Client Attributes are always read-only for ThingsBoard.

{ 
"DeviceTwinReported":{
"AdsRouter": {
"Enabled":false
},
"LogCollector": {
"Enabled":true
},
...
}
}

Desire

To update the Device Twin from ThingsBoard on the Edge device, publish the settings to the Shared Attribute DeviceTwinDesired. Shared Attributes can be updated by Dashboard Widgets or in the device settings.

{ 
"DeviceTwinDesired":{
"AdsRouter": {
"Enabled":true
}
}
}
info

Shared attributes have to be created by the user, while client attributes are registered automatically, when received.

Target or Route deletion

To delete a Target or a Route via the Device Twin, it have to be set to null.

The Device Twin documentation shows more details about the operation.

Tasks

To remotely execute Tasks on the Edge device, the ThingsBoard RPC (Remote Procedure Call) feature is used. To trigger a Task execution, publish a JSON message with the parameters method (the Task name) and params (the Task arguments). For example:

{"method":"Reboot","params":{}}

If a two way RPC call was executed, the Edge device will send back a response.

The JSON string can be generated by Dashboard Widgets at ThingsBoard:

RPC Widgets

Please read the Tasks for more information about Tasks.

Start Discovery Task

The StartDiscovery Task can only be executed from a remote target. See the Tasks documentation for details.

The namespace is sent back as Attribute DiscoveredSignals-[Target Name] with the JSON format:

{
"signal-1": "value-1",
"signal-2": "value-2",
...
}