Last modified by Hera Guo on 2025/02/18 09:29

From version 15.1
edited by Hera Guo
on 2024/11/27 09:02
Change comment: There is no comment for this version
To version 6.1
edited by Chxy
on 2024/10/08 17:25
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.hera
1 +XWiki.EdwinChen
Content
... ... @@ -14,7 +14,7 @@
14 14  == 2.1 UDP Interface ==
15 15  
16 16  * Server Address: server1.thingseye.io
17 -* Port: 11562
17 +* Port: 11560
18 18  
19 19  The data sent to above UDP interface will not go directly to client's database.
20 20  
... ... @@ -25,7 +25,7 @@
25 25  
26 26  Download the UDP Test Tool from:  [[https:~~/~~/sourceforge.net/projects/sockettest/ >>https://sourceforge.net/projects/sockettest/]]. Run this tool, and input the server address and UDP port  as below and click send.
27 27  
28 -[[image:1728566363151-470.png]]
28 +[[image:1728362612869-443.png||height="454" width="540"]]
29 29  
30 30  In server side, Tenant Administrator can check this in Tenant UDP Server location.
31 31  
... ... @@ -44,8 +44,7 @@
44 44  
45 45  Device here is **[[S31-NB>>https://www.dragino.com/products/temperature-humidity-sensor/item/288-s31-nb-s31b-nb.html]]** : and have been configure below
46 46  
47 -* Set to use ThingsEye UDP server: **AT+SERVADDR=server1.thingseye.io,11562**
48 -* Use UDP Uplink & Json protocol:** AT+PRO=2,5**
47 +* Set to use ThingsEye UDP server: **AT+SERVADDR=server1.thingseye.io,11560**
49 49  * Equip with a NB-IoT SIM Card to access to NB-IoT Network.
50 50  
51 51  The S31-NB's cellular module has the IMEI: **863663062789483**
... ... @@ -71,260 +71,4 @@
71 71  
72 72  
73 73  
74 -= 3.  Connect to The Things Stack =
75 -
76 -== 3.1 Network Structure ==
77 -
78 -
79 -== 3.2 Creat Integration for The Things Stack. ==
80 -
81 -(% class="lead" %)
82 -Add Integration
83 -
84 -[[image:1728535775119-971.png||height="456" width="1087"]]
85 -
86 -
87 -(% class="lead" %)
88 -Choose Connection Type
89 -
90 -[[image:1728535857345-950.png]]
91 -
92 -
93 -(% class="lead" %)
94 -Input Uplink Data Converter Code
95 -
96 -[[image:1728535941851-388.png||height="466" width="398"]]
97 -
98 -Demo JavaScript Code: [[https:~~/~~/raw.githubusercontent.com/ThingsEye-io/te-platform/refs/heads/main/Data%20Converters/The_Things_Network_MQTT_Uplink_Converter.js >>https://raw.githubusercontent.com/ThingsEye-io/te-platform/refs/heads/main/Data%20Converters/The_Things_Network_MQTT_Uplink_Converter.js]]
99 -
100 -
101 -(% class="lead" %)
102 -Input Downlink Converter
103 -
104 -[[image:1728536142721-488.png||height="470" width="407"]]
105 -
106 -Example Javascript Code as below: [[https:~~/~~/raw.githubusercontent.com/ThingsEye-io/te-platform/refs/heads/main/Data%20Converters/The_Things_Network_MQTT_Downlink_Converter.js>>https://raw.githubusercontent.com/ThingsEye-io/te-platform/refs/heads/main/Data%20Converters/The_Things_Network_MQTT_Downlink_Converter.js]]
107 -
108 -
109 -(% class="lead" %)
110 -Set up Connection to The Things Network application
111 -
112 -[[image:1728536305503-380.png||height="510" width="1206"]]
113 -
114 -
115 -
116 -(% class="lead" %)
117 -Test Connection & Add iIntegration
118 -
119 -[[image:1728536374214-962.png]]
120 -
121 -After add , we can see the integration here:
122 -
123 -[[image:1728536420275-153.png||height="208" width="1404"]]
124 -
125 -
126 -== 3.3 Test Uplink ==
127 -
128 -We can use Simulate Uplink to simulate an uplink in the things stack. Then we should be able to see the message in ThingsEye
129 -
130 -[[image:1728536524638-768.png||height="493" width="1071"]]
131 -
132 -
133 -[[image:1728536541040-814.png]]
134 -
135 -= 4.Connect chirpstack to Thingseye by way of MQTT =
136 -
137 -* **How to connect chirpstack to Thingseye by way of MQTT? The following tutorial will show you**
138 -
139 -== 4.1 Thingseye adds MQTT integration ==
140 -
141 -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";
142 -
143 -[[image:图片1.png||height="655" width="1320"]]
144 -
145 -== 4.2 Add an uplink and downlink data converter ==
146 -
147 -In the function decoder field, specify the script to parse and transform the data.
148 -
149 -[[image:图片2.png||height="653" width="1315"]]
150 -
151 -* **Uplink——JavaScript:**
152 -
153 -var data = decodeToJson(payload);
154 -
155 -var deviceName = data.deviceInfo.deviceName;
156 -
157 -var deviceType = data.applicationName;
158 -
159 -var devEui = data.deviceInfo.devEui
160 -
161 -var label = data.deviceInfo.devEui
162 -
163 -var model = {};
164 -
165 -var data2 = data.object;
166 -
167 -var flg = data.fPort
168 -
169 -for (var key in data2) {
170 -
171 - ~/~/ 将属性名存入新对象中
172 -
173 - model[key] = data2[key];
174 -
175 -}
176 -
177 -~/~/var obj = {"devid":deviceName}
178 -
179 -var result = {
180 -
181 - deviceName: deviceName,
182 -
183 - deviceType: deviceType,
184 -
185 - telemetry: model,
186 -
187 - groupName: "Case Study",
188 -
189 - ~/~/label:label,
190 -
191 - attributes:{"devEui":devEui,
192 -
193 - ~/~/"timevalue":"test",
194 -
195 - "inactivityTimeout":1260000
196 -
197 - ~/~/ "High_humidity_alarm":"not set",
198 -
199 - ~/~/ "High_temperature_alarm":"not set",
200 -
201 - ~/~/ "Low_humidity_alarm":"not set",
202 -
203 - ~/~/ "Low_temperature_alarm":"not set",
204 -
205 - ~/~/ "Low_voltage_alarm":"not set"
206 -
207 - ~/~/"customerName": "Civionic Engineering & Consulting (2014) Inc."
208 -
209 - }
210 -
211 -};
212 -
213 -function decodeToString(payload) {
214 -
215 - return String.fromCharCode.apply(String, payload);
216 -
217 -}
218 -
219 -function decodeToJson(payload) {
220 -
221 - var str = decodeToString(payload);
222 -
223 - var data = JSON.parse(str);
224 -
225 - return data;
226 -
227 -}
228 -
229 -return result;
230 -
231 -[[image:图片3.png||height="657" width="1324"]]
232 -
233 -* **Dowblink——JavaScript:**
234 -
235 -~/~/ Encode downlink data from incoming Rule Engine message
236 -
237 -~/~/ msg - JSON message payload downlink message json
238 -
239 -~/~/ msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.
240 -
241 -~/~/ metadata - list of key-value pairs with additional data about the message
242 -
243 -~/~/ integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter
244 -
245 -~/~/ /~*~* Encoder ~*~*/
246 -
247 -~/~/var data = {"value":99};
248 -
249 -~/~/ ~/~/ Process data from incoming message and metadata
250 -
251 -~/~/ data.tempFreq = msg.temperatureUploadFrequency;
252 -
253 -~/~/ data.humFreq = msg.humidityUploadFrequency;
254 -
255 -~/~/ data.devSerialNumber = metadata['ss_serialNumber'];
256 -
257 -~/~/ ~/~/ Result object with encoded downlink payload
258 -
259 -var result = {
260 -
261 - ~/~/ downlink data content type: JSON, TEXT or BINARY (base64 format)
262 -
263 - contentType: "TEXT",
264 -
265 - ~/~/ downlink data
266 -
267 - data: msg.shared_value ,~/~/JSON.stringify(data),
268 -
269 - ~/~/ Optional metadata object presented in key/value format
270 -
271 - metadata: {
272 -
273 - topic: '/test/down/'+metadata.deviceName
274 -
275 - }
276 -
277 -};
278 -
279 -return result;
280 -
281 -== 4.3 Configure the connection ==
282 -
283 -Generate MQTT certificate integrated on chirpstack
284 -
285 -Chirpstack generates CA certificate, TLS certificate, and TLS key respectively
286 -
287 -They correspond to the CA certificate file, Certificate file, and Private key file on thingseye
288 -
289 -[[image:图片4.png||height="669" width="1348"]]
290 -
291 -[[image:图片5.png||height="669" width="1348"]]
292 -
293 -* Copy the contents of the certificates and paste them into the linked file below, a total of three certificates are required
294 -
295 -**Integrated Certificate File demo Download Address:**
296 -
297 -[[https:~~/~~/github.com/ThingsEye-io/te-platform/tree/main/chirpstack>>https://github.com/ThingsEye-io/te-platform/tree/main/chirpstack]]
298 -
299 -Enter the server address Host: lns1.thingseye.io on the Connection configuration
300 -
301 -Port: 8883
302 -
303 -Credentials type: PEM
304 -
305 -Upload the certificate and key file
306 -
307 -[[image:图片6.png||height="672" width="1353"]]
308 -
309 -[[image:图片7.png||height="671" width="1352"]]
310 -
311 -The default for Topic is:
312 -
313 -application/**chirpstack application id**/device/+/event/up
314 -
315 -[[image:图片8.png||height="673" width="1356"]]
316 -
317 -[[image:1732500689044-955.png]]
318 -
319 -== 4.4 Check the connection ==
320 -
321 -[[image:图片9.png||height="718" width="1446"]]
322 -
323 -[[image:图片10.png||height="711" width="1432"]]
324 -
325 -
326 -= 5. Check Data Uplink Log =
327 -
328 -User can check the devices log in Intergration.
329 -
330 -[[image:1729562069134-315.png||height="587" width="723"]]
73 +
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