Changes

Line 3: Line 3:  
<span style="color: red;">The information in this page is updated in accordance with the <span style="color: #0054A6;"><b>RUTXXX_R_00_07_03</b></span> firmware version.</span>
 
<span style="color: red;">The information in this page is updated in accordance with the <span style="color: #0054A6;"><b>RUTXXX_R_00_07_03</b></span> firmware version.</span>
   −
Node-RED is a flow-based programming tool developed by IBM Emerging Technology and written in Node.js. It provides a browser-based editor for wiring together hardware devices, APIs, and online services using a visual programming interface.
+
Node-RED is a flow-based programming tool developed by IBM Emerging Technology and written in Node.js. It provides a browser-based editor for wiring together hardware devices, APIs, and online services using a visual programming interface. More information about Node-RED could be found [https://nodered.org/ here].
    
This article provides an extensive configuration example with details on how to use Node-RED with Teltonika Routers via MQTT and HTTP protocols.
 
This article provides an extensive configuration example with details on how to use Node-RED with Teltonika Routers via MQTT and HTTP protocols.
Line 18: Line 18:  
There are a couple of different use cases with Node-RED and Teltonika devices:
 
There are a couple of different use cases with Node-RED and Teltonika devices:
   −
# [[Draft:Nodered#MQTT_Gateway | MQTT gateway using either Node-RED or Teltonika device as MQTT broker.]]
+
# [[Modbus_and_Bluetooth_data_sending_to_Node-RED#MQTT_Gateway | MQTT gateway using either Node-RED or Teltonika device as MQTT broker.]]
# [[Draft:Nodered#Modbus_Data_to_Server_via_MQTT_protocol | Modbus data to server using either Node-RED or Teltonika device as MQTT broker.]]
+
# [[Modbus_and_Bluetooth_data_sending_to_Node-RED#Modbus_Data_to_Server_via_MQTT_protocol | Modbus data to server using either Node-RED or Teltonika device as MQTT broker.]]
# [[Draft:Nodered#Bluetooth_Data_to_Server_via_MQTT_protocol | Bluetooth data to server using Teltonika device as MQTT broker.]]
+
# [[Modbus_and_Bluetooth_data_sending_to_Node-RED#Bluetooth_Data_to_Server_via_MQTT_protocol | Bluetooth data to Node-RED server.]]
# [[Draft:Nodered#Modbus_Data_to_Server_via_HTTP_protocol | HTTP data to Node-RED server.]]
+
# [[Modbus_and_Bluetooth_data_sending_to_Node-RED#Modbus_Data_to_Server_via_HTTP_protocol | HTTP data to Node-RED server.]]
# [[Draft:Nodered#MQTT_gateway_using_MQTT_explorer_and_Node-RED_broker | MQTT gateway using MQTT Explorer.]]
      
==Node-RED installation and setup==
 
==Node-RED installation and setup==
Line 43: Line 42:  
[[File:Server is running node red terminal.png|border|600px|class=tlt-border]]
 
[[File:Server is running node red terminal.png|border|600px|class=tlt-border]]
 
----
 
----
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|500px|class=tlt-border]]
 
[[File:Use server address in web browser.png|border|500px|class=tlt-border]]
   Line 54: Line 53:  
==MQTT Gateway==
 
==MQTT Gateway==
   −
MQTT Gateway allows to query the device from MQTT Clients, in this section we will configure it to work with the Node-RED.
+
MQTT Gateway allows to query the device from MQTT Clients, in this section we will configure it to work with the Node-RED.  
    
===Using Teltonika device as an MQTT broker===
 
===Using Teltonika device as an MQTT broker===
 
----
 
----
 +
 +
Here is connection topology for this use case:
 +
 +
[[File:Nodered configurationexample topo5gw.png|border|700px|class=tlt-border]]
 +
 
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.
 
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.
   Line 136: Line 140:  
===Using Node-RED as an MQTT broker===
 
===Using Node-RED as an MQTT broker===
 
----
 
----
 +
 +
Here we are using Node-RED as MQTT Broker, so we are going to do necessary changes in order for this functionality to work.
 +
 +
Here is the connection topology for this use case:
 +
 +
[[File:Nodered configurationexample topo1.png|border|700px|class=tlt-border]]
 +
 
====Adjusting Node-RED configuration====
 
====Adjusting Node-RED configuration====
   Line 153: Line 164:     
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==
    
In this section, we are going to upload Modbus data to server on Node-RED. First of all, we are going to need Modbus data source, in this example we are using the same device as Modbus TCP Slave and Master.
 
In this section, we are going to upload Modbus data to server on Node-RED. First of all, we are going to need Modbus data source, in this example we are using the same device as Modbus TCP Slave and Master.
 +
 +
Here's connection topology for this use case:
 +
 +
[[File:Nodered configurationexample topo2.png|850px|class=tlt-border]]
    
===Device configuration===
 
===Device configuration===
Line 183: Line 232:  
# '''Brackets''': use brackets
 
# '''Brackets''': use brackets
   −
Press enable to enable the Modbus request
+
Press enable to enable the Modbus request.
    
[[File:Tcp master nodered.png|border|1050px|class=tlt-border]]
 
[[File:Tcp master nodered.png|border|1050px|class=tlt-border]]
Line 200: Line 249:  
# '''Topic''': rutx (input any preferred topic, make sure to subscribe on the same topic)
 
# '''Topic''': rutx (input any preferred topic, make sure to subscribe on the same topic)
   −
[[File:Data sender settings to node red with node red broker.png|border|1000px|class=tlt-border]]
+
[[File:Data sender settings to node red with node red broker.png|border|800px|class=tlt-border]]
    
===Node-RED setup===
 
===Node-RED setup===
Line 225: Line 274:  
==Bluetooth Data to Server via MQTT protocol==
 
==Bluetooth Data to Server via MQTT protocol==
   −
In this section, we are going to upload Bluetooth data to server on Node-RED. The configuration is going to be similar to Modbus data to server. More information about bluetooth functionality ant usage with beacons could be found in [[Teltonika EYE device pairing and data sender configuration example]].
+
In this section, we are going to upload Bluetooth data to server on Node-RED. The configuration is going to be similar to Modbus data to server. More information about Bluetooth functionality ant usage with beacons could be found in [[Teltonika EYE device pairing and data sender configuration example]].  
 +
 
 +
Here's connection topology for this use case:
 +
 
 +
[[File:Nodered configurationexample topo3.png|border|800px|class=tlt-border]]
    
===Device configuration===
 
===Device configuration===
Line 244: Line 297:  
# '''Topic''': beacon (input any preferred topic, make sure to subscribe on the same topic)
 
# '''Topic''': beacon (input any preferred topic, make sure to subscribe on the same topic)
   −
[[File:Bluetooth data sender settings rutx11.png|border|600px|class=tlt-border]]
+
[[File:Bluetooth data sender settings rutx11.png|border|800px|class=tlt-border]]
    
===Node-RED setup===
 
===Node-RED setup===
Line 255: Line 308:     
In this section, we will adjust the configuration in order to get the data via HTTP protocol.
 
In this section, we will adjust the configuration in order to get the data via HTTP protocol.
 +
 +
Here's connection topology for this use case:
 +
 +
[[File:Nodered configurationexample topo4.png|border|800px|class=tlt-border]]
    
===Device configuration===
 
===Device configuration===
Line 287: Line 344:  
[[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==
+
==Summary==
   −
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.'
+
In this article, several use cases are discussed, such as MQTT gateway using Node-RED or Teltonika device as MQTT broker, Modbus data to server, Bluetooth data to server, HTTP data to Node-RED server, and MQTT gateway using MQTT Explorer. The article provides steps on how to install Node-RED on a Linux virtual machine, install MQTT-specific nodes, and set up a local server. The article also explains how to use the Teltonika device as an MQTT broker and set up Node-RED to work with it.
   −
===Device setup===
+
==References==
----
+
 
Navigate to '''Services -> Modbus -> MQTT Gateway'''. Follow these steps for the configuration:
+
[https://nodered.org/ Node-RED]
# '''Enable''': on
+
 
# '''Host''': if you are using local broker on the device - input '''127.0.0.1''', otherwise input your MQTT broker address
+
[[Modbus TCP Master MQTT Gateway]]
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]]
+
[[Teltonika EYE device pairing and data sender configuration example]]
   −
===MQTT explorer setup and testing===
+
[http://mqtt-explorer.com/ MQTT Explorer]
----
 

Navigation menu