Changes for page MQTT Forward Instruction
Last modified by Kilight Cao on 2024/08/31 16:26
Summary
-
Page properties (1 modified, 0 added, 0 removed)
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,7 +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 27 = 2. Firmware Change Log for MQTT feature = 28 28 29 29 ... ... @@ -35,10 +35,8 @@ 35 35 ** Initiate version 36 36 37 37 38 - 39 39 = 3. MQTT forward operating principle = 40 40 41 - 42 42 == 3.1 Network Structure == 43 43 44 44 ... ... @@ -47,13 +47,11 @@ 47 47 * **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. 48 48 * **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. 49 49 50 - 51 51 [[image:image-20220527133547-1.png]] 52 52 53 53 General MQTT structure 54 54 55 55 56 - 57 57 == 3.2 How sensor data is forwarded == 58 58 59 59 ... ... @@ -67,8 +67,6 @@ 67 67 68 68 ((( 69 69 The data flow works as below diagram. 70 - 71 - 72 72 ))) 73 73 74 74 [[image:image-20220527134000-2.png]] ... ... @@ -101,7 +101,6 @@ 101 101 Downstream path 102 102 103 103 104 - 105 105 == 3.3 Macro Definition == 106 106 107 107 ... ... @@ -110,7 +110,6 @@ 110 110 ((( 111 111 Currently the (% style="color:#4f81bd" %)**-t (topic)**(%%) and (% style="color:#4f81bd" %)**-m (message)**(%%) support Macros. 112 112 113 - 114 114 115 115 ))) 116 116 ... ... @@ -124,7 +124,6 @@ 124 124 * HOSTNAME: Device Hostname 125 125 126 126 127 - 128 128 === 3.3.2 -m message macro === 129 129 130 130 ... ... @@ -135,7 +135,6 @@ 135 135 * JSON: Convert META to json format. 136 136 137 137 138 - 139 139 === 3.3.3 Example for Macro === 140 140 141 141 ... ... @@ -161,7 +161,6 @@ 161 161 ))) 162 162 163 163 164 - 165 165 == 3.4 Modify the MQTT to support more options == 166 166 167 167 ... ... @@ -289,10 +289,8 @@ 289 289 ))) 290 290 291 291 292 - 293 293 = 4. Example to communicate to a simple MQTT server = 294 294 295 - 296 296 == 4.1 Overview == 297 297 298 298 ... ... @@ -327,7 +327,6 @@ 327 327 Downstream: Subscribe a topic to get downstream 328 328 329 329 330 - 331 331 == 4.3 Simulate via Dragino Command Line == 332 332 333 333 ... ... @@ -349,7 +349,6 @@ 349 349 mosquitto_pub 350 350 351 351 352 - 353 353 (% style="color:blue" %)**For Downstream** 354 354 355 355 Use [[mosquitto_sub>>url:https://mosquitto.org/man/mosquitto_sub-1.html]] to subscribe the change on the topic. ... ... @@ -359,7 +359,6 @@ 359 359 mosquitto_sub 360 360 361 361 362 - 363 363 == 4.4 Configure Dragino UI for MQTT connection == 364 364 365 365 ... ... @@ -383,7 +383,6 @@ 383 383 forward to MQTT 384 384 385 385 386 - 387 387 === 4.4.1 Configure the MQTT Client for Upstream === 388 388 389 389 ... ... @@ -404,7 +404,6 @@ 404 404 MQTT Publish configure 405 405 406 406 407 - 408 408 [[image:image-20220527135929-13.png]] 409 409 410 410 MQTT Channel settings ... ... @@ -433,7 +433,6 @@ 433 433 MQTT Publish 434 434 435 435 436 - 437 437 === 4.4.2 Configure the MQTT Client for Downstream === 438 438 439 439 ... ... @@ -471,6 +471,7 @@ 471 471 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. 472 472 473 473 454 + 474 474 === 4.5.1 Use LoRa Raw protocol for communication ~-~- For LG01/LG02 === 475 475 476 476 ... ... @@ -501,7 +501,6 @@ 501 501 LoRa Parameter should match 502 502 503 503 504 - 505 505 Below is the test result after the Arduino Sketch is running. 506 506 507 507 [[image:image-20220527140459-19.png]] ... ... @@ -509,13 +509,11 @@ 509 509 Upstream Data Flow 510 510 511 511 512 - 513 513 [[image:image-20220527140542-20.png]] 514 514 515 515 Downstream Data Flow 516 516 517 517 518 - 519 519 === 4.5.2 Use LoRaWAN Protocol for communication ~-~- For LG308/LPS8/DLOS8 === 520 520 521 521 ... ... @@ -552,44 +552,36 @@ 552 552 [[image:image-20220613191345-4.png]] 553 553 554 554 555 - 556 556 (% style="color:blue" %)**Step 4**(%%): Map the Device Address to Remote ID in MQTT server. 557 557 558 558 [[image:image-20220613190635-2.png]] 559 559 560 560 561 - 562 562 (% style="color:blue" %)**Step 5: Upstream**(%%): Save the change, we can see the log info via "sytem log", End Node and MQTT Server 563 563 564 564 [[image:image-20220527141843-24.png]] 565 565 566 566 567 - 568 - 569 569 [[image:image-20220527141933-25.png]] 570 570 571 571 Choose ASCII Format 572 572 573 573 574 - 575 575 [[image:image-20220527142028-26.png]] 576 576 577 577 LHT65 Decoder 578 578 579 579 580 - 581 581 (% style="color:blue" %)**Step 6: Set up subscribe**(%%)**:** Subscribe a topci for downstream. 582 582 583 583 [[image:image-20220613191426-5.png]] 584 584 585 585 586 - 587 587 (% style="color:blue" %)**Step 7: Downstream**(%%): Save the change, we can see the log info via "sytem log", End Node and MQTT Server. 588 588 589 589 [[image:image-20220527142239-28.png]] 590 590 591 591 592 - 593 593 === 4.5.3 MQTT Downstream format === 594 594 595 595 ... ... @@ -604,7 +604,7 @@ 604 604 605 605 (% class="box infomessage" %) 606 606 ((( 607 -**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"** 608 608 ))) 609 609 610 610 Or use [[MQTT.fx>>https://mqttfx.jensd.de/index.php/download]] ... ... @@ -618,7 +618,6 @@ 618 618 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]] 619 619 620 620 621 - 622 622 = 5. How to Debug = 623 623 624 624