Wiki source code of Connect Devices to ThingsEye

Last modified by Alec Chen on 2025/11/26 17:10

Hide last authors
Alec Chen 25.1 1 (% _mstvisible="1" %)
Chxy 1.1 2
3
Alec Chen 25.1 4 (% _mstvisible="1" %)
5 (% _msthash="777" _msttexthash="303537" _mstvisible="2" %)**Table of Contents:**
Chxy 1.1 6
Chxy 2.1 7 {{toc/}}
Chxy 1.1 8
Chxy 2.1 9
Alec Chen 25.1 10 (% _mstvisible="1" %)
11 = (% _msthash="757" _msttexthash="149552" _mstvisible="2" %)1. Overview(%%) =
Chxy 3.1 12
Alec Chen 25.1 13 (% _msthash="756" _msttexthash="7978490" _mstvisible="1" %)
Hera Guo 22.1 14 This instructions will show you how to connect a device that has been registered to the server to the Thingseye platform.
Chxy 3.1 15
Hera Guo 22.1 16
Alec Chen 26.1 17 = (% _msthash="755" _msttexthash="40707030" _mstvisible="2" %)2. UDP Protocol – Direct Connection(%%) =
Chxy 2.1 18
Alec Chen 25.2 19 (% _msthash="755" _msttexthash="40707030" _mstvisible="2" %)2.1 UDP Interface
Alec Chen 26.1 20 **Server Address: server1.thingseye.io
21 Port: 11560**
Alec Chen 25.2 22 Data sent to the above UDP interface will not directly enter the client's database.
Chxy 2.1 23
Alec Chen 25.2 24 (% _msthash="755" _msttexthash="40707030" _mstvisible="2" %)For detailed information on how to forward data to clients, please contact the ThingsEye team.
Chxy 1.1 25
Alec Chen 25.2 26 (% _msthash="755" _msttexthash="40707030" _mstvisible="2" %)Note: Currently, UDP connections require port forwarding. Please contact the ThingsEye team before connecting and provide them with your device's IMEI.
Chxy 1.1 27
28
Alec Chen 25.1 29 (% _mstvisible="1" %)
Hera Guo 22.1 30 ----
Chxy 1.1 31
Alec Chen 26.1 32 == (% _msthash="748" _msttexthash="55449407" _mstvisible="2" %)2.2 Testing with Dragino NB Device(%%) ==
Chxy 1.1 33
Alec Chen 26.1 34 === (% _msthash="748" _msttexthash="55449407" _mstvisible="2" %)2.2.1 Configuring the NB-IoT End Node(%%) ===
Chxy 1.1 35
Alec Chen 26.1 36 (% _msthash="748" _msttexthash="55449407" _mstvisible="2" %)The device here is an S31-NB, and it has been configured as follows:
Chxy 4.1 37
Alec Chen 26.1 38 (% _msthash="748" _msttexthash="55449407" _mstvisible="2" %)**Set to use the ThingsEye UDP server: AT+SERVADDR=server1.thingseye.io,11560**
Chxy 4.1 39
Alec Chen 26.1 40 (% _msthash="748" _msttexthash="55449407" _mstvisible="2" %)**Use UDP uplink and JSON protocol: AT+PRO=2,5**
Chxy 4.1 41
Alec Chen 26.1 42 (% _msthash="748" _msttexthash="55449407" _mstvisible="2" %)Equipped with an NB-IoT card to access the NB-IoT network.
Chxy 4.1 43
Alec Chen 26.1 44 (% _msthash="748" _msttexthash="55449407" _mstvisible="2" %)The S31-NB's cellular module IMEI is: 863663062789483
Hera Guo 22.1 45
Alec Chen 26.1 46 (% class="wikigeneratedid" _mstvisible="1" id="H2.2.268C067E54E0A884C6570636E" %)
47 (% _msthash="741" _msttexthash="30173117" _mstvisible="2" %)2.2.2 Check Uplink Data
48 Enable Debug Module
49
Alec Chen 25.1 50 (% _mstvisible="1" %)
51 (% _mstvisible="3" %)[[image:1758762334133-608.png||_mstalt="294801" _msthash="584" _mstvisible="5" height="494" width="1003"]]
Hera Guo 22.1 52
Alec Chen 25.1 53 (% _mstvisible="1" %)
Hera Guo 22.1 54 ----
55
Alec Chen 25.1 56 (% _msthash="739" _msttexthash="156775723" _mstvisible="1" %)
Alec Chen 26.1 57 After reactivating the S31-NB, we can see it in the debug window:
Chxy 4.1 58
Alec Chen 25.1 59 (% _mstvisible="1" %)
60 (% _mstvisible="3" %)[[image:1758762371290-726.png||_mstalt="296088" _msthash="586" _mstvisible="5" height="528" width="1005"]]
Chxy 4.1 61
Alec Chen 25.1 62 (% _mstvisible="1" %)
63 (% _mstvisible="3" %)[[image:1728378218744-800.png||_mstalt="295269" _msthash="588" _mstvisible="5" height="431" width="1003"]]
Hera Guo 22.1 64
65 ----
66
Alec Chen 28.1 67 === 2.2.2 Automatic Device Creation ===
Alec Chen 27.1 68
Alec Chen 28.1 69 (% class="wikigeneratedid" %)
70 The default tenant UDP server is already configured to decode Dragino-NB/-CB NB-IoT nodes. Therefore, each end node sends data to the server. The tenant will automatically create devices on the server.
Chxy 4.1 71
Alec Chen 25.1 72 (% _mstvisible="1" %)
73 (% _mstvisible="3" %)[[image:1728378968101-683.png||_mstalt="297154" _msthash="590" _mstvisible="5" height="210" width="1005"]]
Chxy 4.1 74
Alec Chen 25.1 75 (% _mstvisible="1" %)
76 (% _mstvisible="3" %)[[image:1728379050044-764.png||_mstalt="295282" _msthash="592" _mstvisible="5" height="326" width="1009"]]
Chxy 4.1 77
78
Alec Chen 25.1 79 (% _mstvisible="1" %)
Hera Guo 23.1 80 ----
Chxy 4.1 81
Alec Chen 25.1 82 (% _mstvisible="1" %)
83 = (% _msthash="736" _msttexthash="622947" _mstvisible="2" %)3.  Connect to The Things Stack(%%) =
Chxy 8.1 84
Alec Chen 25.1 85 (% _mstvisible="1" %)
86 == (% _msthash="735" _msttexthash="410280" _mstvisible="2" %)3.1 Network Structure(%%) ==
Chxy 8.1 87
Alec Chen 25.1 88 (% _msthash="734" _msttexthash="14835652" _mstvisible="1" %)
Hera Guo 18.1 89 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.
Chxy 8.1 90
Alec Chen 25.1 91 (% _mstvisible="1" %)
92 (% _mstvisible="3" %)[[image:1732679444539-853.jpg||_mstalt="296933" _msthash="594" _mstvisible="5" height="388" width="1452"]]
Hera Guo 18.1 93
Alec Chen 25.1 94 (% _mstvisible="1" %)
95 == (% _msthash="733" _msttexthash="1191008" _mstvisible="2" %)3.2 Creat Integration for The Things Stack.(%%) ==
Chxy 8.1 96
Alec Chen 25.2 97 (% class="lead" _msthash="732" _msttexthash="255775" _mstvisible="1" %)
Chxy 8.1 98 Add Integration
99
Alec Chen 25.1 100 (% _mstvisible="1" %)
101 (% _mstvisible="3" %)[[image:1728535775119-971.png||_mstalt="297661" _msthash="596" _mstvisible="5" height="423" width="1007"]]
Chxy 8.1 102
103
Alec Chen 25.2 104 (% class="lead" _msthash="731" _msttexthash="448994" _mstvisible="1" %)
Chxy 8.1 105 Choose Connection Type
106
Alec Chen 25.1 107 (% _mstvisible="1" %)
108 (% _mstvisible="3" %)[[image:1728535857345-950.png||_mstalt="297154" _msthash="598" _mstvisible="5" height="257" width="403"]]
Chxy 8.1 109
110
Alec Chen 25.2 111 (% class="lead" _msthash="730" _msttexthash="762996" _mstvisible="1" %)
Chxy 8.1 112 Input Uplink Data Converter Code
113
Alec Chen 25.1 114 (% _mstvisible="1" %)
115 (% _mstvisible="3" %)[[image:1728535941851-388.png||_mstalt="297856" _msthash="600" _mstvisible="5" height="466" width="398"]]
Chxy 8.1 116
Alec Chen 25.1 117 (% _msthash="729" _msttexthash="16454490" _mstvisible="1" %)
Chxy 11.1 118 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]]
Chxy 8.1 119
120
Alec Chen 25.2 121 (% class="lead" _msthash="728" _msttexthash="532480" _mstvisible="1" %)
Chxy 8.1 122 Input Downlink Converter
123
Alec Chen 25.1 124 (% _mstvisible="1" %)
125 (% _mstvisible="3" %)[[image:1728536142721-488.png||_mstalt="296127" _msthash="602" _mstvisible="5" height="470" width="407"]]
Chxy 8.1 126
Alec Chen 25.1 127 (% _msthash="727" _msttexthash="19064695" _mstvisible="1" %)
Chxy 11.1 128 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]]
Chxy 8.1 129
130
Alec Chen 25.2 131 (% class="lead" _msthash="726" _msttexthash="1724853" _mstvisible="1" %)
Chxy 8.1 132 Set up Connection to The Things Network application
133
Alec Chen 25.1 134 (% _mstvisible="1" %)
135 (% _mstvisible="3" %)[[image:1728536305503-380.png||_mstalt="293254" _msthash="604" _mstvisible="5" height="431" width="1019"]]
Chxy 8.1 136
137
138
Alec Chen 25.2 139 (% class="lead" _msthash="725" _msttexthash="851097" _mstvisible="1" %)
Chxy 8.1 140 Test Connection & Add iIntegration
141
Alec Chen 25.1 142 (% _mstvisible="1" %)
143 (% _mstvisible="3" %)[[image:1728536374214-962.png||_mstalt="295893" _msthash="606" _mstvisible="5" height="380" width="1024"]]
Chxy 8.1 144
Alec Chen 25.1 145 (% _msthash="724" _msttexthash="1177579" _mstvisible="1" %)
Chxy 8.1 146 After add , we can see the integration here:
147
Alec Chen 25.1 148 (% _mstvisible="1" %)
149 (% _mstvisible="3" %)[[image:1728536420275-153.png||_mstalt="293748" _msthash="608" _mstvisible="5" height="152" width="1026"]]
Chxy 8.1 150
151
Alec Chen 25.1 152 (% _mstvisible="1" %)
153 == (% _msthash="723" _msttexthash="213447" _mstvisible="2" %)3.3 Test Uplink(%%) ==
Chxy 8.1 154
Alec Chen 25.1 155 (% _msthash="722" _msttexthash="7855835" _mstvisible="1" %)
Chxy 8.1 156 We can use Simulate Uplink to simulate an uplink in the things stack. Then we should be able to see the message in ThingsEye
157
Alec Chen 25.1 158 (% _mstvisible="1" %)
159 (% _mstvisible="3" %)[[image:1728536524638-768.png||_mstalt="298870" _msthash="610" _mstvisible="5" height="473" width="1028"]]
Chxy 8.1 160
161
Alec Chen 25.1 162 (% _mstvisible="1" %)
163 (% _mstvisible="3" %)[[image:1728536541040-814.png||_mstalt="293215" _msthash="612" _mstvisible="5" height="424" width="1026"]]
Chxy 13.1 164
Hera Guo 23.1 165
Alec Chen 25.1 166 (% _mstvisible="1" %)
Hera Guo 24.1 167 ----
Hera Guo 23.1 168
Alec Chen 25.1 169 (% _mstvisible="1" %)
170 = (% _msthash="721" _msttexthash="1472211" _mstvisible="2" %)4.Connect chirpstack to Thingseye by way of MQTT(%%) =
Chxy 13.1 171
Alec Chen 25.1 172 (% _mstvisible="1" %)
173 * (% _msthash="720" _msttexthash="4693741" _mstvisible="3" %)**How to connect chirpstack to Thingseye by way of MQTT? The following tutorial will show you**
Chxy 13.1 174
Alec Chen 25.1 175 (% _mstvisible="1" %)
176 == (% _msthash="719" _msttexthash="410371" _mstvisible="2" %)4.1 Network Structure(%%) ==
Chxy 13.1 177
Alec Chen 25.1 178 (% _msthash="718" _msttexthash="14117480" _mstvisible="1" %)
Hera Guo 18.1 179 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.
180
Alec Chen 25.1 181 (% _mstvisible="1" %)
182 (% _mstvisible="3" %)[[image:1732679647697-982.jpg||_mstalt="299884" _msthash="614" _mstvisible="5" height="399" width="1492"]]
Hera Guo 18.1 183
Alec Chen 25.1 184 (% _mstvisible="1" %)
185 == (% _msthash="717" _msttexthash="897286" _mstvisible="2" %)4.2 Thingseye adds MQTT integration(%%) ==
Hera Guo 18.1 186
Alec Chen 25.1 187 (% _msthash="716" _msttexthash="15186782" _mstvisible="1" %)
Hera Guo 15.1 188 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";
189
Alec Chen 25.1 190 (% _mstvisible="1" %)
191 (% _mstvisible="3" %)[[image:1758762634175-353.png||_mstalt="295893" _msthash="616" _mstvisible="5" height="783" width="1020"]]
Hera Guo 15.1 192
Alec Chen 25.1 193 (% _mstvisible="1" %)
194 == (% _msthash="715" _msttexthash="1329445" _mstvisible="2" %)4.3 Add an uplink and downlink data converter(%%) ==
Hera Guo 15.1 195
Alec Chen 25.1 196 (% _msthash="714" _msttexthash="4516408" _mstvisible="1" %)
Hera Guo 23.1 197 In the function decoder field, specify the uplink script to parse and transform the data.
Hera Guo 15.1 198
Alec Chen 25.1 199 (% _mstvisible="1" %)
200 (% _mstvisible="3" %)[[image:1758763061703-634.png||_mstalt="294671" _msthash="618" _mstvisible="5" height="783" width="1020"]]
Hera Guo 15.1 201
Alec Chen 25.1 202 (% _mstvisible="1" %)
203 * (% _msthash="713" _msttexthash="24445408" _mstvisible="3" %)**Uplink——JavaScript:**
Hera Guo 15.1 204
Alec Chen 25.1 205 (% _msthash="712" _msttexthash="792233" _mstvisible="1" %)
Hera Guo 15.1 206 var data = decodeToJson(payload);
207
Alec Chen 25.1 208 (% _msthash="711" _msttexthash="1379794" _mstvisible="1" %)
Hera Guo 15.1 209 var deviceName = data.deviceInfo.deviceName;
210
Alec Chen 25.1 211 (% _msthash="710" _msttexthash="1079247" _mstvisible="1" %)
Hera Guo 15.1 212 var deviceType = data.applicationName;
213
Alec Chen 25.1 214 (% _msthash="709" _msttexthash="909376" _mstvisible="1" %)
Hera Guo 15.1 215 var devEui = data.deviceInfo.devEui
216
Alec Chen 25.1 217 (% _msthash="708" _msttexthash="861510" _mstvisible="1" %)
Hera Guo 15.1 218 var label = data.deviceInfo.devEui
219
Alec Chen 25.1 220 (% _msthash="707" _msttexthash="195442" _mstvisible="1" %)
Hera Guo 15.1 221 var model = {};
222
Alec Chen 25.1 223 (% _msthash="706" _msttexthash="435448" _mstvisible="1" %)
Hera Guo 15.1 224 var data2 = data.object;
225
Alec Chen 25.1 226 (% _msthash="705" _msttexthash="326274" _mstvisible="1" %)
Hera Guo 15.1 227 var flg = data.fPort
228
Alec Chen 25.1 229 (% _msthash="704" _msttexthash="380965" _mstvisible="1" %)
Hera Guo 15.1 230 for (var key in data2) {
231
Alec Chen 25.1 232 (% _msthash="703" _msttexthash="43058977" _mstvisible="1" %)
Hera Guo 15.1 233 ~/~/ 将属性名存入新对象中
234
Alec Chen 25.1 235 (% _msthash="702" _msttexthash="475553" _mstvisible="1" %)
Hera Guo 15.1 236 model[key] = data2[key];
237
Alec Chen 25.1 238 (% _mstvisible="1" %)
Hera Guo 15.1 239 }
240
Alec Chen 25.1 241 (% _msthash="701" _msttexthash="757653" _mstvisible="1" %)
Hera Guo 15.1 242 ~/~/var obj = {"devid":deviceName}
243
Alec Chen 25.1 244 (% _msthash="700" _msttexthash="183287" _mstvisible="1" %)
Hera Guo 15.1 245 var result = {
246
Alec Chen 25.1 247 (% _msthash="699" _msttexthash="473265" _mstvisible="1" %)
Hera Guo 15.1 248 deviceName: deviceName,
249
Alec Chen 25.1 250 (% _msthash="698" _msttexthash="489918" _mstvisible="1" %)
Hera Guo 15.1 251 deviceType: deviceType,
252
Alec Chen 25.1 253 (% _msthash="697" _msttexthash="297271" _mstvisible="1" %)
Hera Guo 15.1 254 telemetry: model,
255
Alec Chen 25.1 256 (% _msthash="696" _msttexthash="446498" _mstvisible="1" %)
Hera Guo 15.1 257 groupName: "Case Study",
258
Alec Chen 25.1 259 (% _msthash="695" _msttexthash="217633" _mstvisible="1" %)
Hera Guo 15.1 260 ~/~/label:label,
261
Alec Chen 25.1 262 (% _msthash="694" _msttexthash="685984" _mstvisible="1" %)
Hera Guo 15.1 263 attributes:{"devEui":devEui,
264
Alec Chen 25.1 265 (% _msthash="693" _msttexthash="386308" _mstvisible="1" %)
Hera Guo 15.1 266 ~/~/"timevalue":"test",
267
Alec Chen 25.1 268 (% _msthash="692" _msttexthash="551772" _mstvisible="1" %)
Hera Guo 15.1 269 "inactivityTimeout":1260000
270
Alec Chen 25.1 271 (% _msthash="691" _msttexthash="894530" _mstvisible="1" %)
Hera Guo 15.1 272 ~/~/ "High_humidity_alarm":"not set",
273
Alec Chen 25.1 274 (% _msthash="690" _msttexthash="1052753" _mstvisible="1" %)
Hera Guo 15.1 275 ~/~/ "High_temperature_alarm":"not set",
276
Alec Chen 25.1 277 (% _msthash="689" _msttexthash="848783" _mstvisible="1" %)
Hera Guo 15.1 278 ~/~/ "Low_humidity_alarm":"not set",
279
Alec Chen 25.1 280 (% _msthash="688" _msttexthash="1002833" _mstvisible="1" %)
Hera Guo 15.1 281 ~/~/ "Low_temperature_alarm":"not set",
282
Alec Chen 25.1 283 (% _msthash="687" _msttexthash="773682" _mstvisible="1" %)
Hera Guo 15.1 284 ~/~/ "Low_voltage_alarm":"not set"
285
Alec Chen 25.1 286 (% _msthash="686" _msttexthash="2381015" _mstvisible="1" %)
Hera Guo 15.1 287 ~/~/"customerName": "Civionic Engineering & Consulting (2014) Inc."
288
Alec Chen 25.1 289 (% _mstvisible="1" %)
Hera Guo 15.1 290 }
291
Alec Chen 25.1 292 (% _mstvisible="1" %)
Hera Guo 15.1 293 };
294
Alec Chen 25.1 295 (% _msthash="685" _msttexthash="937586" _mstvisible="1" %)
Hera Guo 15.1 296 function decodeToString(payload) {
297
Alec Chen 25.1 298 (% _msthash="684" _msttexthash="1818154" _mstvisible="1" %)
Hera Guo 15.1 299 return String.fromCharCode.apply(String, payload);
300
Alec Chen 25.1 301 (% _mstvisible="1" %)
Hera Guo 15.1 302 }
303
Alec Chen 25.1 304 (% _msthash="683" _msttexthash="834496" _mstvisible="1" %)
Hera Guo 15.1 305 function decodeToJson(payload) {
306
Alec Chen 25.1 307 (% _msthash="682" _msttexthash="850616" _mstvisible="1" %)
Hera Guo 15.1 308 var str = decodeToString(payload);
309
Alec Chen 25.1 310 (% _msthash="681" _msttexthash="512044" _mstvisible="1" %)
Hera Guo 15.1 311 var data = JSON.parse(str);
312
Alec Chen 25.1 313 (% _msthash="680" _msttexthash="173511" _mstvisible="1" %)
Hera Guo 15.1 314 return data;
315
Alec Chen 25.1 316 (% _mstvisible="1" %)
Hera Guo 15.1 317 }
318
Alec Chen 25.1 319 (% _msthash="679" _msttexthash="233116" _mstvisible="1" %)
Hera Guo 15.1 320 return result;
321
Alec Chen 25.1 322 (% _mstvisible="1" %)
Hera Guo 23.1 323 ----
Hera Guo 15.1 324
Alec Chen 25.1 325 (% _msthash="678" _msttexthash="4743882" _mstvisible="1" %)
Hera Guo 23.1 326 In the function decoder field, specify the downlink script to parse and transform the data.
327
Alec Chen 25.1 328 (% _mstvisible="1" %)
329 (% _mstvisible="3" %)[[image:1758763019466-819.png||_mstalt="298311" _msthash="620" _mstvisible="5" height="787" width="1022"]]
Hera Guo 23.1 330
Alec Chen 25.1 331 (% _mstvisible="1" %)
332 * (% _msthash="677" _msttexthash="26632970" _mstvisible="3" %)**Dowblink——JavaScript:**
Hera Guo 15.1 333
Alec Chen 25.1 334 (% _msthash="676" _msttexthash="2052284" _mstvisible="1" %)
Hera Guo 15.1 335 ~/~/ Encode downlink data from incoming Rule Engine message
336
Alec Chen 25.1 337 (% _msthash="675" _msttexthash="1638546" _mstvisible="1" %)
Hera Guo 15.1 338 ~/~/ msg - JSON message payload downlink message json
339
Alec Chen 25.1 340 (% _msthash="674" _msttexthash="3854773" _mstvisible="1" %)
Hera Guo 15.1 341 ~/~/ msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.
342
Alec Chen 25.1 343 (% _msthash="673" _msttexthash="3368742" _mstvisible="1" %)
Hera Guo 15.1 344 ~/~/ metadata - list of key-value pairs with additional data about the message
345
Alec Chen 25.1 346 (% _msthash="672" _msttexthash="8087157" _mstvisible="1" %)
Hera Guo 15.1 347 ~/~/ integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter
348
Alec Chen 25.1 349 (% _msthash="671" _msttexthash="199069" _mstvisible="1" %)
Hera Guo 15.1 350 ~/~/ /~*~* Encoder ~*~*/
351
Alec Chen 25.1 352 (% _msthash="670" _msttexthash="455715" _mstvisible="1" %)
Hera Guo 15.1 353 ~/~/var data = {"value":99};
354
Alec Chen 25.1 355 (% _msthash="669" _msttexthash="1757431" _mstvisible="1" %)
Hera Guo 15.1 356 ~/~/ ~/~/ Process data from incoming message and metadata
357
Alec Chen 25.1 358 (% _msthash="668" _msttexthash="1852279" _mstvisible="1" %)
Hera Guo 15.1 359 ~/~/ data.tempFreq = msg.temperatureUploadFrequency;
360
Alec Chen 25.1 361 (% _msthash="667" _msttexthash="1572038" _mstvisible="1" %)
Hera Guo 15.1 362 ~/~/ data.humFreq = msg.humidityUploadFrequency;
363
Alec Chen 25.1 364 (% _msthash="666" _msttexthash="2049957" _mstvisible="1" %)
Hera Guo 15.1 365 ~/~/ data.devSerialNumber = metadata['ss_serialNumber'];
366
Alec Chen 25.1 367 (% _msthash="665" _msttexthash="1576731" _mstvisible="1" %)
Hera Guo 15.1 368 ~/~/ ~/~/ Result object with encoded downlink payload
369
Alec Chen 25.1 370 (% _msthash="664" _msttexthash="183287" _mstvisible="1" %)
Hera Guo 15.1 371 var result = {
372
Alec Chen 25.1 373 (% _msthash="663" _msttexthash="2331082" _mstvisible="1" %)
Hera Guo 15.1 374 ~/~/ downlink data content type: JSON, TEXT or BINARY (base64 format)
375
Alec Chen 25.1 376 (% _msthash="662" _msttexthash="322049" _mstvisible="1" %)
Hera Guo 15.1 377 contentType: "TEXT",
378
Alec Chen 25.1 379 (% _msthash="661" _msttexthash="249210" _mstvisible="1" %)
Hera Guo 15.1 380 ~/~/ downlink data
381
Alec Chen 25.1 382 (% _msthash="660" _msttexthash="1524952" _mstvisible="1" %)
Hera Guo 15.1 383 data: msg.shared_value ,~/~/JSON.stringify(data),
384
Alec Chen 25.1 385 (% _msthash="659" _msttexthash="2147704" _mstvisible="1" %)
Hera Guo 15.1 386 ~/~/ Optional metadata object presented in key/value format
387
Alec Chen 25.1 388 (% _msthash="658" _msttexthash="150189" _mstvisible="1" %)
Hera Guo 15.1 389 metadata: {
390
Alec Chen 25.1 391 (% _msthash="657" _msttexthash="1241370" _mstvisible="1" %)
Hera Guo 15.1 392 topic: '/test/down/'+metadata.deviceName
393
Alec Chen 25.1 394 (% _mstvisible="1" %)
Hera Guo 15.1 395 }
396
Alec Chen 25.1 397 (% _mstvisible="1" %)
Hera Guo 15.1 398 };
399
Alec Chen 25.1 400 (% _msthash="656" _msttexthash="233116" _mstvisible="1" %)
Hera Guo 15.1 401 return result;
402
Alec Chen 25.1 403 (% _mstvisible="1" %)
Hera Guo 23.1 404 ----
405
Alec Chen 25.1 406 (% _mstvisible="1" %)
407 == (% _msthash="655" _msttexthash="640094" _mstvisible="2" %)4.4 Configure the connection(%%) ==
Hera Guo 15.1 408
Alec Chen 25.1 409 (% _msthash="654" _msttexthash="1780675" _mstvisible="1" %)
Hera Guo 15.1 410 Generate MQTT certificate integrated on chirpstack
411
Alec Chen 25.1 412 (% _msthash="653" _msttexthash="3723447" _mstvisible="1" %)
Hera Guo 15.1 413 Chirpstack generates CA certificate, TLS certificate, and TLS key respectively
414
Alec Chen 25.1 415 (% _msthash="652" _msttexthash="5123092" _mstvisible="1" %)
Hera Guo 15.1 416 They correspond to the CA certificate file, Certificate file, and Private key file on thingseye
417
Alec Chen 25.1 418 (% _mstvisible="1" %)
419 (% _mstvisible="3" %)[[image:图片4.png||_mstalt="5131737" _msthash="622" _mstvisible="5" height="504" width="1016"]]
Hera Guo 15.1 420
Alec Chen 25.1 421 (% _mstvisible="1" %)
422 (% _mstvisible="3" %)[[image:图片5.png||_mstalt="5131854" _msthash="624" _mstvisible="5" height="505" width="1017"]]
Hera Guo 15.1 423
Alec Chen 25.1 424 (% _mstvisible="1" %)
Hera Guo 15.1 425 * Copy the contents of the certificates and paste them into the linked file below, a total of three certificates are required
426
Alec Chen 25.1 427 (% _mstvisible="1" %)
428 (% _msthash="650" _msttexthash="44967858" _mstvisible="2" %)**Integrated Certificate File demo Download Address:**
Hera Guo 15.1 429
Alec Chen 25.1 430 (% _mstvisible="1" %)
431 [[https:~~/~~/github.com/ThingsEye-io/te-platform/tree/main/chirpstack>>https://github.com/ThingsEye-io/te-platform/tree/main/chirpstack||_msthash="649" _msttexthash="3132909" _mstvisible="2"]]
Hera Guo 15.1 432
Alec Chen 25.1 433 (% _msthash="648" _msttexthash="4037631" _mstvisible="1" %)
Hera Guo 15.1 434 Enter the server address Host: lns1.thingseye.io on the Connection configuration
435
Alec Chen 25.1 436 (% _msthash="647" _msttexthash="93873" _mstvisible="1" %)
Hera Guo 15.1 437 Port: 8883
438
Alec Chen 25.1 439 (% _msthash="646" _msttexthash="380666" _mstvisible="1" %)
Hera Guo 15.1 440 Credentials type: PEM
441
Alec Chen 25.1 442 (% _msthash="645" _msttexthash="880399" _mstvisible="1" %)
Hera Guo 15.1 443 Upload the certificate and key file
444
Alec Chen 25.1 445 (% _mstvisible="1" %)
446 (% _mstvisible="3" %)[[image:图片6.png||_mstalt="5131971" _msthash="626" _mstvisible="5" height="509" width="1026"]]
Hera Guo 15.1 447
Alec Chen 25.1 448 (% _mstvisible="1" %)
449 (% _mstvisible="3" %)[[image:图片7.png||_mstalt="5132088" _msthash="628" _mstvisible="5" height="509" width="1025"]]
Hera Guo 15.1 450
Alec Chen 25.1 451 (% _mstvisible="1" %)
Hera Guo 24.1 452 ----
453
Alec Chen 25.1 454 (% _msthash="644" _msttexthash="472992" _mstvisible="1" %)
Hera Guo 15.1 455 The default for Topic is:
456
Alec Chen 25.1 457 (% _msthash="643" _msttexthash="2223559" _mstvisible="1" %)
Hera Guo 15.1 458 application/**chirpstack application id**/device/+/event/up
459
Alec Chen 25.1 460 (% _mstvisible="1" %)
461 (% _mstvisible="3" %)[[image:图片8.png||_mstalt="5132205" _msthash="630" _mstvisible="5" height="508" width="1024"]]
Hera Guo 15.1 462
463
Alec Chen 25.2 464 (% class="wikigeneratedid" _mstvisible="1" %)
Alec Chen 25.1 465 (% _mstvisible="3" %)[[image:屏幕截图 2024-11-25 095805.png||_mstalt="10831028" _msthash="632" _mstvisible="5" height="301" width="1024"]]
Hera Guo 16.1 466
Alec Chen 25.1 467 (% _mstvisible="1" %)
Hera Guo 24.1 468 ----
469
Alec Chen 25.1 470 (% _mstvisible="1" %)
471 == (% _msthash="642" _msttexthash="471978" _mstvisible="2" %)4.5 Check the connection(%%) ==
Hera Guo 15.1 472
Alec Chen 25.1 473 (% _mstvisible="1" %)
474 (% _mstvisible="3" %)[[image:图片9.png||_mstalt="5132322" _msthash="634" _mstvisible="5" height="509" width="1025"]]
Hera Guo 15.1 475
Alec Chen 25.1 476 (% _mstvisible="1" %)
477 (% _mstvisible="3" %)[[image:图片10.png||_mstalt="5142449" _msthash="636" _mstvisible="5" height="509" width="1026"]]
Hera Guo 15.1 478
Hera Guo 24.1 479
Alec Chen 25.1 480 (% _mstvisible="1" %)
Hera Guo 24.1 481 ----
482
Alec Chen 25.1 483 (% _mstvisible="1" %)
484 = (% _msthash="641" _msttexthash="418145" _mstvisible="2" %)5. Check Data Uplink Log(%%) =
Hera Guo 15.1 485
Alec Chen 25.1 486 (% _msthash="640" _msttexthash="1422681" _mstvisible="1" %)
Chxy 13.1 487 User can check the devices log in Intergration.
488
Alec Chen 25.1 489 (% _mstvisible="1" %)
490 (% _mstvisible="3" %)[[image:1729562069134-315.png||_mstalt="294190" _msthash="638" _mstvisible="5" height="587" width="723"]]