Last modified by Hera Guo on 2025/09/25 09:23

From version 11.1
edited by Chxy
on 2024/10/14 23:49
Change comment: There is no comment for this version
To version 22.1
edited by Hera Guo
on 2025/09/25 09:10
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.EdwinChen
1 +XWiki.hera
Content
... ... @@ -7,6 +7,7 @@
7 7  
8 8  = 1. Overview =
9 9  
10 +This instructions will show you how to connect a device that has been registered to the server to the Thingseye platform.
10 10  
11 11  
12 12  = 2. UDP Procotol  ~-~- Directly Connection =
... ... @@ -14,34 +14,21 @@
14 14  == 2.1 UDP Interface ==
15 15  
16 16  * Server Address: server1.thingseye.io
17 -* Port: 11562
18 +* Port: 11560
18 18  
19 19  The data sent to above UDP interface will not go directly to client's database.
20 20  
21 21  Please contact ThingsEye team for detail how to forward data to client.
22 22  
24 +**Note:Currently udp connections require port forwarding, please contact the ThingsEye team to inform them of your device's IMEI before connecting.**
23 23  
24 -== 2.2 Test UDP Interface via Socket Tool ==
25 25  
26 -Download the UDP Test Tool from:  [[https:~~/~~/sourceforge.net/projects/sockettest/ >>https://sourceforge.net/projects/sockettest/]]. Run this tool, and input the server address and UDP port  as below and click send.
27 +----
27 27  
28 -[[image:1728566363151-470.png]]
29 +== 2.2 Test with Dragino NB device ==
29 29  
30 -In server side, Tenant Administrator can check this in Tenant UDP Server location.
31 +=== 2.2.1 Configure NB-IoT End Node ===
31 31  
32 -[[image:1728362834430-749.png||height="510" width="1667"]]
33 -
34 -Click and see the debug info as below:
35 -
36 -[[image:1728363020699-203.png]]
37 -
38 -We can see the message arrives, but it shows ERROR because the message doesn't follow with the UDP Server format.
39 -
40 -
41 -== 2.3 Test with Dragino NB device ==
42 -
43 -=== 2.3.1 Configure NB-IoT End Node ===
44 -
45 45  Device here is **[[S31-NB>>https://www.dragino.com/products/temperature-humidity-sensor/item/288-s31-nb-s31b-nb.html]]** : and have been configure below
46 46  
47 47  * Set to use ThingsEye UDP server: **AT+SERVADDR=server1.thingseye.io,11560**
... ... @@ -50,50 +50,60 @@
50 50  
51 51  The S31-NB's cellular module has the IMEI: **863663062789483**
52 52  
41 +=== 2.2.2 Check Uplink Data ===
53 53  
54 -=== 2.3.2 Check Uplink Data ===
43 +Turn on debug mod
55 55  
45 +[[image:1758762334133-608.png||height="494" width="1003"]]
46 +
47 +----
48 +
56 56  Re-activate the S31-NB, and we can see it in the debug window:
57 57  
58 -[[image:1728378218744-800.png||height="431" width="1003"]]
51 +[[image:1758762371290-726.png||height="528" width="1005"]]
59 59  
53 +[[image:1728378218744-800.png||_mstalt="295269" height="431" width="1003"]]
60 60  
55 +
56 +----
57 +
61 61  === 2.3.3 Auto-Create Device ===
62 62  
63 63  The default **Tenant UDP Server** has already been configured to decode the Dragino -NB / -CB NB-IoT node. So once each end node sends a data to server. Tenant will auto create the device in the server.
64 64  
65 -[[image:1728378968101-683.png||height="273" width="1307"]]
62 +[[image:1728378968101-683.png||_mstalt="297154" height="210" width="1005"]]
66 66  
67 -[[image:1728379050044-764.png||height="424" width="1312"]]
64 +[[image:1728379050044-764.png||_mstalt="295282" height="326" width="1009"]]
68 68  
69 69  
70 70  **So we have this device in the Tenant Device List. The next step will be how to use these value to make a nice dashboard for user's application.**
71 71  
72 -
73 -
74 74  = 3.  Connect to The Things Stack =
75 75  
76 76  == 3.1 Network Structure ==
77 77  
73 +The network diagram below illustrates the connection between the devices and The Things Stack, as well as how the data can be integrated with the ThingsEye IoT platform.
78 78  
75 +[[image:1732679444539-853.jpg||_mstalt="296933" height="388" width="1452"]]
76 +
79 79  == 3.2 Creat Integration for The Things Stack. ==
80 80  
81 81  (% class="lead" %)
82 82  Add Integration
83 83  
84 -[[image:1728535775119-971.png||height="456" width="1087"]]
82 +[[image:1728535775119-971.png||_mstalt="297661" height="456" width="1087"]]
85 85  
86 86  
87 87  (% class="lead" %)
88 88  Choose Connection Type
89 89  
90 -[[image:1728535857345-950.png]]
88 +[[image:1728535857345-950.png||_mstalt="297154"]]
91 91  
92 92  
93 93  (% class="lead" %)
94 94  Input Uplink Data Converter Code
95 95  
96 -[[image:1728535941851-388.png||height="466" width="398"]]
94 +[[image:1728535941851-388.png||_mstalt="297856" height="466" width="398"]]
97 97  
98 98  Demo JavaScript Code: [[https:~~/~~/raw.githubusercontent.com/ThingsEye-io/te-platform/refs/heads/main/Data%20Converters/The_Things_Network_MQTT_Uplink_Converter.js >>https://raw.githubusercontent.com/ThingsEye-io/te-platform/refs/heads/main/Data%20Converters/The_Things_Network_MQTT_Uplink_Converter.js]]
99 99  
... ... @@ -101,7 +101,7 @@
101 101  (% class="lead" %)
102 102  Input Downlink Converter
103 103  
104 -[[image:1728536142721-488.png||height="470" width="407"]]
102 +[[image:1728536142721-488.png||_mstalt="296127" height="470" width="407"]]
105 105  
106 106  Example Javascript Code as below: [[https:~~/~~/raw.githubusercontent.com/ThingsEye-io/te-platform/refs/heads/main/Data%20Converters/The_Things_Network_MQTT_Downlink_Converter.js>>https://raw.githubusercontent.com/ThingsEye-io/te-platform/refs/heads/main/Data%20Converters/The_Things_Network_MQTT_Downlink_Converter.js]]
107 107  
... ... @@ -109,7 +109,7 @@
109 109  (% class="lead" %)
110 110  Set up Connection to The Things Network application
111 111  
112 -[[image:1728536305503-380.png||height="510" width="1206"]]
110 +[[image:1728536305503-380.png||_mstalt="293254" height="510" width="1206"]]
113 113  
114 114  
115 115  
... ... @@ -116,11 +116,11 @@
116 116  (% class="lead" %)
117 117  Test Connection & Add iIntegration
118 118  
119 -[[image:1728536374214-962.png]]
117 +[[image:1728536374214-962.png||_mstalt="295893"]]
120 120  
121 121  After add , we can see the integration here:
122 122  
123 -[[image:1728536420275-153.png||height="208" width="1404"]]
121 +[[image:1728536420275-153.png||_mstalt="293748" height="208" width="1404"]]
124 124  
125 125  
126 126  == 3.3 Test Uplink ==
... ... @@ -127,7 +127,211 @@
127 127  
128 128  We can use Simulate Uplink to simulate an uplink in the things stack. Then we should be able to see the message in ThingsEye
129 129  
130 -[[image:1728536524638-768.png||height="493" width="1071"]]
128 +[[image:1728536524638-768.png||_mstalt="298870" height="493" width="1071"]]
131 131  
132 132  
133 -[[image:1728536541040-814.png]]
131 +[[image:1728536541040-814.png||_mstalt="293215"]]
132 +
133 += 4.Connect chirpstack to Thingseye by way of MQTT =
134 +
135 +* **How to connect chirpstack to Thingseye by way of MQTT? The following tutorial will show you**
136 +
137 +== 4.1 Network Structure ==
138 +
139 +The network diagram below illustrates the connection between the devices andchirpstack, as well as how the data can be integrated with the ThingsEye IoT platform.
140 +
141 +[[image:1732679647697-982.jpg||_mstalt="299884" height="399" width="1492"]]
142 +
143 +== 4.2 Thingseye adds MQTT integration ==
144 +
145 +Go to the Integrations page in the Integrations center section. Click the plus button to start adding a new integration. Select the type "MQTT" integration and click "Next";
146 +
147 +[[image:1758762634175-353.png]]
148 +
149 +== 4.3 Add an uplink and downlink data converter ==
150 +
151 +In the function decoder field, specify the script to parse and transform the data.
152 +
153 +[[image:图片2.png||_mstalt="5131503"]]
154 +
155 +* **Uplink——JavaScript:**
156 +
157 +var data = decodeToJson(payload);
158 +
159 +var deviceName = data.deviceInfo.deviceName;
160 +
161 +var deviceType = data.applicationName;
162 +
163 +var devEui = data.deviceInfo.devEui
164 +
165 +var label = data.deviceInfo.devEui
166 +
167 +var model = {};
168 +
169 +var data2 = data.object;
170 +
171 +var flg = data.fPort
172 +
173 +for (var key in data2) {
174 +
175 + ~/~/ 将属性名存入新对象中
176 +
177 + model[key] = data2[key];
178 +
179 +}
180 +
181 +~/~/var obj = {"devid":deviceName}
182 +
183 +var result = {
184 +
185 + deviceName: deviceName,
186 +
187 + deviceType: deviceType,
188 +
189 + telemetry: model,
190 +
191 + groupName: "Case Study",
192 +
193 + ~/~/label:label,
194 +
195 + attributes:{"devEui":devEui,
196 +
197 + ~/~/"timevalue":"test",
198 +
199 + "inactivityTimeout":1260000
200 +
201 + ~/~/ "High_humidity_alarm":"not set",
202 +
203 + ~/~/ "High_temperature_alarm":"not set",
204 +
205 + ~/~/ "Low_humidity_alarm":"not set",
206 +
207 + ~/~/ "Low_temperature_alarm":"not set",
208 +
209 + ~/~/ "Low_voltage_alarm":"not set"
210 +
211 + ~/~/"customerName": "Civionic Engineering & Consulting (2014) Inc."
212 +
213 + }
214 +
215 +};
216 +
217 +function decodeToString(payload) {
218 +
219 + return String.fromCharCode.apply(String, payload);
220 +
221 +}
222 +
223 +function decodeToJson(payload) {
224 +
225 + var str = decodeToString(payload);
226 +
227 + var data = JSON.parse(str);
228 +
229 + return data;
230 +
231 +}
232 +
233 +return result;
234 +
235 +[[image:图片3.png||_mstalt="5131620"]]
236 +
237 +* **Dowblink——JavaScript:**
238 +
239 +~/~/ Encode downlink data from incoming Rule Engine message
240 +
241 +~/~/ msg - JSON message payload downlink message json
242 +
243 +~/~/ msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.
244 +
245 +~/~/ metadata - list of key-value pairs with additional data about the message
246 +
247 +~/~/ integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter
248 +
249 +~/~/ /~*~* Encoder ~*~*/
250 +
251 +~/~/var data = {"value":99};
252 +
253 +~/~/ ~/~/ Process data from incoming message and metadata
254 +
255 +~/~/ data.tempFreq = msg.temperatureUploadFrequency;
256 +
257 +~/~/ data.humFreq = msg.humidityUploadFrequency;
258 +
259 +~/~/ data.devSerialNumber = metadata['ss_serialNumber'];
260 +
261 +~/~/ ~/~/ Result object with encoded downlink payload
262 +
263 +var result = {
264 +
265 + ~/~/ downlink data content type: JSON, TEXT or BINARY (base64 format)
266 +
267 + contentType: "TEXT",
268 +
269 + ~/~/ downlink data
270 +
271 + data: msg.shared_value ,~/~/JSON.stringify(data),
272 +
273 + ~/~/ Optional metadata object presented in key/value format
274 +
275 + metadata: {
276 +
277 + topic: '/test/down/'+metadata.deviceName
278 +
279 + }
280 +
281 +};
282 +
283 +return result;
284 +
285 +== 4.4 Configure the connection ==
286 +
287 +Generate MQTT certificate integrated on chirpstack
288 +
289 +Chirpstack generates CA certificate, TLS certificate, and TLS key respectively
290 +
291 +They correspond to the CA certificate file, Certificate file, and Private key file on thingseye
292 +
293 +[[image:图片4.png||_mstalt="5131737"]]
294 +
295 +[[image:图片5.png||_mstalt="5131854" height="630" width="1269"]]
296 +
297 +* Copy the contents of the certificates and paste them into the linked file below, a total of three certificates are required
298 +
299 +**Integrated Certificate File demo Download Address:**
300 +
301 +[[https:~~/~~/github.com/ThingsEye-io/te-platform/tree/main/chirpstack>>https://github.com/ThingsEye-io/te-platform/tree/main/chirpstack]]
302 +
303 +Enter the server address Host: lns1.thingseye.io on the Connection configuration
304 +
305 +Port: 8883
306 +
307 +Credentials type: PEM
308 +
309 +Upload the certificate and key file
310 +
311 +[[image:图片6.png||_mstalt="5131971"]]
312 +
313 +[[image:图片7.png||_mstalt="5132088"]]
314 +
315 +The default for Topic is:
316 +
317 +application/**chirpstack application id**/device/+/event/up
318 +
319 +[[image:图片8.png||_mstalt="5132205"]]
320 +
321 +
322 +(% class="wikigeneratedid" %)
323 +[[image:屏幕截图 2024-11-25 095805.png||_mstalt="10831028" height="374" width="1272"]]
324 +
325 +== 4.5 Check the connection ==
326 +
327 +[[image:图片9.png||_mstalt="5132322"]]
328 +
329 +[[image:图片10.png||_mstalt="5142449"]]
330 +
331 += 5. Check Data Uplink Log =
332 +
333 +User can check the devices log in Intergration.
334 +
335 +[[image:1729562069134-315.png||_mstalt="294190" height="587" width="723"]]
1729562069134-315.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.EdwinChen
Size
... ... @@ -1,0 +1,1 @@
1 +67.5 KB
Content
1732678750938-753.jpg
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +173.5 KB
Content
1732679080974-799.jpg
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +176.4 KB
Content
1732679444539-853.jpg
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +180.5 KB
Content
1732679647697-982.jpg
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +179.2 KB
Content
1758762334133-608.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +161.4 KB
Content
1758762371290-726.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +215.2 KB
Content
1758762634175-353.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +213.8 KB
Content
图片1.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +123.1 KB
Content
图片10.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +173.4 KB
Content
图片2.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +163.3 KB
Content
图片3.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +124.8 KB
Content
图片4.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +68.8 KB
Content
图片5.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +98.5 KB
Content
图片6.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +136.5 KB
Content
图片7.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +143.5 KB
Content
图片8.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +151.0 KB
Content
图片9.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +134.6 KB
Content
屏幕截图 2024-11-25 095805.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +45.7 KB
Content
屏幕截图 2024-11-27 113616.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.hera
Size
... ... @@ -1,0 +1,1 @@
1 +117.5 KB
Content