Last modified by Alec Chen on 2025/04/02 18:03

From version 2.1
edited by Alec Chen
on 2025/04/02 14:49
Change comment: There is no comment for this version
To version 2.2
edited by Alec Chen
on 2025/04/02 16:28
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -How to integrating Dragino -NB and -CB series devices data with Thingseye
1 +How to communice Dragino -NB and -CB series devices data by MQTT with Thingseye
Content
... ... @@ -1,7 +1,5 @@
1 1  **Table of Contents:**
2 2  
3 -{{toc/}}
4 -
5 5  = 1. Introduction =
6 6  
7 7  This document guides you on integrating Dragino **-NB** and **-CB** series devices data with Thingseye.
... ... @@ -12,28 +12,36 @@
12 12  
13 13  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.
14 14  
15 -If customers need to use this MQTT connection with Thingseye, they need to contact the TE team to obtain three license files.
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..
16 16  
17 17  [[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"]]
18 18  
19 19  
20 -= 3. Creating Devices (Optional) =
18 += 3.General MQTT Connection =
21 21  
22 -**The following procedure is optional. If you haven't created any device in Thingseye first, Thingseye will automatically create a device for you based on the integration settings (the device name defined in the uplink decoder) just after it receives the first uplink from your device.Type your information message here.**
20 +The NB-IoT Sensor can send packet to server use MQTprotocol.
23 23  
24 -First, you need to create devices in Thingseye to represent your physical devices. For example, you can name it **Device A**, and the second device could be **Device B** or any name you prefer. The device name should be unique within the **Devices** space.
22 +Beloare the commands.
25 25  
26 -In the left navigation, click **Entities -> Devices**.
24 +**AT Commands:**
27 27  
28 -Click the **Add Device** button (the button with the **+** sign), and from the dropdown menu, click **Add new device**.
26 +{{code language="none"}}
27 +AT+PRO=3,0                           //  Set to use MQTT protocol to uplink, Payload Type select Hex payload.
28 +AT+SERVADDR=120.24.4.116,1883        //  Set MQTT server address and port
29 +AT+CLIENT=CLIENT                     //  Set up the CLIENT of MQTT
30 +AT+UNAME=UNAME                       //  Set the username of MQTT
31 +AT+PWD=PWD                           //  Set the password of MQTT
32 +AT+PUBTOPIC=NSE01_PUB                //  Set the sending topic of MQTT
33 +AT+SUBTOPIC=NSE01_SUB                //  Set the subscription topic of MQTT
34 +{{/code}}
29 29  
30 -In the **Add new device** dialog box, enter the device name in the **Name** text box. For example, we will use **Device A**.
36 +[[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-4.png?rev=1.1||alt="image-20230802112413-4.png"]]
31 31  
32 -Click the **Add** button.
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"]]
33 33  
34 -Skip the **connectivity testing** by clicking the **Close** button.
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**##
35 35  
36 -The device is created and listed on the **Devices** page. Note that its initial state is **Inactive** because it has not received any data yet.
42 +(% class="text-uppercase small mark" %)##**period to a suitable interval.**##
37 37  
38 38  = 4. Data Converters =
39 39  
... ... @@ -43,12 +43,13 @@
43 43  
44 44  In the left navigation, click **Integrations center**, and then click **Data converters**.
45 45  
46 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/data-converters-list-empty.png?rev=1.1||alt="data-converters-list-empty.png"]]
47 -
48 48  On the **Data converters** page, click on the ‘**+**’ button, and then click on the **Create new converter** from the dropdown menu.
49 49  
50 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/create-new-converter-menu.png?width=500&height=259&rev=1.1||alt="create-new-converter-menu.png"]]
54 +[[image:1743578461281-635.png]]
51 51  
56 +
57 +
58 +
52 52  The **Add data converter** window will appear.
53 53  
54 54  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**.
... ... @@ -132,12 +132,15 @@
132 132  
133 133  = 5. Add Integration =
134 134  
142 +== 5.1. Creat new MQTT integration ==
143 +
135 135  In the left navigation, click **Integrations center**, and then click **Integrations**.
136 136  
137 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/integrations-list-empty.png?rev=1.1||alt="integrations-list-empty.png"]]
138 -
139 139  On the **Integrations** page, click on the '**+**' button.
140 140  
148 +[[image:1743578691561-822.png]]
149 +
150 +
141 141  The **Add integration** window appears.
142 142  
143 143  In the **Add integration** window, configure the following settings:
... ... @@ -145,71 +145,99 @@
145 145  **Basic settings:**
146 146  
147 147  * **Integration type**: MQTT
148 -* **Name**: MQTT integration - Device A
158 +* **Name**: MQTT integration
149 149  * **Enable integration**: YES
160 +* **Debug mode**:YES
150 150  * **Allows create devices or assets**: YES
151 151  
152 152  Click **Next** button.
153 153  
154 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/add-integration-basic-settings.png?width=500&height=504&rev=1.2||alt="add-integration-basic-settings.png"]]
165 +[[image:1743578960106-916.png||height="549" width="547"]]
155 155  
156 -**Uplink data converter:**
157 157  
158 -* Click on the **Select existing** button.
159 -* **Uplink data converter**: Select **MQTT Uplink Converter NB/CB **from the dropdown list.
168 +**Uplink/downlink  data converter:**
160 160  
170 +* (((
171 +Next, directly select to create a new Uplink data converter .
172 +)))
173 +
161 161  Click **Next** button.
162 162  
163 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/add-integration-ul-data-converter.png?width=500&height=505&rev=1.1||alt="add-integration-ul-data-converter.png"]]
176 +[[image:1743581191958-140.png||height="547" width="543"]]
164 164  
165 -**Downlink data converter:**
166 166  
167 -Dragino NB/CB devices don't require a downlink data converter to decode their payloads, so you can skip this step.
168 168  
169 -* Click on the **Skip **button in the Downlink data converter section.
180 +**Downlink data converter:**
170 170  
182 +* Next, directly select to create a new Uplink data converter .
183 +
171 171  Click **Skip** button.
172 172  
173 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/integration-dl-skip.png?width=500&height=511&rev=1.1||alt="integration-dl-skip.png"]]
186 +[[image:1743581287837-189.png||height="547" width="542"]]
174 174  
188 +
175 175  **Connection:**
176 176  
177 -* **Host**: Host URL (Eg. **//011731f7xxxxxxxxxxxfbbedfc63f4.s1.eu.hivemq.cloud//**)
191 +* **Host**: [[lns1.thingseye.io>>url:http://lns1.thingseye.io/]]
178 178  * **Port**: 8883
179 -* **Credentials type**: Basic
180 -* **Username**: Username (from your HiveMQ Cloud Cluster with your credentials)
181 -* **Password:** Password (from your HiveMQ Cloud Cluster with your credentials)
193 +* **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.
194 +* **Password:** Password or nothng
182 182  * **Enable SSL**: YES
183 -* **Topic: device/a** (The topic can be anything; you can even use just the device name.)
184 -* **QoS:** 0-At most once
196 +* **Topic: ** **It needs to align with the device's topic.**
197 +* **QoS:** 0-At most once or an MQTT QoS level
185 185  
186 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/add-integartion-connection.png?width=500&height=505&rev=1.1||alt="add-integartion-connection.png"]]
199 +Click **Skip** button.
187 187  
188 -Click on the **Advanced settings** button.
201 +[[image:1743579352961-586.png||height="507" width="502"]]
189 189  
190 -* **Clean session:** YES
191 -* **Retained**: YES
203 +[[image:1743580606618-281.png||height="495" width="504"]]
192 192  
193 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/add-integration-connection-advanced-settings.png?width=500&height=510&rev=1.2||alt="add-integration-connection-advanced-settings.png"]]
194 194  
195 -Click on the **Check connection** button to verify the MQTT connection using the provided parameters.
206 +Click on the **Add** button.
196 196  
197 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/check-connection.png?width=300&height=83&rev=1.1||alt="check-connection.png"]]
208 +You should see that the newly added integration is listed on the **Integrations** page.
198 198  
199 -If the connection is successful, you will see the **Connected** message. If not, check your connection parameters again.
210 +Since we haven't received data from a device yet, the integration **Status** is shown as **Pending,  Active  instead if it have.**
200 200  
201 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/connection-success.png?width=500&height=511&rev=1.1||alt="connection-success.png"]]
202 202  
203 -Click on the **Add** button.
204 204  
205 -You should see that the newly added integration is listed on the **Integrations** page.
206 206  
207 -Since we haven't received data from a device yet, the integration **Status** is shown as **Pending.**
208 208  
209 -[[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/integration-added.png?rev=1.1||alt="integration-added.png"]]
216 +== 5.2. Setup uplink and downlink converters ==
210 210  
211 -= 6. Verifying the receipt of data from virtual devices =
218 +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]].
212 212  
220 +* **Uplink Converter**
221 +
222 +The purpose of the decoder function is to parse the incoming data and metadata to a format that ThingsBoard can consume.
223 +
224 +Go to the **Integrations center** -> **Data converters** page, and find that MQTT uplink converter that was newly created when the integration was created.
225 +
226 +[[image:1743581830822-223.png]]
227 +
228 +
229 +Enter edit mode and apply **MQTT uplink JS code** to this uplink converter.
230 +
231 +[[image:1743581965585-763.png]]
232 +
233 +
234 +* **Downlink Converter**
235 +
236 +Go to the **Integrations center** -> **Data converters** page, and find that MQTT downlink converter that was newly created when the integration was created.
237 +
238 +
239 +Enter edit mode and apply **MQTT downlink JS code** to this downlink converter.
240 +
241 +[[image:1743582084494-111.png]]
242 +
243 +[[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-20241126190737-17.png?width=1114&height=527&rev=1.1||alt="image-20241126190737-17.png" height="527" width="1114"]]
244 +
245 +
246 +
247 +== ==
248 +
249 +== 6. Verifying the receipt of data from virtual devices ==
250 +
213 213  == 6.1 How does it work? ==
214 214  
215 215  We use the Mosquitto MQTT client to simulate MQTT messages, acting as a virtual device. First, install the Mosquitto client on your computer from [[this link>>url:https://mosquitto.org/download/]]. The Mosquitto client publishes messages to the MQTT broker (HiveMQ) on a specified MQTT topic.
1743578461281-635.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +272.1 KB
Content
1743578691561-822.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +230.6 KB
Content
1743578748298-164.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +86.7 KB
Content
1743578921379-944.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +85.5 KB
Content
1743578960106-916.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +85.4 KB
Content
1743579352961-586.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +104.7 KB
Content
1743580188942-159.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +157.1 KB
Content
1743580264901-750.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +154.8 KB
Content
1743580288154-524.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +154.3 KB
Content
1743580307872-530.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +155.1 KB
Content
1743580606618-281.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +127.1 KB
Content
1743581191958-140.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +154.2 KB
Content
1743581219626-974.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +156.7 KB
Content
1743581287837-189.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +180.8 KB
Content
1743581830822-223.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +249.6 KB
Content
1743581965585-763.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +418.9 KB
Content
1743582084494-111.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Alec
Size
... ... @@ -1,0 +1,1 @@
1 +418.8 KB
Content