<
From version < 46.2 >
edited by Xiaoling
on 2022/07/14 16:19
To version < 51.1 >
edited by Xiaoling
on 2024/08/19 15:00
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -15,7 +15,7 @@
15 15  This MQTT forward instruction is for below devices:
16 16  
17 17  * Firmware Version > LG02_LG08-5.3.1580178039 [[Firmware Download>>url:http://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/LPS8/Firmware/Release/]]
18 -* LG01N, OLG01N ((% style="color:red" %)**Warning**(%%): LG01-P LG01-S use another instruction: [[MQTT for LG01-P/LG01S>>doc:Through MQTT to upload data.WebHome]])
18 +* LG01N, OLG01N ((% style="color:red" %)**Warning**(%%): LG01-P LG01-S use another instruction: [[MQTT for LG01-P/LG01S>>doc:Main.Through MQTT to upload data.WebHome]])
19 19  * LG02, OLG02
20 20  * LG308, DLOS8
21 21  * LPS8
... ... @@ -23,8 +23,6 @@
23 23  * MS14 series if installed with the same firmware. (in this case, the MQTT forward will work , but no LoRa support)
24 24  
25 25  
26 -
27 -
28 28  = 2.  Firmware Change Log for MQTT feature =
29 29  
30 30  
... ... @@ -36,11 +36,8 @@
36 36  ** Initiate version
37 37  
38 38  
39 -
40 -
41 41  = 3.  MQTT forward operating principle =
42 42  
43 -
44 44  == 3.1  Network Structure ==
45 45  
46 46  
... ... @@ -47,7 +47,7 @@
47 47  Below shows the network structure for MQTT forwarding.
48 48  
49 49  * **For Uplink:**  The sensor sends data to LoRa Gateway via LoRa wireless, The gateway will process these data and forward to remote MQTT Broker via Internet.
50 -* **For Downlink:** The gateway subscribe a topic in the MQTT broker, when there is update on the topic, the gateway will know and broadcast the data to Local LoRa network,
45 +* **For Downlink:** The gateway subscribe a topic in the MQTT broker, when there is update on the topic, the gateway will know and broadcast the data to Local LoRa network.
51 51  
52 52  [[image:image-20220527133547-1.png]]
53 53  
... ... @@ -62,6 +62,7 @@
62 62  
63 63  === 3.2.1  Upstream ===
64 64  
60 +
65 65  Assume there are two sensor nodes, their ID are Node1 ID: 6734 , Node2 ID: 7456. In the remote MQTT broker there are two topics: Topic1: /channel/765800, Topic2: /channel/367860. We can set up in the gateway to map Node1 to Topic1 and Node2 to Topic2. So when there is a sensor data from Node1, the gateway will forward the data to Topic1, when there is sensor data from Node2, the gateway will forward to Topic2.
66 66  
67 67  (((
... ... @@ -118,6 +118,7 @@
118 118  * USERNAME: User ID (-u)
119 119  * HOSTNAME: Device Hostname
120 120  
117 +
121 121  === 3.3.2  -m message macro ===
122 122  
123 123  
... ... @@ -127,6 +127,7 @@
127 127  * META: Completely sensor data with time stamp and rssi
128 128  * JSON: Convert META to json format.
129 129  
127 +
130 130  === 3.3.3  Example for Macro ===
131 131  
132 132  
... ... @@ -152,7 +152,6 @@
152 152  )))
153 153  
154 154  
155 -
156 156  == 3.4  Modify the MQTT to support more options ==
157 157  
158 158  
... ... @@ -280,10 +280,8 @@
280 280  )))
281 281  
282 282  
283 -
284 284  = 4.  Example to communicate to a simple MQTT server =
285 285  
286 -
287 287  == 4.1  Overview ==
288 288  
289 289  
... ... @@ -318,9 +318,9 @@
318 318  Downstream: Subscribe a topic to get downstream
319 319  
320 320  
321 -
322 322  == 4.3  Simulate via Dragino Command Line ==
323 323  
318 +
324 324  For first try of MQTT connection, simulate via command line is recommend, there are many servers / connection type for MQTT. They are using different connection parameters. Simulating the connection via command line will help us rapidly connect to server and debug.
325 325  
326 326  In the Dragino Gateway, we use [[mosquitto client>>url:https://mosquitto.org/]] for MQTT connection.
... ... @@ -339,7 +339,6 @@
339 339  mosquitto_pub
340 340  
341 341  
342 -
343 343  (% style="color:blue" %)**For Downstream**
344 344  
345 345  Use [[mosquitto_sub>>url:https://mosquitto.org/man/mosquitto_sub-1.html]] to subscribe the change on the topic.
... ... @@ -351,6 +351,7 @@
351 351  
352 352  == 4.4  Configure Dragino UI for MQTT connection ==
353 353  
348 +
354 354  This chapter are step by step to show to configure the Dragino Menu for MQTT auto connection.
355 355  
356 356  (((
... ... @@ -371,7 +371,6 @@
371 371  forward to MQTT
372 372  
373 373  
374 -
375 375  === 4.4.1  Configure the MQTT Client for Upstream ===
376 376  
377 377  
... ... @@ -392,7 +392,6 @@
392 392  MQTT Publish configure
393 393  
394 394  
395 -
396 396  [[image:image-20220527135929-13.png]]
397 397  
398 398  MQTT Channel settings
... ... @@ -421,7 +421,6 @@
421 421  MQTT Publish
422 422  
423 423  
424 -
425 425  === 4.4.2  Configure the MQTT Client for Downstream ===
426 426  
427 427  
... ... @@ -459,6 +459,7 @@
459 459  In above section, we have configured the UI to support MQTT upstream and downstream. We can simulate via Linux command. In this section, we will guide how to communicate with remote LoRa End Node for upstream and downstream.
460 460  
461 461  
454 +
462 462  === 4.5.1  Use LoRa Raw protocol for communication ~-~- For LG01/LG02 ===
463 463  
464 464  
... ... @@ -489,7 +489,6 @@
489 489  LoRa Parameter should match
490 490  
491 491  
492 -
493 493  Below is the test result after the Arduino Sketch is running.
494 494  
495 495  [[image:image-20220527140459-19.png]]
... ... @@ -497,13 +497,11 @@
497 497  Upstream Data Flow
498 498  
499 499  
500 -
501 501  [[image:image-20220527140542-20.png]]
502 502  
503 503  Downstream Data Flow
504 504  
505 505  
506 -
507 507  === 4.5.2  Use LoRaWAN Protocol for communication ~-~- For LG308/LPS8/DLOS8 ===
508 508  
509 509  
... ... @@ -515,11 +515,11 @@
515 515  When use test this feature, please use the version higher then : (% style="color:#4f81bd" %)**LG02_LG08~-~-build-v5.4.1593400722-20200629-1120**(%%), in this version, the upload format is changed and readable, which is easier for integration.
516 516  
517 517  
518 -(% style="color:#4f81bd" %)**Video Instruction**(%%): (% style="color:blue" %)[[https:~~/~~/youtu.be/qJTY441-t90>>url:https://youtu.be/qJTY441-t90]]
508 +(% style="color:blue" %)**Video Instruction**(%%): (% style="color:blue" %)[[https:~~/~~/youtu.be/qJTY441-t90>>url:https://youtu.be/qJTY441-t90]]
519 519  )))
520 520  
521 521  (((
522 -(% style="color:blued" %)**Step 1**(%%): Refer [[Communicate with ABP End Node>>Communicate with ABP End Node without LoRaWAN Network Server --- LG308]] to know how to set up LG308 to work with LoRaWAN End node.
512 +(% style="color:blue" %)**Step 1**(%%): Refer [[Communicate with ABP End Node>>Communicate with ABP End Node without LoRaWAN Network Server --- LG308]] to know how to set up LG308 to work with LoRaWAN End node.
523 523  )))
524 524  
525 525  (((
... ... @@ -540,44 +540,36 @@
540 540  [[image:image-20220613191345-4.png]]
541 541  
542 542  
543 -
544 544  (% style="color:blue" %)**Step 4**(%%): Map the Device Address to Remote ID in MQTT server.
545 545  
546 546  [[image:image-20220613190635-2.png]]
547 547  
548 548  
549 -
550 550  (% style="color:blue" %)**Step 5: Upstream**(%%): Save the change, we can see the log info via "sytem log", End Node and MQTT Server
551 551  
552 552  [[image:image-20220527141843-24.png]]
553 553  
554 554  
555 -
556 -
557 557  [[image:image-20220527141933-25.png]]
558 558  
559 559  Choose ASCII Format
560 560  
561 561  
562 -
563 563  [[image:image-20220527142028-26.png]]
564 564  
565 565  LHT65 Decoder
566 566  
567 567  
568 -
569 569  (% style="color:blue" %)**Step 6: Set up subscribe**(%%)**:** Subscribe a topci for downstream.
570 570  
571 571  [[image:image-20220613191426-5.png]]
572 572  
573 573  
574 -
575 575  (% style="color:blue" %)**Step 7: Downstream**(%%): Save the change, we can see the log info via "sytem log", End Node and MQTT Server.
576 576  
577 577  [[image:image-20220527142239-28.png]]
578 578  
579 579  
580 -
581 581  === 4.5.3 MQTT Downstream format ===
582 582  
583 583  
... ... @@ -592,7 +592,7 @@
592 592  
593 593  (% class="box infomessage" %)
594 594  (((
595 -**mosquitto_pub -h 10.130.2.192 -p 1883 -t dragino-1d25dc/ -m "260211D,time,txt,hello,20,1,SF12,923300000,2 > /var/iot/push/test"**
577 +**mosquitto_pub -h 10.130.2.192 -p 1883 -t dragino-1d25dc/ -m "260211D,time,txt,hello,20,1,SF12,923300000,2"**
596 596  )))
597 597  
598 598  Or use [[MQTT.fx>>https://mqttfx.jensd.de/index.php/download]]
... ... @@ -606,7 +606,6 @@
606 606  Check out this link for more mosquito-related directives [[https:~~/~~/mosquitto.org/man/mosquitto_pub-1.html>>https://mosquitto.org/man/mosquitto_pub-1.html]]
607 607  
608 608  
609 -
610 610  = 5.  How to Debug =
611 611  
612 612  
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0