Changes for page How to Uplink -NB and -CB series devices data by MQTT with Thingseye
Last modified by Alec Chen on 2025/04/02 18:03
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 -How to co mmuniceDragino-NB and -CB series devices data by MQTT with Thingseye1 +How to connect -NB and -CB series devices data by MQTT with Thingseye - Content
-
... ... @@ -1,5 +1,7 @@ 1 1 **Table of Contents:** 2 2 3 +{{toc/}} 4 + 3 3 = 1. Introduction = 4 4 5 5 This document guides you on integrating Dragino **-NB** and **-CB** series devices data with Thingseye. ... ... @@ -37,9 +37,9 @@ 37 37 38 38 [[image:https://wiki.dragino.com/xwiki/bin/download/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/WebHome/image-20230802112413-5.png?width=987&height=530&rev=1.1||alt="image-20230802112413-5.png" height="530" width="987"]] 39 39 40 -(% class="text-uppercase small mark" %)##**Notice: MQTT protocol has a much higher power consumption compare with UDP/CoAP protocol. Please check the power analyze document and adjust the uplink**##42 +(% class="mark small text-uppercase" %)##**Notice: MQTT protocol has a much higher power consumption compare with UDP/CoAP protocol. Please check the power analyze document and adjust the uplink**## 41 41 42 -(% class="text-uppercase small mark" %)##**period to a suitable interval.**##44 +(% class="mark small text-uppercase" %)##**period to a suitable interval.**## 43 43 44 44 = 4. Data Converters = 45 45 ... ... @@ -54,81 +54,6 @@ 54 54 [[image:1743578461281-635.png]] 55 55 56 56 57 - 58 - 59 -The **Add data converter** window will appear. 60 - 61 -Let's create an uplink data converter for the device named '**Device A**'. Name it ‘**MQTT Uplink Converter - Device A**’ and select the Type as **Uplink**. 62 - 63 -Click on the **TBEL** button if it has not been selected by default. 64 - 65 -Modify the default TBEL function to match with your device as described below: 66 - 67 -* Uncomment** line 11**: 68 - 69 -//var data = decodeToJson(payload)// 70 - 71 -* **Line 13**: Assign your device name to the **deviceName** field. - We used **Device A** as it is to match with our device, **Device A **in the Devices section. 72 -* From **line 38**: Modify the telemetry section to allow parsed data to be assigned to the fields. 73 - 74 -//telemetry: { 75 - temperature: data.temperature, 76 - humidity: data.humidity, 77 - rawData: payloadStr 78 - }// 79 - 80 -The modified uplink decoder function to match with **Device A** is shown below. 81 - 82 -{{code language="nono"}} 83 -// Decode an uplink message from a buffer 84 -// payload - array of bytes 85 -// metadata - key/value object 86 - 87 -/** Decoder **/ 88 - 89 -// decode payload to string 90 -var payloadStr = decodeToString(payload); 91 - 92 -// decode payload to JSON 93 -var data = decodeToJson(payload); 94 - 95 -var deviceName = 'Device A'; 96 -var deviceType = 'thermostat'; 97 -var customerName = 'Customer C'; 98 -var groupName = 'thermostat devices'; 99 -var manufacturer = 'Example corporation'; 100 -// use assetName and assetType instead of deviceName and deviceType 101 -// to automatically create assets instead of devices. 102 -// var assetName = 'Asset A'; 103 -// var assetType = 'building'; 104 - 105 -// Result object with device/asset attributes/telemetry data 106 -var result = { 107 -// Use deviceName and deviceType or assetName and assetType, but not both. 108 - deviceName: deviceName, 109 - deviceType: deviceType, 110 -// assetName: assetName, 111 -// assetType: assetType, 112 -// customerName: customerName, 113 - groupName: groupName, 114 - attributes: { 115 - model: 'Model A', 116 - serialNumber: 'SN111', 117 - integrationName: metadata['integrationName'], 118 - manufacturer: manufacturer 119 - }, 120 - telemetry: { 121 - temperature: data.temperature, 122 - humidity: data.humidity, 123 - rawData: payloadStr 124 - } 125 -}; 126 - 127 -/** Helper functions 'decodeToString' and 'decodeToJson' are already built-in **/ 128 - 129 -return result; 130 -{{/code}} 131 - 132 132 Once you modify the decoder function, click on the **Add** button. 133 133 134 134 [[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/ul-data-converter-device-a.png?width=500&height=524&rev=1.1||alt="ul-data-converter-device-a.png"]] ... ... @@ -241,10 +241,8 @@ 241 241 [[image:1743582084494-111.png]] 242 242 243 243 171 += 6. Configure Physical NB-IoT Sensor = 244 244 245 - 246 -= 8. Configure Physical NB-IoT Sensor = 247 - 248 248 Now, let's experiment with sending data to Thingseye using a real NB-IoT device. For example, we will use the **TS01-NB**. 249 249 250 250 First, configure the NB-IoT device with the necessary MQTT settings using AT commands. Below is a list of AT commands you can use.