Line 165: |
Line 165: |
| | | |
| To test the configuration, '''deploy''' the nodes again and send the message by clicking on the '''inject''' node. | | To test the configuration, '''deploy''' the nodes again and send the message by clicking on the '''inject''' node. |
| + | |
| + | ==MQTT gateway using MQTT explorer and Node-RED broker== |
| + | |
| + | In this example, we are going to use the same Node-RED broker configured in previous parts of this article, only this time we are going to use [http://mqtt-explorer.com/ MQTT Explorer] app to Publish and Subscribe to Modbus data. |
| + | |
| + | Here's connection topology for this use case: |
| + | |
| + | [[File:Nodered configurationexample topo6.png|border|800px|class=tlt-border]] |
| + | |
| + | ===Device setup=== |
| + | ---- |
| + | Navigate to '''Services -> Modbus -> MQTT Gateway'''. Follow these steps for the configuration: |
| + | # '''Enable''': on |
| + | # '''Host''': input '''192.168.10.139''', or if you would like to use local broker on the device - input '''127.0.0.1''' |
| + | Leave everything else as default, or adjust according to your needs |
| + | |
| + | [[File:MQTT gateway settings node red local router.png|border|500px|class=tlt-border]] |
| + | |
| + | ===MQTT explorer setup and testing=== |
| + | ---- |
| + | Open MQTT Explorer application and in the default screen input the '''Host IP (1)''' of MQTT Broker, then press '''Connect (2)'''. |
| + | |
| + | [[File:Mqtt explorer server connection to broker example.png|border|600px|class=tlt-border]] |
| + | |
| + | Once done, locate Publish section on the right side. You can use the same settings as in previous sections of MQTT Gateway: |
| + | |
| + | # '''Topic:''' request |
| + | # '''Data:''' 0 65432 0 192.168.10.1 502 5 1 3 6 2 |
| + | |
| + | [[File:Publish from mqtt explorer node red example.png|border|500px|class=tlt-border]] |
| + | |
| + | If everything is set up correctly, then you should be able to see response from the router: |
| + | |
| + | [[File:Mqtt explorer response from router.png|border|400px|class=tlt-border]] |
| + | |
| | | |
| ==Modbus Data to Server via MQTT protocol== | | ==Modbus Data to Server via MQTT protocol== |
Line 310: |
Line 345: |
| | | |
| [[File:Nodered configurationexample httpData incoming v1.png|border|400px|class=tlt-border]] | | [[File:Nodered configurationexample httpData incoming v1.png|border|400px|class=tlt-border]] |
− |
| |
− | ==MQTT gateway using MQTT explorer and Node-RED broker==
| |
− |
| |
− | In this example, we are going to use the same Node-RED broker configured in previous parts of this article, only this time we are going to use [http://mqtt-explorer.com/ MQTT Explorer] app to Publish and Subscribe to Modbus data.
| |
− |
| |
− | Here's connection topology for this use case:
| |
− |
| |
− | [[File:Nodered configurationexample topo6.png|border|800px|class=tlt-border]]
| |
− |
| |
− | ===Device setup===
| |
− | ----
| |
− | Navigate to '''Services -> Modbus -> MQTT Gateway'''. Follow these steps for the configuration:
| |
− | # '''Enable''': on
| |
− | # '''Host''': input '''192.168.10.139''', or if you would like to use local broker on the device - input '''127.0.0.1'''
| |
− | Leave everything else as default, or adjust according to your needs
| |
− |
| |
− | [[File:MQTT gateway settings node red local router.png|border|500px|class=tlt-border]]
| |
− |
| |
− | ===MQTT explorer setup and testing===
| |
− | ----
| |
− | Open MQTT Explorer application and in the default screen input the '''Host IP (1)''' of MQTT Broker, then press '''Connect (2)'''.
| |
− |
| |
− | [[File:Mqtt explorer server connection to broker example.png|border|600px|class=tlt-border]]
| |
− |
| |
− | Once done, locate Publish section on the right side. You can use the same settings as in previous sections of MQTT Gateway:
| |
− |
| |
− | # '''Topic:''' request
| |
− | # '''Data:''' 0 65432 0 192.168.10.1 502 5 1 3 6 2
| |
− |
| |
− | [[File:Publish from mqtt explorer node red example.png|border|500px|class=tlt-border]]
| |
− |
| |
− | If everything is set up correctly, then you should be able to see response from the router:
| |
− |
| |
− | [[File:Mqtt explorer response from router.png|border|400px|class=tlt-border]]
| |
| | | |
| ==Summary== | | ==Summary== |