Changes for page Connect Devices to ThingsEye
Last modified by Hera Guo on 2025/02/18 09:29
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Attachments (0 modified, 0 added, 27 removed)
- 1728535775119-971.png
- 1728535857345-950.png
- 1728535941851-388.png
- 1728536142721-488.png
- 1728536305503-380.png
- 1728536374214-962.png
- 1728536420275-153.png
- 1728536524638-768.png
- 1728536541040-814.png
- 1728566363151-470.png
- 1729562069134-315.png
- 1732678750938-753.jpg
- 1732679080974-799.jpg
- 1732679444539-853.jpg
- 1732679647697-982.jpg
- 图片1.png
- 图片10.png
- 图片2.png
- 图片3.png
- 图片4.png
- 图片5.png
- 图片6.png
- 图片7.png
- 图片8.png
- 图片9.png
- 屏幕截图 2024-11-25 095805.png
- 屏幕截图 2024-11-27 113616.png
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.he ra1 +XWiki.EdwinChen - Content
-
... ... @@ -7,8 +7,8 @@ 7 7 8 8 = 1. Overview = 9 9 10 -The instructions in this chapter will show you how to connect a device that has been registered to the server to the Thingseye platform. 11 11 11 + 12 12 = 2. UDP Procotol ~-~- Directly Connection = 13 13 14 14 == 2.1 UDP Interface == ... ... @@ -20,11 +20,12 @@ 20 20 21 21 Please contact ThingsEye team for detail how to forward data to client. 22 22 23 + 23 23 == 2.2 Test UDP Interface via Socket Tool == 24 24 25 25 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. 26 26 27 -[[image:1728 566363151-470.png]]28 +[[image:1728362612869-443.png||height="454" width="540"]] 28 28 29 29 In server side, Tenant Administrator can check this in Tenant UDP Server location. 30 30 ... ... @@ -36,6 +36,7 @@ 36 36 37 37 We can see the message arrives, but it shows ERROR because the message doesn't follow with the UDP Server format. 38 38 40 + 39 39 == 2.3 Test with Dragino NB device == 40 40 41 41 === 2.3.1 Configure NB-IoT End Node === ... ... @@ -43,11 +43,12 @@ 43 43 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 44 44 45 45 * Set to use ThingsEye UDP server: **AT+SERVADDR=server1.thingseye.io,11560** 46 -* Use UDP Uplink & Json protocol:** 48 +* Use UDP Uplink & Json protocol:** AT+PRO=2,5** 47 47 * Equip with a NB-IoT SIM Card to access to NB-IoT Network. 48 48 49 49 The S31-NB's cellular module has the IMEI: **863663062789483** 50 50 53 + 51 51 === 2.3.2 Check Uplink Data === 52 52 53 53 Re-activate the S31-NB, and we can see it in the debug window: ... ... @@ -54,6 +54,7 @@ 54 54 55 55 [[image:1728378218744-800.png||height="431" width="1003"]] 56 56 60 + 57 57 === 2.3.3 Auto-Create Device === 58 58 59 59 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. ... ... @@ -65,270 +65,6 @@ 65 65 66 66 **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.** 67 67 68 -= 3. Connect to The Things Stack = 69 69 70 -== 3.1 Network Structure == 71 71 72 -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. 73 - 74 -[[image:1732679444539-853.jpg||height="388" width="1452"]] 75 - 76 -== 3.2 Creat Integration for The Things Stack. == 77 - 78 -(% class="lead" %) 79 -Add Integration 80 - 81 -[[image:1728535775119-971.png||height="456" width="1087"]] 82 - 83 - 84 -(% class="lead" %) 85 -Choose Connection Type 86 - 87 -[[image:1728535857345-950.png]] 88 - 89 - 90 -(% class="lead" %) 91 -Input Uplink Data Converter Code 92 - 93 -[[image:1728535941851-388.png||height="466" width="398"]] 94 - 95 -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]] 96 - 97 - 98 -(% class="lead" %) 99 -Input Downlink Converter 100 - 101 -[[image:1728536142721-488.png||height="470" width="407"]] 102 - 103 -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]] 104 - 105 - 106 -(% class="lead" %) 107 -Set up Connection to The Things Network application 108 - 109 -[[image:1728536305503-380.png||height="510" width="1206"]] 110 - 111 - 112 - 113 -(% class="lead" %) 114 -Test Connection & Add iIntegration 115 - 116 -[[image:1728536374214-962.png]] 117 - 118 -After add , we can see the integration here: 119 - 120 -[[image:1728536420275-153.png||height="208" width="1404"]] 121 - 122 - 123 -== 3.3 Test Uplink == 124 - 125 -We can use Simulate Uplink to simulate an uplink in the things stack. Then we should be able to see the message in ThingsEye 126 - 127 -[[image:1728536524638-768.png||height="493" width="1071"]] 128 - 129 - 130 -[[image:1728536541040-814.png]] 131 - 132 -= 4.Connect chirpstack to Thingseye by way of MQTT = 133 - 134 -* **How to connect chirpstack to Thingseye by way of MQTT? The following tutorial will show you** 135 - 136 -== 4.1 Network Structure == 137 - 138 -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. 139 - 140 -[[image:1732679647697-982.jpg||height="399" width="1492"]] 141 - 142 -== 4.2 Thingseye adds MQTT integration == 143 - 144 -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"; 145 - 146 -[[image:图片1.png]] 147 - 148 -== 4.3 Add an uplink and downlink data converter == 149 - 150 -In the function decoder field, specify the script to parse and transform the data. 151 - 152 -[[image:图片2.png]] 153 - 154 -* **Uplink——JavaScript:** 155 - 156 -var data = decodeToJson(payload); 157 - 158 -var deviceName = data.deviceInfo.deviceName; 159 - 160 -var deviceType = data.applicationName; 161 - 162 -var devEui = data.deviceInfo.devEui 163 - 164 -var label = data.deviceInfo.devEui 165 - 166 -var model = {}; 167 - 168 -var data2 = data.object; 169 - 170 -var flg = data.fPort 171 - 172 -for (var key in data2) { 173 - 174 - ~/~/ 将属性名存入新对象中 175 - 176 - model[key] = data2[key]; 177 - 178 -} 179 - 180 -~/~/var obj = {"devid":deviceName} 181 - 182 -var result = { 183 - 184 - deviceName: deviceName, 185 - 186 - deviceType: deviceType, 187 - 188 - telemetry: model, 189 - 190 - groupName: "Case Study", 191 - 192 - ~/~/label:label, 193 - 194 - attributes:{"devEui":devEui, 195 - 196 - ~/~/"timevalue":"test", 197 - 198 - "inactivityTimeout":1260000 199 - 200 - ~/~/ "High_humidity_alarm":"not set", 201 - 202 - ~/~/ "High_temperature_alarm":"not set", 203 - 204 - ~/~/ "Low_humidity_alarm":"not set", 205 - 206 - ~/~/ "Low_temperature_alarm":"not set", 207 - 208 - ~/~/ "Low_voltage_alarm":"not set" 209 - 210 - ~/~/"customerName": "Civionic Engineering & Consulting (2014) Inc." 211 - 212 - } 213 - 214 -}; 215 - 216 -function decodeToString(payload) { 217 - 218 - return String.fromCharCode.apply(String, payload); 219 - 220 -} 221 - 222 -function decodeToJson(payload) { 223 - 224 - var str = decodeToString(payload); 225 - 226 - var data = JSON.parse(str); 227 - 228 - return data; 229 - 230 -} 231 - 232 -return result; 233 - 234 -[[image:图片3.png]] 235 - 236 -* **Dowblink——JavaScript:** 237 - 238 -~/~/ Encode downlink data from incoming Rule Engine message 239 - 240 -~/~/ msg - JSON message payload downlink message json 241 - 242 -~/~/ msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. 243 - 244 -~/~/ metadata - list of key-value pairs with additional data about the message 245 - 246 -~/~/ integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter 247 - 248 -~/~/ /~*~* Encoder ~*~*/ 249 - 250 -~/~/var data = {"value":99}; 251 - 252 -~/~/ ~/~/ Process data from incoming message and metadata 253 - 254 -~/~/ data.tempFreq = msg.temperatureUploadFrequency; 255 - 256 -~/~/ data.humFreq = msg.humidityUploadFrequency; 257 - 258 -~/~/ data.devSerialNumber = metadata['ss_serialNumber']; 259 - 260 -~/~/ ~/~/ Result object with encoded downlink payload 261 - 262 -var result = { 263 - 264 - ~/~/ downlink data content type: JSON, TEXT or BINARY (base64 format) 265 - 266 - contentType: "TEXT", 267 - 268 - ~/~/ downlink data 269 - 270 - data: msg.shared_value ,~/~/JSON.stringify(data), 271 - 272 - ~/~/ Optional metadata object presented in key/value format 273 - 274 - metadata: { 275 - 276 - topic: '/test/down/'+metadata.deviceName 277 - 278 - } 279 - 280 -}; 281 - 282 -return result; 283 - 284 -== 4.4 Configure the connection == 285 - 286 -Generate MQTT certificate integrated on chirpstack 287 - 288 -Chirpstack generates CA certificate, TLS certificate, and TLS key respectively 289 - 290 -They correspond to the CA certificate file, Certificate file, and Private key file on thingseye 291 - 292 -[[image:图片4.png]] 293 - 294 -[[image:图片5.png||height="630" width="1269"]] 295 - 296 -* Copy the contents of the certificates and paste them into the linked file below, a total of three certificates are required 297 - 298 -**Integrated Certificate File demo Download Address:** 299 - 300 -[[https:~~/~~/github.com/ThingsEye-io/te-platform/tree/main/chirpstack>>https://github.com/ThingsEye-io/te-platform/tree/main/chirpstack]] 301 - 302 -Enter the server address Host: lns1.thingseye.io on the Connection configuration 303 - 304 -Port: 8883 305 - 306 -Credentials type: PEM 307 - 308 -Upload the certificate and key file 309 - 310 -[[image:图片6.png]] 311 - 312 -[[image:图片7.png]] 313 - 314 -The default for Topic is: 315 - 316 -application/**chirpstack application id**/device/+/event/up 317 - 318 -[[image:图片8.png]] 319 - 320 - 321 -(% class="wikigeneratedid" %) 322 -[[image:屏幕截图 2024-11-25 095805.png||height="374" width="1272"]] 323 - 324 -== 4.5 Check the connection == 325 - 326 -[[image:图片9.png]] 327 - 328 -[[image:图片10.png]] 329 - 330 -= 5. Check Data Uplink Log = 331 - 332 -User can check the devices log in Intergration. 333 - 334 -[[image:1729562069134-315.png||height="587" width="723"]] 74 +
- 1728535775119-971.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -84.1 KB - Content
- 1728535857345-950.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -29.4 KB - Content
- 1728535941851-388.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -50.3 KB - Content
- 1728536142721-488.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -55.5 KB - Content
- 1728536305503-380.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -135.2 KB - Content
- 1728536374214-962.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -11.8 KB - Content
- 1728536420275-153.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -35.3 KB - Content
- 1728536524638-768.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -46.6 KB - Content
- 1728536541040-814.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -29.0 KB - Content
- 1728566363151-470.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -61.9 KB - Content
- 1729562069134-315.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.EdwinChen - Size
-
... ... @@ -1,1 +1,0 @@ 1 -67.5 KB - Content
- 1732678750938-753.jpg
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -173.5 KB - Content
- 1732679080974-799.jpg
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -176.4 KB - Content
- 1732679444539-853.jpg
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -180.5 KB - Content
- 1732679647697-982.jpg
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -179.2 KB - Content
- 图片1.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -123.1 KB - Content
- 图片10.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -173.4 KB - Content
- 图片2.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -163.3 KB - Content
- 图片3.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -124.8 KB - Content
- 图片4.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -68.8 KB - Content
- 图片5.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -98.5 KB - Content
- 图片6.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -136.5 KB - Content
- 图片7.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -143.5 KB - Content
- 图片8.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -151.0 KB - Content
- 图片9.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -134.6 KB - Content
- 屏幕截图 2024-11-25 095805.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -45.7 KB - Content
- 屏幕截图 2024-11-27 113616.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.hera - Size
-
... ... @@ -1,1 +1,0 @@ 1 -117.5 KB - Content