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