Changes

no edit summary
Line 46: Line 46:  
----
 
----
 
Once you have the local server running, use the local IP and port number in your internet browser. In this case, we are using 127.0.0.1:1880:
 
Once you have the local server running, use the local IP and port number in your internet browser. In this case, we are using 127.0.0.1:1880:
[[File:Use server address in web browser.png|border|600px|class=tlt-border]]
+
[[File:Use server address in web browser.png|border|500px|class=tlt-border]]
    
For MQTT usage, we are going to need MQTT-specific nodes. Use the side menu to navigate to Manage Palette section and install these nodes:
 
For MQTT usage, we are going to need MQTT-specific nodes. Use the side menu to navigate to Manage Palette section and install these nodes:
Line 52: Line 52:  
*node-red-contrib-mqtt-broker
 
*node-red-contrib-mqtt-broker
   −
[[File:Manage palette and download these mqtt nodes.png|border|600px|class=tlt-border]]
+
[[File:Manage palette and download these mqtt nodes.png|border|500px|class=tlt-border]]
    
==MQTT Gateway==
 
==MQTT Gateway==
 +
===Using Teltonika device as an MQTT broker===
 +
Router setup when using the router as a broker consists of two parts. First, we are going to set up a local broker. In order to do so, navigate to '''Services -> MQTT -> Broker''' and enable the broker.
 +
 +
[[File:Enable broker node red local broker on router.png|border|500px|class=tlt-border]]
 +
 +
Once done, navigate to '''Services -> Modbus -> MQTT Gateway'''. Follow these steps for the configuration:
 +
*Enable the instance
 +
*Host: since we are using a local broker on the router – 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]]
 +
 +
===Node-RED setup when using Teltonika device as an MQTT broker===
 +
 +
----
 +
 +
For this example, we are going to need '''MQTT-in''' and '''MQTT-out''' nodes. We are not going to need a broker node for now, since we are using our router as an MQTT broker. In order to send request and get response messages, we are also going to need '''inject''' and '''debug''' nodes. Drag required nodes onto the screen and click on them to configure accordingly:
 +
 +
*'''MQTT-out node''' - click on this node and then click on the pencil icon to configure Node-RED for Teltonika broker usage.
 +
 +
[[File:Click on the pencil nodered broker local.png|border|500px|class=tlt-border]]
 +
 +
In the next screen configure settings accordingly:
 +
 +
*Name: RUT_broker for this example
 +
*Server: 192.168.10.1 (Router's LAN IP address)
 +
*Port: Default port 1883
 +
*Leave everything else as default or adjust to your needs
 +
 +
[[File:Mqtt broker on our router settings.png|border|500px|class=tlt-border]]
 +
----
 +
Now we are going to go back to MQTT-out node configuration and set up like this:
 +
*Server: RUT_broker
 +
*Topic: request
 +
 +
[[File:Mqtt out request node red.png|border|500px|class=tlt-border]]
 +
 +
----
 +
 +
*'''MQTT-in node''' - configure settings as shown below:
 +
 +
*Server: RUT_broker
 +
*Action: Subscribe to single topic
 +
*Topic: response
 +
*QoS: 0
 +
*Output: auto-detect
 +
 +
[[File:Mqtt in response node red.png|border|500px|class=tlt-border]]
 +
 +
----
 +
 +
*'''Inject node''' - here we only need to input a payload. To find required message format, refer to this article: [[Modbus TCP Master MQTT Gateway]]
 +
 +
For this example, we will try to get router's temperature, so we are going to use payload in this format: '''0 65432 0 192.168.10.1 502 5 1 3 6 2'''
 +
 +
[[File:Inject node red example.png|border|500px|class=tlt-border]]
 +
 +
There is no need to configure debug node. Here is how the finished Flowchart should look like:
 +
 +
[[File:Flowchart nodered local broker on router.png|border|500px|class=tlt-border]]
 +
 +
----
 +
 +
In order to test the configuration, press '''Deploy''' in the top right corner:
 +
 +
[[File:Deploy button nodered.png|border|400px|class=tlt-border]]
 +
 +
Now press on '''Inject''' node and look for incoming message on the right side of the screen:
 +
 +
[[File:Router temperature nodered.png|border|300px|class=tlt-border]]
 +
 +
Here we can see that the router's temperature is 38.0 degrees.

Navigation menu