Wiki source code of How to Uplink -NB and -CB series devices data by MQTT with Thingseye
Last modified by Alec Chen on 2025/04/02 18:03
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
2.1 | 1 | **Table of Contents:** |
2 | |||
![]() |
1.1 | 3 | = 1. Introduction = |
4 | |||
5 | This document guides you on integrating Dragino **-NB** and **-CB** series devices data with Thingseye. | ||
6 | |||
7 | The **NB series** devices end with the suffix **-NB**, and the **CB series** devices end with the suffix **-CB**. For example, **S31B-NB** is an **NB device**, and **S31-CB** is a **CB device**. | ||
8 | |||
9 | = 2. Prerequisites = | ||
10 | |||
11 | To complete this tutorial, you need to have certificate files. [[lns1.thingseye.io>>url:http://lns1.thingseye.io/]] is the Dragino's MQTT broker, which requires a CA certificate file, Certificate file, and the Private key file to use. | ||
12 | |||
![]() |
2.2 | 13 | If customers need to use this MQTT connection with Thingseye, they need to contact TE team to obtain three license files or click this [[link>>url:https://www.dropbox.com/scl/fo/d5s1wf36f4syv30a8laup/AK8FjVpNXYXCWodRnnQ1Hig?rlkey=jrz1ip0f0xwwq5z2m2gu1tuij&e=1&st=kl4caub0&dl=0]] to download the certificates.. |
![]() |
1.1 | 14 | |
15 | [[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/ins1.png?width=500&height=310&rev=1.1||alt="ins1.png" height="310" width="500"]] | ||
16 | |||
17 | |||
![]() |
7.1 | 18 | = (% style="color:#333333; font-family:inherit; font-size:max(23px, min(29px, 12.3333px + 1.38889vw))" %)3. Configure Thingseye's Integration(%%) = |
![]() |
1.1 | 19 | |
![]() |
7.1 | 20 | == 3.1 Creat new MQTT integration == |
![]() |
1.1 | 21 | |
22 | In the left navigation, click **Integrations center**, and then click **Integrations**. | ||
23 | |||
24 | On the **Integrations** page, click on the '**+**' button. | ||
25 | |||
![]() |
2.2 | 26 | [[image:1743578691561-822.png]] |
27 | |||
28 | |||
![]() |
1.1 | 29 | The **Add integration** window appears. |
30 | |||
31 | In the **Add integration** window, configure the following settings: | ||
32 | |||
33 | **Basic settings:** | ||
34 | |||
35 | * **Integration type**: MQTT | ||
![]() |
2.2 | 36 | * **Name**: MQTT integration |
![]() |
1.1 | 37 | * **Enable integration**: YES |
![]() |
2.2 | 38 | * **Debug mode**:YES |
![]() |
1.1 | 39 | * **Allows create devices or assets**: YES |
40 | |||
41 | Click **Next** button. | ||
42 | |||
![]() |
2.2 | 43 | [[image:1743578960106-916.png||height="549" width="547"]] |
![]() |
1.1 | 44 | |
45 | |||
![]() |
2.2 | 46 | **Uplink/downlink data converter:** |
![]() |
1.1 | 47 | |
![]() |
2.2 | 48 | * ((( |
49 | Next, directly select to create a new Uplink data converter . | ||
50 | ))) | ||
51 | |||
![]() |
1.1 | 52 | Click **Next** button. |
53 | |||
![]() |
2.2 | 54 | [[image:1743581191958-140.png||height="547" width="543"]] |
![]() |
1.1 | 55 | |
![]() |
2.2 | 56 | |
57 | |||
![]() |
1.1 | 58 | **Downlink data converter:** |
59 | |||
![]() |
2.2 | 60 | * Next, directly select to create a new Uplink data converter . |
![]() |
1.1 | 61 | |
62 | Click **Skip** button. | ||
63 | |||
![]() |
2.2 | 64 | [[image:1743581287837-189.png||height="547" width="542"]] |
![]() |
1.1 | 65 | |
![]() |
2.2 | 66 | |
![]() |
1.1 | 67 | **Connection:** |
68 | |||
![]() |
2.2 | 69 | * **Host**: [[lns1.thingseye.io>>url:http://lns1.thingseye.io/]] |
![]() |
1.1 | 70 | * **Port**: 8883 |
![]() |
2.2 | 71 | * **Credentials **: PEM(Paste 3 certificates to boxs below)Click this [[link>>url:https://www.dropbox.com/scl/fo/d5s1wf36f4syv30a8laup/AK8FjVpNXYXCWodRnnQ1Hig?rlkey=jrz1ip0f0xwwq5z2m2gu1tuij&e=1&st=kl4caub0&dl=0]] to download the certificates. |
72 | * **Password:** Password or nothng | ||
![]() |
1.1 | 73 | * **Enable SSL**: YES |
![]() |
2.2 | 74 | * **Topic: ** **It needs to align with the device's topic.** |
75 | * **QoS:** 0-At most once or an MQTT QoS level | ||
![]() |
1.1 | 76 | |
![]() |
2.2 | 77 | Click **Skip** button. |
![]() |
1.1 | 78 | |
![]() |
2.2 | 79 | [[image:1743579352961-586.png||height="507" width="502"]] |
![]() |
1.1 | 80 | |
![]() |
7.1 | 81 | [[image:1743584347047-327.png]] |
![]() |
1.1 | 82 | |
83 | |||
![]() |
2.2 | 84 | Click on the **Add** button. |
![]() |
1.1 | 85 | |
![]() |
2.2 | 86 | You should see that the newly added integration is listed on the **Integrations** page. |
![]() |
1.1 | 87 | |
![]() |
2.2 | 88 | Since we haven't received data from a device yet, the integration **Status** is shown as **Pending, Active instead if it have.** |
![]() |
1.1 | 89 | |
![]() |
7.1 | 90 | [[image:1743580606618-281.png||height="495" width="504"]] |
![]() |
1.1 | 91 | |
92 | |||
![]() |
7.1 | 93 | = 4. Configure Thingseye's Data Converters = |
![]() |
1.1 | 94 | |
![]() |
7.1 | 95 | First, you need to download the [[**MQTT uplink/downlink JS** **code**>>url:https://www.dropbox.com/scl/fo/d5s1wf36f4syv30a8laup/AK8FjVpNXYXCWodRnnQ1Hig?rlkey=jrz1ip0f0xwwq5z2m2gu1tuij&e=1&st=kl4caub0&dl=0]]. |
![]() |
1.1 | 96 | |
![]() |
7.1 | 97 | In **Thingseye**, **Data Converters** are components used to transform incoming or outgoing data between different formats, typically to convert raw telemetry data from devices into a structured format that Thingseye can understand, or vice versa. |
![]() |
1.1 | 98 | |
![]() |
7.1 | 99 | == 4.1 Uplink == |
![]() |
1.1 | 100 | |
![]() |
2.2 | 101 | * **Uplink Converter** |
102 | |||
103 | The purpose of the decoder function is to parse the incoming data and metadata to a format that ThingsBoard can consume. | ||
104 | |||
105 | Go to the **Integrations center** -> **Data converters** page, and find that MQTT uplink converter that was newly created when the integration was created. | ||
106 | |||
107 | [[image:1743581830822-223.png]] | ||
108 | |||
109 | |||
110 | Enter edit mode and apply **MQTT uplink JS code** to this uplink converter. | ||
111 | |||
112 | [[image:1743581965585-763.png]] | ||
113 | |||
114 | |||
![]() |
7.1 | 115 | == 4.2 Downlink == |
![]() |
2.2 | 116 | |
![]() |
7.1 | 117 | * ((( |
118 | **Downlink Converter** | ||
119 | ))) | ||
120 | |||
![]() |
2.2 | 121 | Go to the **Integrations center** -> **Data converters** page, and find that MQTT downlink converter that was newly created when the integration was created. |
122 | |||
123 | |||
124 | Enter edit mode and apply **MQTT downlink JS code** to this downlink converter. | ||
125 | |||
126 | [[image:1743582084494-111.png]] | ||
127 | |||
128 | |||
![]() |
7.1 | 129 | == 4.3 Simulate with MQTT.fx == |
![]() |
2.2 | 130 | |
![]() |
7.1 | 131 | [[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-20241126191118-18.png?width=835&height=605&rev=1.1||alt="image-20241126191118-18.png"]] |
![]() |
1.1 | 132 | |
![]() |
7.1 | 133 | [[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-20241126193252-25.png?width=803&height=663&rev=1.1||alt="image-20241126193252-25.png"]] |
![]() |
1.1 | 134 | |
![]() |
7.1 | 135 | |
![]() |
9.1 | 136 | = 5. Test connect = |
![]() |
7.1 | 137 | |
![]() |
1.1 | 138 | **AT Commands** |
139 | |||
![]() |
7.1 | 140 | * **AT+PRO=3,5 **~/~/ Use MQTT Connection & Json Payload |
141 | * **AT+SERVADDR=lns1.thingseye.io,8883** | ||
142 | * **AT+SUBTOPIC=8899 **~/~/ Consistent with the Topic of MQTT integration created by ThingsEye | ||
143 | * **AT+PUBTOPIC=8899 **~/~/ Consistent with the Topic of MQTT integration created by ThingsEye | ||
144 | * **AT+CLIENT=NULL** | ||
145 | * **AT+UNAME=NULL** | ||
146 | * **AT+PWD=NULL** | ||
147 | * **AT+TLSMOD=1,2** | ||
![]() |
1.1 | 148 | |
![]() |
8.1 | 149 | (% class="box warningmessage" %) |
150 | ((( | ||
151 | Be careful, “ Topic” should be same of device & serve. If your device not belongs Dragino, address should be same of the broker which using. | ||
152 | ))) | ||
153 | |||
![]() |
7.1 | 154 | Test Uplink by click the button for 1~~3 seconds, the MQTT integration in ThingsEye allows you to view the data upstream from the device: |
![]() |
1.1 | 155 | |
156 | |||
![]() |
7.1 | 157 | |
158 | Go to **"Device" ** -> ** "Search Device"**, enter the ** IMEI** of the device to find the device. | ||
159 | |||
160 | |||
161 | |||
![]() |
8.1 | 162 |