|
ThingsBoard PE Feature Only Professional Edition supports Platform Integrations feature. Use ThingsBoard Cloud or install your own platform instance. |
Azure IoT Hub Integration allows to stream data from AWS IoT Backend to ThingsBoard and converts device payloads to the ThingsBoard format.
We have done all necessary steps on the Azure IoT Hub side. Now we can start configuring the Thingsboard.
First, we need to create Uplink Data converter that will be used for converting messages received from the Azure IoT Hub. The converter should transform incoming payload into the required message format. Message must contains deviceName and deviceType. Those fields are used for submitting data to the correct device. If a device was not found then new device will be created. Here is how demo payload from the Azure IoT Hub will look like:
{
"devName": "T1",
"msg": {
"temp": 42,
"humidity": 77
}
}
We will take devName and map it to the deviceName. But you can use another mapping in your specific use cases. Also, we will take the value of the temperature and humidity fields and use it as a device telemetry.
Go to Data Converters and create new uplink Converter with this function:
var data = decodeToJson(payload);
var deviceName = data.devName;
var deviceType = 'thermostat';
var result = {
deviceName: deviceName,
deviceType: deviceType,
telemetry: {
temperature: data.msg.temp,
humidity: data.msg.humidity
}
};
function decodeToString(payload) {
return String.fromCharCode.apply(String, payload);
}
function decodeToJson(payload) {
var str = decodeToString(payload);
var data = JSON.parse(str);
return data;
}
return result;
Next we will create Integration with Azure IoT Hub inside the Thingsboard. Open Integrations section and add new Integration with type Azure IoT Hub
Different Authentication credentials are supported for Azure IoT Hub:
If Shared Access Signature credentials type is selected, the following configuration should be provided:
If PEM credentials type is selected, the following configuration should be provided:
X.509 CA-signed authentication
Lets verify our integration. First, lets put message into uplink stream, so Thingsboard will fetch this message.
Open page with your Device and go to Message to Device.
Send test message to device.
Go to Device Group -> All -> T1 - you can see that
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.