Changes for page Connect Devices to ThingsEye
Last modified by Alec Chen on 2025/11/26 17:10
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Attachments (0 modified, 23 added, 0 removed)
- 1729562069134-315.png
- 1732678750938-753.jpg
- 1732679080974-799.jpg
- 1732679444539-853.jpg
- 1732679647697-982.jpg
- 1758762334133-608.png
- 1758762371290-726.png
- 1758762634175-353.png
- 1758762919291-489.png
- 1758763019466-819.png
- 1758763061703-634.png
- 图片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. EdwinChen1 +XWiki.Alec - Content
-
... ... @@ -1,223 +1,505 @@ 1 +(% _mstvisible="1" %) 1 1 2 2 3 -**Table of Contents:** 4 +(% _mstvisible="1" %) 5 +(% _msthash="777" _msttexthash="303537" _mstvisible="2" %)**Table of Contents:** 4 4 5 5 {{toc/}} 6 6 7 7 8 -= 1. Overview = 10 +(% _mstvisible="1" %) 11 += (% _msthash="757" _msttexthash="149552" _mstvisible="2" %)1. Overview(%%) = 9 9 13 +(% _msthash="756" _msttexthash="7978490" _mstvisible="1" %) 14 +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 -= 2. UDP Procotol ~-~- Directly Connection = 17 +(% _mstvisible="1" %) 18 += (% _msthash="755" _msttexthash="40707030" _mstvisible="2" %)2. UDP Procotol——直接连接(%%) = 13 13 14 -== 2.1 UDP Interface == 20 +(% _mstvisible="1" %) 21 +== (% _msthash="754" _msttexthash="8267792" _mstvisible="2" %)2.1 UDP接口(%%) == 15 15 16 -* Server Address: server1.thingseye.io 17 -* Port: 11562 23 +(% _mstvisible="1" %) 24 +* 服务器地址:server1.thingseye.io 25 +* 端口:11560 18 18 19 -The data sent to above UDP interface will not go directly to client's database. 27 +(% _msthash="751" _msttexthash="151236319" _mstvisible="1" %) 28 +发送到上方UDP接口的数据不会直接进入客户端数据库。 20 20 21 -Please contact ThingsEye team for detail how to forward data to client. 30 +(% _msthash="750" _msttexthash="169541242" _mstvisible="1" %) 31 +如需详细了解如何将数据转发给客户,请联系ThingsEye团队。 22 22 33 +(% _mstvisible="1" %) 34 +(% _msthash="749" _msttexthash="321726288" _mstvisible="2" %)**注意:目前 UDP 连接需要端口转发,连接前请联系 ThingsEye 团队告知他们您设备的 IMEI。** 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. 37 +(% _mstvisible="1" %) 38 +---- 27 27 28 -[[image:1728566363151-470.png]] 40 +(% _mstvisible="1" %) 41 +== (% _msthash="748" _msttexthash="55449407" _mstvisible="2" %)2.2 使用Dragino NB装置的测试(%%) == 29 29 30 -In server side, Tenant Administrator can check this in Tenant UDP Server location. 43 +(% _mstvisible="1" %) 44 +=== (% _msthash="747" _msttexthash="11644464" _mstvisible="2" %)2.2.1 配置NB-IoT End Node(%%) === 31 31 32 -[[image:1728362834430-749.png||height="510" width="1667"]] 46 +(% _msthash="746" _msttexthash="126369737" _mstvisible="1" %) 47 +这里的设备是(% _istranslated="1" %)**[[S31-NB>>https://www.dragino.com/products/temperature-humidity-sensor/item/288-s31-nb-s31b-nb.html||_istranslated="1"]]**(%%):并且已经在下面配置了 33 33 34 -Click and see the debug info as below: 49 +(% _mstvisible="1" %) 50 +* 设置为使用 ThingsEye UDP 服务器:(% _istranslated="1" %)**AT+SERVADDR=server1.thingseye.io,11560** 51 +* 使用 UDP 上行链路和 JSON 协议:(% _istranslated="1" %)**AT+PRO=2,5** 52 +* 配备NB-IoT卡以接入NB-IoT网络。 35 35 36 -[[image:1728363020699-203.png]] 54 +(% _msthash="742" _msttexthash="52789451" _mstvisible="1" %) 55 +S31-NB的蜂窝模块为IMEI:(% _istranslated="1" %)**863663062789483** 37 37 38 -We can see the message arrives, but it shows ERROR because the message doesn't follow with the UDP Server format. 57 +(% _mstvisible="1" %) 58 +=== (% _msthash="741" _msttexthash="30173117" _mstvisible="2" %)2.2.2 检查上行数据(%%) === 39 39 60 +(% _msthash="740" _msttexthash="22249344" _mstvisible="1" %) 61 +开启调试模组 40 40 41 -== 2.3 Test with Dragino NB device == 63 +(% _mstvisible="1" %) 64 +(% _mstvisible="3" %)[[image:1758762334133-608.png||_mstalt="294801" _msthash="584" _mstvisible="5" height="494" width="1003"]] 42 42 43 -=== 2.3.1 Configure NB-IoT End Node === 66 +(% _mstvisible="1" %) 67 +---- 44 44 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 69 +(% _msthash="739" _msttexthash="156775723" _mstvisible="1" %) 70 +重新激活S31-NB,我们可以在调试窗口中看到它: 46 46 47 -* Set to use ThingsEye UDP server: **AT+SERVADDR=server1.thingseye.io,11560** 48 -* Use UDP Uplink & Json protocol:** AT+PRO=2,5** 49 -* Equip with a NB-IoT SIM Card to access to NB-IoT Network. 72 +(% _mstvisible="1" %) 73 +(% _mstvisible="3" %)[[image:1758762371290-726.png||_mstalt="296088" _msthash="586" _mstvisible="5" height="528" width="1005"]] 50 50 51 -The S31-NB's cellular module has the IMEI: **863663062789483** 75 +(% _mstvisible="1" %) 76 +(% _mstvisible="3" %)[[image:1728378218744-800.png||_mstalt="295269" _msthash="588" _mstvisible="5" height="431" width="1003"]] 52 52 78 +(% _mstvisible="1" %) 79 +---- 53 53 54 -=== 2.3.2 Check Uplink Data === 81 +(% _mstvisible="1" %) 82 +=== (% _msthash="738" _msttexthash="29837379" _mstvisible="2" %)2.2.4 自动创建设备(%%) === 55 55 56 -Re-activate the S31-NB, and we can see it in the debug window: 84 +(% _msthash="737" _msttexthash="810829929" _mstvisible="1" %) 85 +默认(% _istranslated="1" %)**的租户UDP服务器**(%%)已经配置好解码Dragino -NB / -CB NB-IoT节点。所以每个端节点都会向服务器发送数据。租户会自动在服务器上创建设备。 57 57 58 -[[image:1728378218744-800.png||height="431" width="1003"]] 87 +(% _mstvisible="1" %) 88 +(% _mstvisible="3" %)[[image:1728378968101-683.png||_mstalt="297154" _msthash="590" _mstvisible="5" height="210" width="1005"]] 59 59 90 +(% _mstvisible="1" %) 91 +(% _mstvisible="3" %)[[image:1728379050044-764.png||_mstalt="295282" _msthash="592" _mstvisible="5" height="326" width="1009"]] 60 60 61 -=== 2.3.3 Auto-Create Device === 62 62 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. 94 +(% _mstvisible="1" %) 95 +---- 64 64 65 -[[image:1728378968101-683.png||height="273" width="1307"]] 97 +(% _mstvisible="1" %) 98 += (% _msthash="736" _msttexthash="622947" _mstvisible="2" %)3. Connect to The Things Stack(%%) = 66 66 67 -[[image:1728379050044-764.png||height="424" width="1312"]] 100 +(% _mstvisible="1" %) 101 +== (% _msthash="735" _msttexthash="410280" _mstvisible="2" %)3.1 Network Structure(%%) == 68 68 103 +(% _msthash="734" _msttexthash="14835652" _mstvisible="1" %) 104 +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. 69 69 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.** 106 +(% _mstvisible="1" %) 107 +(% _mstvisible="3" %)[[image:1732679444539-853.jpg||_mstalt="296933" _msthash="594" _mstvisible="5" height="388" width="1452"]] 71 71 109 +(% _mstvisible="1" %) 110 +== (% _msthash="733" _msttexthash="1191008" _mstvisible="2" %)3.2 Creat Integration for The Things Stack.(%%) == 72 72 73 - 74 -= 2. Connect to The Things Stack = 75 - 76 -== 2.1 Network Structure == 77 - 78 - 79 -== 2.2 Creat Integration for The Things Stack. == 80 - 81 -(% class="lead" %) 112 +(% _msthash="732" _msttexthash="255775" _mstvisible="1" class="lead" %) 82 82 Add Integration 83 83 84 -[[image:1728535775119-971.png||height="456" width="1087"]] 115 +(% _mstvisible="1" %) 116 +(% _mstvisible="3" %)[[image:1728535775119-971.png||_mstalt="297661" _msthash="596" _mstvisible="5" height="423" width="1007"]] 85 85 86 86 87 -(% class="lead" %) 119 +(% _msthash="731" _msttexthash="448994" _mstvisible="1" class="lead" %) 88 88 Choose Connection Type 89 89 90 -[[image:1728535857345-950.png]] 122 +(% _mstvisible="1" %) 123 +(% _mstvisible="3" %)[[image:1728535857345-950.png||_mstalt="297154" _msthash="598" _mstvisible="5" height="257" width="403"]] 91 91 92 92 93 -(% class="lead" %) 126 +(% _msthash="730" _msttexthash="762996" _mstvisible="1" class="lead" %) 94 94 Input Uplink Data Converter Code 95 95 96 -[[image:1728535941851-388.png||height="466" width="398"]] 129 +(% _mstvisible="1" %) 130 +(% _mstvisible="3" %)[[image:1728535941851-388.png||_mstalt="297856" _msthash="600" _mstvisible="5" height="466" width="398"]] 97 97 98 -Demo Code as below: 132 +(% _msthash="729" _msttexthash="16454490" _mstvisible="1" %) 133 +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 100 ->var data = decodeToJson(payload); 101 ->var deviceName = data.end_device_ids.device_id; 102 ->var deviceType = data.end_device_ids.application_ids.application_id; 103 ->var model = {}; 104 ->var data2 = data.uplink_message.decoded_payload; 105 ->var flg = data.uplink_message.f_port 106 ->for (var key in data2) { 107 -> model[key] = data2[key]; 108 ->} 109 ->var obj = {"devid":deviceName} 110 ->var result = { 111 -> deviceName: deviceName, 112 -> deviceType: deviceType, 113 -> telemetry: model, 114 -> groupName: "Case Study", 115 -> attributes:{"devid":deviceName, 116 -> "timevalue":"test", 117 -> "inactivityTimeout":1260000 118 -> } 119 ->}; 120 ->function decodeToString(payload) { 121 -> return String.fromCharCode.apply(String, payload); 122 ->}function decodeToJson(payload) { 123 -> var str = decodeToString(payload); 124 -> var data = JSON.parse(str); 125 -> return data; 126 ->} 127 ->if (flg===2){ 128 ->return result; 129 ->} 130 130 131 - 132 -(% class="lead" %) 136 +(% _msthash="728" _msttexthash="532480" _mstvisible="1" class="lead" %) 133 133 Input Downlink Converter 134 134 135 -[[image:1728536142721-488.png||height="470" width="407"]] 139 +(% _mstvisible="1" %) 140 +(% _mstvisible="3" %)[[image:1728536142721-488.png||_mstalt="296127" _msthash="602" _mstvisible="5" height="470" width="407"]] 136 136 137 -Example Code as below: 142 +(% _msthash="727" _msttexthash="19064695" _mstvisible="1" %) 143 +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]] 138 138 139 ->function hexToBase64(hexString) { 140 -> var bytes = hexString.match(/.{2}/g); 141 -> var binaryString = bytes.map(function(byte) { 142 -> return String.fromCharCode(parseInt(byte, 16)); 143 -> }).join(''); 144 -> 145 -> return btoa(binaryString); 146 ->} 147 ->var flg = "shared_value" in metadata 148 ->var value2 = parseInt(metadata.ss_timevalue).toString(16)if (value2.length==1){ 149 -> value2 = "00000"+parseInt(metadata.ss_timevalue).toString(16) 150 ->} 151 ->else if (value2.length==2){ 152 -> value2 = "0000"+parseInt(metadata.ss_timevalue).toString(16) 153 ->} 154 ->else if (value2.length==3){ 155 -> value2 = "000"+parseInt(metadata.ss_timevalue).toString(16) 156 ->} 157 ->else if (value2.length==4){ 158 -> value2 = "00"+parseInt(metadata.ss_timevalue).toString(16) 159 ->} 160 ->else if (value2.length==5){ 161 -> value2 = "0"+parseInt(metadata.ss_timevalue).toString(16) 162 ->} 163 ->else { 164 -> value2 = value2 165 ->} 166 ->var data = "01"+value2 167 ->if (flg === true){ 168 ->data = { 169 -> downlinks: [{ 170 -> f_port: 1, 171 -> confirmed: false, 172 -> frm_payload: hexToBase64(metadata.shared_value), 173 -> priority: "NORMAL" 174 -> }] 175 -> }; 176 ->} 177 ->else{ 178 -> data = { 179 -> downlinks: [{ 180 -> f_port: 1, 181 -> confirmed: false, 182 -> frm_payload: hexToBase64(data), 183 -> priority: "NORMAL" 184 -> }] 185 -> }; 186 ->} 187 ->var result = { 188 -> contentType: "JSON", 189 -> data: JSON.stringify(data), 190 -> metadata: { 191 -> devId: metadata.ss_devid 192 -> } 193 ->}; 194 ->if (metadata.shared_timevalue!=="test" || metadata.ss_timevalue!=="test"){ 195 ->return result; 196 ->} 197 197 198 - 199 -(% class="lead" %) 146 +(% _msthash="726" _msttexthash="1724853" _mstvisible="1" class="lead" %) 200 200 Set up Connection to The Things Network application 201 201 202 -[[image:1728536305503-380.png||height="510" width="1206"]] 149 +(% _mstvisible="1" %) 150 +(% _mstvisible="3" %)[[image:1728536305503-380.png||_mstalt="293254" _msthash="604" _mstvisible="5" height="431" width="1019"]] 203 203 204 204 205 205 206 -(% class="lead" %) 154 +(% _msthash="725" _msttexthash="851097" _mstvisible="1" class="lead" %) 207 207 Test Connection & Add iIntegration 208 208 209 -[[image:1728536374214-962.png]] 157 +(% _mstvisible="1" %) 158 +(% _mstvisible="3" %)[[image:1728536374214-962.png||_mstalt="295893" _msthash="606" _mstvisible="5" height="380" width="1024"]] 210 210 160 +(% _msthash="724" _msttexthash="1177579" _mstvisible="1" %) 211 211 After add , we can see the integration here: 212 212 213 -[[image:1728536420275-153.png||height="208" width="1404"]] 163 +(% _mstvisible="1" %) 164 +(% _mstvisible="3" %)[[image:1728536420275-153.png||_mstalt="293748" _msthash="608" _mstvisible="5" height="152" width="1026"]] 214 214 215 215 216 -== 2.3 Test Uplink == 167 +(% _mstvisible="1" %) 168 +== (% _msthash="723" _msttexthash="213447" _mstvisible="2" %)3.3 Test Uplink(%%) == 217 217 170 +(% _msthash="722" _msttexthash="7855835" _mstvisible="1" %) 218 218 We can use Simulate Uplink to simulate an uplink in the things stack. Then we should be able to see the message in ThingsEye 219 219 220 -[[image:1728536524638-768.png||height="493" width="1071"]] 173 +(% _mstvisible="1" %) 174 +(% _mstvisible="3" %)[[image:1728536524638-768.png||_mstalt="298870" _msthash="610" _mstvisible="5" height="473" width="1028"]] 221 221 222 222 223 -[[image:1728536541040-814.png]] 177 +(% _mstvisible="1" %) 178 +(% _mstvisible="3" %)[[image:1728536541040-814.png||_mstalt="293215" _msthash="612" _mstvisible="5" height="424" width="1026"]] 179 + 180 + 181 +(% _mstvisible="1" %) 182 +---- 183 + 184 +(% _mstvisible="1" %) 185 += (% _msthash="721" _msttexthash="1472211" _mstvisible="2" %)4.Connect chirpstack to Thingseye by way of MQTT(%%) = 186 + 187 +(% _mstvisible="1" %) 188 +* (% _msthash="720" _msttexthash="4693741" _mstvisible="3" %)**How to connect chirpstack to Thingseye by way of MQTT? The following tutorial will show you** 189 + 190 +(% _mstvisible="1" %) 191 +== (% _msthash="719" _msttexthash="410371" _mstvisible="2" %)4.1 Network Structure(%%) == 192 + 193 +(% _msthash="718" _msttexthash="14117480" _mstvisible="1" %) 194 +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. 195 + 196 +(% _mstvisible="1" %) 197 +(% _mstvisible="3" %)[[image:1732679647697-982.jpg||_mstalt="299884" _msthash="614" _mstvisible="5" height="399" width="1492"]] 198 + 199 +(% _mstvisible="1" %) 200 +== (% _msthash="717" _msttexthash="897286" _mstvisible="2" %)4.2 Thingseye adds MQTT integration(%%) == 201 + 202 +(% _msthash="716" _msttexthash="15186782" _mstvisible="1" %) 203 +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"; 204 + 205 +(% _mstvisible="1" %) 206 +(% _mstvisible="3" %)[[image:1758762634175-353.png||_mstalt="295893" _msthash="616" _mstvisible="5" height="783" width="1020"]] 207 + 208 +(% _mstvisible="1" %) 209 +== (% _msthash="715" _msttexthash="1329445" _mstvisible="2" %)4.3 Add an uplink and downlink data converter(%%) == 210 + 211 +(% _msthash="714" _msttexthash="4516408" _mstvisible="1" %) 212 +In the function decoder field, specify the uplink script to parse and transform the data. 213 + 214 +(% _mstvisible="1" %) 215 +(% _mstvisible="3" %)[[image:1758763061703-634.png||_mstalt="294671" _msthash="618" _mstvisible="5" height="783" width="1020"]] 216 + 217 +(% _mstvisible="1" %) 218 +* (% _msthash="713" _msttexthash="24445408" _mstvisible="3" %)**Uplink——JavaScript:** 219 + 220 +(% _msthash="712" _msttexthash="792233" _mstvisible="1" %) 221 +var data = decodeToJson(payload); 222 + 223 +(% _msthash="711" _msttexthash="1379794" _mstvisible="1" %) 224 +var deviceName = data.deviceInfo.deviceName; 225 + 226 +(% _msthash="710" _msttexthash="1079247" _mstvisible="1" %) 227 +var deviceType = data.applicationName; 228 + 229 +(% _msthash="709" _msttexthash="909376" _mstvisible="1" %) 230 +var devEui = data.deviceInfo.devEui 231 + 232 +(% _msthash="708" _msttexthash="861510" _mstvisible="1" %) 233 +var label = data.deviceInfo.devEui 234 + 235 +(% _msthash="707" _msttexthash="195442" _mstvisible="1" %) 236 +var model = {}; 237 + 238 +(% _msthash="706" _msttexthash="435448" _mstvisible="1" %) 239 +var data2 = data.object; 240 + 241 +(% _msthash="705" _msttexthash="326274" _mstvisible="1" %) 242 +var flg = data.fPort 243 + 244 +(% _msthash="704" _msttexthash="380965" _mstvisible="1" %) 245 +for (var key in data2) { 246 + 247 +(% _msthash="703" _msttexthash="43058977" _mstvisible="1" %) 248 + ~/~/ 将属性名存入新对象中 249 + 250 +(% _msthash="702" _msttexthash="475553" _mstvisible="1" %) 251 + model[key] = data2[key]; 252 + 253 +(% _mstvisible="1" %) 254 +} 255 + 256 +(% _msthash="701" _msttexthash="757653" _mstvisible="1" %) 257 +~/~/var obj = {"devid":deviceName} 258 + 259 +(% _msthash="700" _msttexthash="183287" _mstvisible="1" %) 260 +var result = { 261 + 262 +(% _msthash="699" _msttexthash="473265" _mstvisible="1" %) 263 + deviceName: deviceName, 264 + 265 +(% _msthash="698" _msttexthash="489918" _mstvisible="1" %) 266 + deviceType: deviceType, 267 + 268 +(% _msthash="697" _msttexthash="297271" _mstvisible="1" %) 269 + telemetry: model, 270 + 271 +(% _msthash="696" _msttexthash="446498" _mstvisible="1" %) 272 + groupName: "Case Study", 273 + 274 +(% _msthash="695" _msttexthash="217633" _mstvisible="1" %) 275 + ~/~/label:label, 276 + 277 +(% _msthash="694" _msttexthash="685984" _mstvisible="1" %) 278 + attributes:{"devEui":devEui, 279 + 280 +(% _msthash="693" _msttexthash="386308" _mstvisible="1" %) 281 + ~/~/"timevalue":"test", 282 + 283 +(% _msthash="692" _msttexthash="551772" _mstvisible="1" %) 284 + "inactivityTimeout":1260000 285 + 286 +(% _msthash="691" _msttexthash="894530" _mstvisible="1" %) 287 + ~/~/ "High_humidity_alarm":"not set", 288 + 289 +(% _msthash="690" _msttexthash="1052753" _mstvisible="1" %) 290 + ~/~/ "High_temperature_alarm":"not set", 291 + 292 +(% _msthash="689" _msttexthash="848783" _mstvisible="1" %) 293 + ~/~/ "Low_humidity_alarm":"not set", 294 + 295 +(% _msthash="688" _msttexthash="1002833" _mstvisible="1" %) 296 + ~/~/ "Low_temperature_alarm":"not set", 297 + 298 +(% _msthash="687" _msttexthash="773682" _mstvisible="1" %) 299 + ~/~/ "Low_voltage_alarm":"not set" 300 + 301 +(% _msthash="686" _msttexthash="2381015" _mstvisible="1" %) 302 + ~/~/"customerName": "Civionic Engineering & Consulting (2014) Inc." 303 + 304 +(% _mstvisible="1" %) 305 + } 306 + 307 +(% _mstvisible="1" %) 308 +}; 309 + 310 +(% _msthash="685" _msttexthash="937586" _mstvisible="1" %) 311 +function decodeToString(payload) { 312 + 313 +(% _msthash="684" _msttexthash="1818154" _mstvisible="1" %) 314 + return String.fromCharCode.apply(String, payload); 315 + 316 +(% _mstvisible="1" %) 317 +} 318 + 319 +(% _msthash="683" _msttexthash="834496" _mstvisible="1" %) 320 +function decodeToJson(payload) { 321 + 322 +(% _msthash="682" _msttexthash="850616" _mstvisible="1" %) 323 + var str = decodeToString(payload); 324 + 325 +(% _msthash="681" _msttexthash="512044" _mstvisible="1" %) 326 + var data = JSON.parse(str); 327 + 328 +(% _msthash="680" _msttexthash="173511" _mstvisible="1" %) 329 + return data; 330 + 331 +(% _mstvisible="1" %) 332 +} 333 + 334 +(% _msthash="679" _msttexthash="233116" _mstvisible="1" %) 335 +return result; 336 + 337 +(% _mstvisible="1" %) 338 +---- 339 + 340 +(% _msthash="678" _msttexthash="4743882" _mstvisible="1" %) 341 +In the function decoder field, specify the downlink script to parse and transform the data. 342 + 343 +(% _mstvisible="1" %) 344 +(% _mstvisible="3" %)[[image:1758763019466-819.png||_mstalt="298311" _msthash="620" _mstvisible="5" height="787" width="1022"]] 345 + 346 +(% _mstvisible="1" %) 347 +* (% _msthash="677" _msttexthash="26632970" _mstvisible="3" %)**Dowblink——JavaScript:** 348 + 349 +(% _msthash="676" _msttexthash="2052284" _mstvisible="1" %) 350 +~/~/ Encode downlink data from incoming Rule Engine message 351 + 352 +(% _msthash="675" _msttexthash="1638546" _mstvisible="1" %) 353 +~/~/ msg - JSON message payload downlink message json 354 + 355 +(% _msthash="674" _msttexthash="3854773" _mstvisible="1" %) 356 +~/~/ msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. 357 + 358 +(% _msthash="673" _msttexthash="3368742" _mstvisible="1" %) 359 +~/~/ metadata - list of key-value pairs with additional data about the message 360 + 361 +(% _msthash="672" _msttexthash="8087157" _mstvisible="1" %) 362 +~/~/ integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter 363 + 364 +(% _msthash="671" _msttexthash="199069" _mstvisible="1" %) 365 +~/~/ /~*~* Encoder ~*~*/ 366 + 367 +(% _msthash="670" _msttexthash="455715" _mstvisible="1" %) 368 +~/~/var data = {"value":99}; 369 + 370 +(% _msthash="669" _msttexthash="1757431" _mstvisible="1" %) 371 +~/~/ ~/~/ Process data from incoming message and metadata 372 + 373 +(% _msthash="668" _msttexthash="1852279" _mstvisible="1" %) 374 +~/~/ data.tempFreq = msg.temperatureUploadFrequency; 375 + 376 +(% _msthash="667" _msttexthash="1572038" _mstvisible="1" %) 377 +~/~/ data.humFreq = msg.humidityUploadFrequency; 378 + 379 +(% _msthash="666" _msttexthash="2049957" _mstvisible="1" %) 380 +~/~/ data.devSerialNumber = metadata['ss_serialNumber']; 381 + 382 +(% _msthash="665" _msttexthash="1576731" _mstvisible="1" %) 383 +~/~/ ~/~/ Result object with encoded downlink payload 384 + 385 +(% _msthash="664" _msttexthash="183287" _mstvisible="1" %) 386 +var result = { 387 + 388 +(% _msthash="663" _msttexthash="2331082" _mstvisible="1" %) 389 + ~/~/ downlink data content type: JSON, TEXT or BINARY (base64 format) 390 + 391 +(% _msthash="662" _msttexthash="322049" _mstvisible="1" %) 392 + contentType: "TEXT", 393 + 394 +(% _msthash="661" _msttexthash="249210" _mstvisible="1" %) 395 + ~/~/ downlink data 396 + 397 +(% _msthash="660" _msttexthash="1524952" _mstvisible="1" %) 398 + data: msg.shared_value ,~/~/JSON.stringify(data), 399 + 400 +(% _msthash="659" _msttexthash="2147704" _mstvisible="1" %) 401 + ~/~/ Optional metadata object presented in key/value format 402 + 403 +(% _msthash="658" _msttexthash="150189" _mstvisible="1" %) 404 + metadata: { 405 + 406 +(% _msthash="657" _msttexthash="1241370" _mstvisible="1" %) 407 + topic: '/test/down/'+metadata.deviceName 408 + 409 +(% _mstvisible="1" %) 410 + } 411 + 412 +(% _mstvisible="1" %) 413 +}; 414 + 415 +(% _msthash="656" _msttexthash="233116" _mstvisible="1" %) 416 +return result; 417 + 418 +(% _mstvisible="1" %) 419 +---- 420 + 421 +(% _mstvisible="1" %) 422 +== (% _msthash="655" _msttexthash="640094" _mstvisible="2" %)4.4 Configure the connection(%%) == 423 + 424 +(% _msthash="654" _msttexthash="1780675" _mstvisible="1" %) 425 +Generate MQTT certificate integrated on chirpstack 426 + 427 +(% _msthash="653" _msttexthash="3723447" _mstvisible="1" %) 428 +Chirpstack generates CA certificate, TLS certificate, and TLS key respectively 429 + 430 +(% _msthash="652" _msttexthash="5123092" _mstvisible="1" %) 431 +They correspond to the CA certificate file, Certificate file, and Private key file on thingseye 432 + 433 +(% _mstvisible="1" %) 434 +(% _mstvisible="3" %)[[image:图片4.png||_mstalt="5131737" _msthash="622" _mstvisible="5" height="504" width="1016"]] 435 + 436 +(% _mstvisible="1" %) 437 +(% _mstvisible="3" %)[[image:图片5.png||_mstalt="5131854" _msthash="624" _mstvisible="5" height="505" width="1017"]] 438 + 439 +(% _mstvisible="1" %) 440 +* Copy the contents of the certificates and paste them into the linked file below, a total of three certificates are required 441 + 442 +(% _mstvisible="1" %) 443 +(% _msthash="650" _msttexthash="44967858" _mstvisible="2" %)**Integrated Certificate File demo Download Address:** 444 + 445 +(% _mstvisible="1" %) 446 +[[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"]] 447 + 448 +(% _msthash="648" _msttexthash="4037631" _mstvisible="1" %) 449 +Enter the server address Host: lns1.thingseye.io on the Connection configuration 450 + 451 +(% _msthash="647" _msttexthash="93873" _mstvisible="1" %) 452 +Port: 8883 453 + 454 +(% _msthash="646" _msttexthash="380666" _mstvisible="1" %) 455 +Credentials type: PEM 456 + 457 +(% _msthash="645" _msttexthash="880399" _mstvisible="1" %) 458 +Upload the certificate and key file 459 + 460 +(% _mstvisible="1" %) 461 +(% _mstvisible="3" %)[[image:图片6.png||_mstalt="5131971" _msthash="626" _mstvisible="5" height="509" width="1026"]] 462 + 463 +(% _mstvisible="1" %) 464 +(% _mstvisible="3" %)[[image:图片7.png||_mstalt="5132088" _msthash="628" _mstvisible="5" height="509" width="1025"]] 465 + 466 +(% _mstvisible="1" %) 467 +---- 468 + 469 +(% _msthash="644" _msttexthash="472992" _mstvisible="1" %) 470 +The default for Topic is: 471 + 472 +(% _msthash="643" _msttexthash="2223559" _mstvisible="1" %) 473 +application/**chirpstack application id**/device/+/event/up 474 + 475 +(% _mstvisible="1" %) 476 +(% _mstvisible="3" %)[[image:图片8.png||_mstalt="5132205" _msthash="630" _mstvisible="5" height="508" width="1024"]] 477 + 478 + 479 +(% _mstvisible="1" class="wikigeneratedid" %) 480 +(% _mstvisible="3" %)[[image:屏幕截图 2024-11-25 095805.png||_mstalt="10831028" _msthash="632" _mstvisible="5" height="301" width="1024"]] 481 + 482 +(% _mstvisible="1" %) 483 +---- 484 + 485 +(% _mstvisible="1" %) 486 +== (% _msthash="642" _msttexthash="471978" _mstvisible="2" %)4.5 Check the connection(%%) == 487 + 488 +(% _mstvisible="1" %) 489 +(% _mstvisible="3" %)[[image:图片9.png||_mstalt="5132322" _msthash="634" _mstvisible="5" height="509" width="1025"]] 490 + 491 +(% _mstvisible="1" %) 492 +(% _mstvisible="3" %)[[image:图片10.png||_mstalt="5142449" _msthash="636" _mstvisible="5" height="509" width="1026"]] 493 + 494 + 495 +(% _mstvisible="1" %) 496 +---- 497 + 498 +(% _mstvisible="1" %) 499 += (% _msthash="641" _msttexthash="418145" _mstvisible="2" %)5. Check Data Uplink Log(%%) = 500 + 501 +(% _msthash="640" _msttexthash="1422681" _mstvisible="1" %) 502 +User can check the devices log in Intergration. 503 + 504 +(% _mstvisible="1" %) 505 +(% _mstvisible="3" %)[[image:1729562069134-315.png||_mstalt="294190" _msthash="638" _mstvisible="5" 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
- 1758762919291-489.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.hera - Size
-
... ... @@ -1,0 +1,1 @@ 1 +209.4 KB - Content
- 1758763019466-819.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.hera - Size
-
... ... @@ -1,0 +1,1 @@ 1 +227.9 KB - Content
- 1758763061703-634.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.hera - Size
-
... ... @@ -1,0 +1,1 @@ 1 +222.0 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