ThingsBoard PE Feature Only ThingsBoard Professional Edition supports Platform Integrations feature. See ThingsBoard PE Installation Options to install ThingsBoard PE. |
UDP Integration allows to stream data from devices which use a UDP protocol to ThingsBoard and converts payloads of these devices into the ThingsBoard format.
Please note UDP Integration can be started only as Remote Integration. It could be started on the same machine, where TB instance is running, or you can start in on another machine, that has access over the network to the TB instance.
Please review the integration diagram to learn more.
In this tutorial, we will use:
Let’s assume that we have a sensor which is sending current temperature and humidity readings. Our sensor device SN-001 publishes it’s temperature and humidity readings to UDP Integration on 11560 port to the machine where UDP Integration is running.
For demo purposes we assume that our device is smart enough to send data in 3 different payload types:
[
{
"deviceName": "SN-001",
"deviceType": "default",
"temperature": 25.7,
"humidity": 69
}
]
You can select payload type based on your device capabilities and business cases.
Please note that on the machine, where UDP Integration is running, port 11560 must be opened for incoming connections - nc utility must be able to connect to UDP socket. In case you are running it locally, it should be fine without any additional changes.
Before setting up an UDP integration, you need to create an Uplink Converter that is a script for parsing and transforming the data received by UDP integration.
To create an Uplink Converter go to Data Converters section and Click Add new data converter —> Create new converter. Name it “UDP Uplink Converter” and select type Uplink. Use debug mode for now.
NOTE Although the Debug mode is very useful for development and troubleshooting, leaving it enabled in production mode may tremendously increase the disk space, used by the database, because all the debugging data is stored there. It is highly recommended to turn the Debug mode off when done debugging.
Choose device payload type to for decoder configuration
Now copy & paste the following script to the Decoder function section:
The purpose of the decoder function is to parse the incoming data and metadata to a format that ThingsBoard can consume. deviceName and deviceType are required, while attributes and telemetry are optional. attributes and telemetry are flat key-value objects. Nested objects are not supported. |
Now copy & paste the following script to the Decoder function section:
The purpose of the decoder function is to parse the incoming data and metadata to a format that ThingsBoard can consume. deviceName and deviceType are required, while attributes and telemetry are optional. attributes and telemetry are flat key-value objects. Nested objects are not supported. |
Now copy & paste the following script to the Decoder function section:
The purpose of the decoder function is to parse the incoming data and metadata to a format that ThingsBoard can consume. deviceName and deviceType are required, while attributes and telemetry are optional. attributes and telemetry are flat key-value objects. Nested objects are not supported. |
Now copy & paste the following script to the Decoder function section:
The purpose of the decoder function is to parse the incoming data and metadata to a format that ThingsBoard can consume. deviceName and deviceType are required, while attributes and telemetry are optional. attributes and telemetry are flat key-value objects. Nested objects are not supported. |
Currently UDP integration does not support Downlink functionality
Go to Integrations section and click Add new integration button. Name it UDP Integration, select type UDP, turn the Debug mode on and from drop-down menus add recently created Uplink converter.
As you mentioned Execute remotely is checked and can not be modified - UDP Integration can be only remote type.
Please note down Integration key and Integration secret - we will use these values later in the configuration on the remote UDP Integration itself.
By default UDP Integration will use 11560 port, but you can change this to any available port in your case.
We leave other options by default, but there is brief description of them:
Choose device payload type for Handler Configuration
Please select Handler Type as TEXT To parse payload properly, please make sure that next values are set:
|
Please select Handler Type as JSON |
Please select Handler Type as BINARY |
Please select Handler Type as HEX |
Click Add to save the Integration.
Please refer to the Remote Integration guide and install UDP Integration service locally or on separate machine.
Please use Integration key and Integration secret from the above section for your UDP Integration configuration.
Once ThingsBoard UDP Integration has been created, the UDP server starts, and then it waits for data from the devices.
Choose device payload type to send uplink message
The command to send a message to the UDP server that is running on localhost (127.0.0.1) will look like this:
|
The command to send a message to the UDP server that is running on localhost (127.0.0.1) will look like this:
|
The command to send a message to the UDP server that is running on localhost (127.0.0.1) will look like this:
|
The command to send a message to the UDP server that is running on localhost (127.0.0.1) will look like this:
|
Once you go to Device Groups -> All you should find a SN-001 device provisioned by the Integration. Click on the device, go to Latest Telemetry tab to see “temperature” key and its value (25.7) there.
If your payload contains humidity telemetry, you should see “humidity” key and its value (69) there as well.
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
Installation guides - Learn how to setup ThingsBoard on various available operating systems.
Data visualization - These guides contain instructions how to configure complex ThingsBoard dashboards.
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
IoT Data analytics - Learn how to use rule engine to perform basic analytics tasks.
Hardware samples - Learn how to connect various hardware platforms to ThingsBoard.
Advanced features - Learn about advanced ThingsBoard features.
Contribution and Development - Learn about contribution and development in ThingsBoard.