Jump to content

Template:Networking rutos manual modbus: Difference between revisions

no edit summary
No edit summary
Line 21: Line 21:
<u><b>
<u><b>


Note:</b> On {{{name}}}, Modbus TCP Slave/Master and MQTT Gateway is additional software that can be installed from the <b>Services → [[{{{name}}} Package Manager|Package Manager]]</b> page.</u><br>}}
Note:</b> On {{{name}}}, Modbus TCP Server/Client and MQTT Gateway is additional software that can be installed from the <b>Services → [[{{{name}}} Package Manager|Package Manager]]</b> page.</u><br>}}
{{Template:Networking_rutos_manual_basic_advanced_webui_disclaimer
{{Template:Networking_rutos_manual_basic_advanced_webui_disclaimer
| series = {{{series}}}
| series = {{{series}}}
}}
}}


==Modbus TCP Slave==
==Modbus TCP Server==


A <b>Modbus TCP Slave</b> listens for connections from a TCP master (client) and sends out a response or sets some system related parameter in accordance with the given query. This provides the user with the possibility to set or get system parameters.  
A <b>Modbus TCP Server</b> listens for connections from a TCP Client (client) and sends out a response or sets some system related parameter in accordance with the given query. This provides the user with the possibility to set or get system parameters.  


The figure below is an example of the Modbus TCP window section and the table below provides information on the fields contained in that window:
The figure below is an example of the Modbus TCP window section and the table below provides information on the fields contained in that window:
Line 53: Line 53:
       <td>Device ID</td>
       <td>Device ID</td>
       <td>integer [0..255]; default: <b>1</b></td>
       <td>integer [0..255]; default: <b>1</b></td>
       <td>The device's Modbus slave ID. When set to 0, it will respond to requests addressed to any ID.</td>
       <td>The device's Modbus server ID. When set to 0, it will respond to requests addressed to any ID.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 68: Line 68:
     <td>Keep persistent connection</td>
     <td>Keep persistent connection</td>
         <td>off | on; default: <b>onn</b></td>
         <td>off | on; default: <b>onn</b></td>
         <td>Allows keep the connection open after responding a Modbus TCP master request.</td>
         <td>Allows keep the connection open after responding a Modbus TCP client request.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 98: Line 98:


{{#ifeq: {{{serial}}} | 1 |
{{#ifeq: {{{serial}}} | 1 |
==Modbus Serial Slave==
==Modbus Serial Server==
A <b>Modbus Serial Slave</b> listens for connections from a serial master (client) and sends out a response or sets some system related parameter in accordance with the given query. This provides the user with the possibility to set or get system parameters.  
A <b>Modbus Serial Server</b> listens for connections from a serial client and sends out a response or sets some system related parameter in accordance with the given query. This provides the user with the possibility to set or get system parameters.  


===Modbus Serial Slave Configuration===
===Modbus Serial Server Configuration===
----
----
The <b>Modbus Serial Slave Configuration</b> section is used to configure serial slaves. By default, the list is empty. To add a new slave instance, enter the instance name, select serial interface and click the 'Add' button.
The <b>Modbus Serial Server Configuration</b> section is used to configure serial servers. By default, the list is empty. To add a new server instance, enter the instance name, select serial interface and click the 'Add' button.


[[File:Networking_rutos_manual_modbus_modbus_serial_slave_add_button_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}_v1.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_slave_add_button_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}_v1.png|border|class=tlt-border]]


After clicking 'Add' you will be redirected to the newly added slave instance configuration page.
After clicking 'Add' you will be redirected to the newly added server instance configuration page.


[[File:Networking_rutos_manual_modbus_modbus_serial_slave_configuration_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}_v1.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_slave_configuration_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}_v1.png|border|class=tlt-border]]
Line 120: Line 120:
         <td>Enable</td>
         <td>Enable</td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>Enables this Modbus Serial Slave instance configuration.</td>
         <td>Enables this Modbus Serial Server instance configuration.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Name</td>
         <td>Name</td>
         <td>string; default: <b>none</b></td>
         <td>string; default: <b>none</b></td>
         <td>Name of the serial slave instance. Used for management purposes only.</td>
         <td>Name of the serial server instance. Used for management purposes only.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 221: Line 221:
|dualsim = {{{dualsim}}}
|dualsim = {{{dualsim}}}
}}
}}
==Modbus TCP Master==
==Modbus TCP Client==


A <b>Modbus Master</b> device can request data from Modbus slaves. The Modbus TCP Master section is used to configure Modbus TCP slaves. By default, the slave list is empty. To add a new slave, click the 'Add' button
A <b>Modbus Client</b> device can request data from Modbus servers. The Modbus TCP Client section is used to configure Modbus TCP servers. By default, the server list is empty. To add a new server, click the 'Add' button


[[File:Networking_rutos_manual_modbus_modbus_tcp_master_modbus_tcp_slave_devices_add_button.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_tcp_master_modbus_tcp_slave_devices_add_button.png|border|class=tlt-border]]


After clicking 'Add' you will be redirected to the newly added slave's configuration page.
After clicking 'Add' you will be redirected to the newly added server's configuration page.


===Slave Device Configuration===
===Server Device Configuration===
----
----
The <b>Slave Device Configuration</b> section is used to configure the parameters of Modbus TCP slaves that the Master (this {{{name}}} device) will be querying with requests. The figure below is an example of the Slave Device Configuration and the table below provides information on the fields contained in that section:
The <b>Server Device Configuration</b> section is used to configure the parameters of Modbus TCP servers that the Client (this {{{name}}} device) will be querying with requests. The figure below is an example of the Server Device Configuration and the table below provides information on the fields contained in that section:


[[File:Networking_rutos_manual_modbus_modbus_tcp_master_slave_device_configuration_v2.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_tcp_master_slave_device_configuration_v2.png|border|class=tlt-border]]
Line 244: Line 244:
         <td>Enabled</td>
         <td>Enabled</td>
         <td>off | on; default: <b>off</b></td>
         <td>off | on; default: <b>off</b></td>
         <td>Turns communication with the slave device on or off.</td>
         <td>Turns communication with the server device on or off.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Name</td>
         <td>Name</td>
         <td>string; default: <b>none</b></td>
         <td>string; default: <b>none</b></td>
         <td>Slave device's name, used for easier management purposes.</td>
         <td>Server device's name, used for easier management purposes.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Slave ID</td>
         <td>Server ID</td>
         <td>integer [0..255]; default: <b>none</b></td>
         <td>integer [0..255]; default: <b>none</b></td>
         <td>Slave ID. Each slave in a network is assigned a unique identifier ranging from 1 to 255. When the master requests data from a slave, the first byte it sends is the Slave ID. When set to 0, the slave will respond to requests addressed to any ID.</td>
         <td>Server ID. Each server in a network is assigned a unique identifier ranging from 1 to 255. When the client requests data from a server, the first byte it sends is the Server ID. When set to 0, the server will respond to requests addressed to any ID.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>IP address</td>
         <td>IP address</td>
         <td>ip4; default: <b>none</b></td>
         <td>ip4; default: <b>none</b></td>
         <td>Slave device's IP address.</td>
         <td>Server device's IP address.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Port</td>
         <td>Port</td>
         <td>integer [0..65535]; default: <b>none</b></td>
         <td>integer [0..65535]; default: <b>none</b></td>
         <td>Slave device's Modbus TCP port.</td>
         <td>Server device's Modbus TCP port.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Period</td>
         <td>Period</td>
         <td>integer [1..86400]; default: <b>60</b></td>
         <td>integer [1..86400]; default: <b>60</b></td>
         <td>Interval at which requests are sent to the slave device.</td>
         <td>Interval at which requests are sent to the server device.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 305: Line 305:
===Requests Configuration===
===Requests Configuration===
----
----
A Modbus <b>request</b> is a way of obtaining data from Modbus slaves. The master sends a request to a slave specifying the function code to be performed. The slave then sends the requested data back to the Modbus master.
A Modbus <b>request</b> is a way of obtaining data from Modbus servers. The client sends a request to a server specifying the function code to be performed. The server then sends the requested data back to the Modbus client.


<span style="color:red"> <b>Note: </b></span> Modbus TCP Master uses <i>Register Number</i> instead of <i>Register Address</i> for pointing to a register. For example, to request the <i>Uptime</i> of a device, you must use <b>2</b> in the <i>First Register</i> field.
<span style="color:red"> <b>Note: </b></span> Modbus TCP Client uses <i>Register Number</i> instead of <i>Register Address</i> for pointing to a register. For example, to request the <i>Uptime</i> of a device, you must use <b>2</b> in the <i>First Register</i> field.


The Request Configuration list is empty by default. To add a new Request Configuration loon to the Add New Instance section. Enter a custom name into the 'Name' field and click the 'Add' button:
The Request Configuration list is empty by default. To add a new Request Configuration loon to the Add New Instance section. Enter a custom name into the 'Name' field and click the 'Add' button:
Line 376: Line 376:
===Alarms Configuration===
===Alarms Configuration===
----
----
<b>Alarms</b> are a way of setting up automated actions when some Modbus values meet user-defined conditions. When the Modbus TCP Master (this {{{name}}} device) requests some information from a slave device it compares that data to with the parameters set in an Alarm Configuration. If the comparison meets the specified condition (more than, less than, equal to, not equal to), the Master performs a user-specified action, for example, a Modbus write request or switching the state of an output.
<b>Alarms</b> are a way of setting up automated actions when some Modbus values meet user-defined conditions. When the Modbus TCP Client (this {{{name}}} device) requests some information from a server device it compares that data to with the parameters set in an Alarm Configuration. If the comparison meets the specified condition (more than, less than, equal to, not equal to), the Client performs a user-specified action, for example, a Modbus write request or switching the state of an output.


The figure below is an example of the Alarms Configuration list. To create a new Alarm, click the 'Add' button.
The figure below is an example of the Alarms Configuration list. To create a new Alarm, click the 'Add' button.
Line 400: Line 400:
         <td>Function code</td>
         <td>Function code</td>
         <td>Read Coil Status (1) | Read Input Status (2) | Read Holding Registers (3) | Read Input Registers (4); default: <b>Read Coil Status (1)</b></td>
         <td>Read Coil Status (1) | Read Input Status (2) | Read Holding Registers (3) | Read Input Registers (4); default: <b>Read Coil Status (1)</b></td>
         <td>Modbus function used for this alarm's Modbus request. The Modbus TCP Master (this {{{name}}} device) perform this request as often as specified in the 'Period' field in [[#Slave_Device_Configuration|Slave Device Configuration]].</td>
         <td>Modbus function used for this alarm's Modbus request. The Modbus TCP Client (this {{{name}}} device) perform this request as often as specified in the 'Period' field in [[#Slave_Device_Configuration|Server Device Configuration]].</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 443: Line 443:
             <ul>{{#ifeq: {{{mobile}}} | 1 |
             <ul>{{#ifeq: {{{mobile}}} | 1 |
                 <li><b>SMS</b> - sends and SMS message to a specified recipient(s).</li>|}}
                 <li><b>SMS</b> - sends and SMS message to a specified recipient(s).</li>|}}
                 <li><b>Modbus Request</b> - sends a Modbus Write request to a specified slave.</li>
                 <li><b>Modbus Request</b> - sends a Modbus Write request to a specified server.</li>
{{#switch:{{{series}}}|TCR1=|TRB2=|#default=<li><b>Trigger output</b> - changes state of selected I/O output pin.</li>}}
{{#switch:{{{series}}}|TCR1=|TRB2=|#default=<li><b>Trigger output</b> - changes state of selected I/O output pin.</li>}}
             </ul>
             </ul>
Line 461: Line 461:
         <td><span style="color: purple;">MODBUS Write Request: IP address</span></td>
         <td><span style="color: purple;">MODBUS Write Request: IP address</span></td>
         <td>ip | host; default: <b>none</b></td>
         <td>ip | host; default: <b>none</b></td>
         <td>Modbus slave's IP address.</td>
         <td>Modbus server's IP address.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td><span style="color: purple;">MODBUS Write Request: Port</span></td>
         <td><span style="color: purple;">MODBUS Write Request: Port</span></td>
         <td>integer [0..65535]; default: <b>none</b></td>
         <td>integer [0..65535]; default: <b>none</b></td>
         <td>Modbus slave's port.</td>
         <td>Modbus server's port.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 476: Line 476:
         <td><span style="color: purple;">MODBUS Write Request: ID</span></td>
         <td><span style="color: purple;">MODBUS Write Request: ID</span></td>
         <td>integer [1..255]; default: <b>none</b></td>
         <td>integer [1..255]; default: <b>none</b></td>
         <td>Modbus slave ID.</td>
         <td>Modbus server ID.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 548: Line 548:
</table>
</table>
{{#ifeq: {{{serial}}} | 1 |
{{#ifeq: {{{serial}}} | 1 |
==Modbus Serial Master==
==Modbus Serial Client==


The <b>Modbus Serial Master</b> page is used to configure the device as a Modbus RTU Master. Modbus RTU (remote terminal unit) is a serial communication protocol mainly used in communication via serial interfaces.
The <b>Modbus Serial Client</b> page is used to configure the device as a Modbus RTU Client. Modbus RTU (remote terminal unit) is a serial communication protocol mainly used in communication via serial interfaces.


<!--<u><b>Note:</b> Modbus Serial Master is additional software that can be installed from the <b>Services → [[{{{name}}} Package Manager|Package Manager]]</b> page.</u>-->
<!--<u><b>Note:</b> Modbus Serial Client is additional software that can be installed from the <b>Services → [[{{{name}}} Package Manager|Package Manager]]</b> page.</u>-->


===Modbus Serial Device Configuration===
===Modbus Serial Device Configuration===
----
----
This section is used to create Modbus Serial Master's slave device instances. You may create a Serial Device instance for each supported serial interface.  
This section is used to create Modbus Serial Client's server device instances. You may create a Serial Device instance for each supported serial interface.  


[[File:Networking_rutos_manual_modbus_modbus_serial_master_device_configuration.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_device_configuration.png|border|class=tlt-border]]
Line 566: Line 566:
After clicking 'Add' you will be redirected to the newly added device's configuration page.
After clicking 'Add' you will be redirected to the newly added device's configuration page.


====RS Device Modbus Master Configuration====
====RS Device Modbus Client Configuration====
----
----
This section is used to configure the Modbus Serial Master's slave device interface settings.
This section is used to configure the Modbus Serial Client's server device interface settings.


[[File:Networking_rutos_manual_modbus_modbus_serial_master_device_configuration_rs_device_modbus_master_configuration_v1_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_device_configuration_rs_device_modbus_master_configuration_v1_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}.png|border|class=tlt-border]]
Line 637: Line 637:
</table>
</table>


===Modbus Slave Device Configuration===
===Modbus Server Device Configuration===
----
----
This section is used to create slave instances that the Master (this {{{name}}} device) will be querying with requests.
This section is used to create server instances that the Client (this {{{name}}} device) will be querying with requests.


[[File:Networking_rutos_manual_modbus_modbus_serial_master_modbus_slave_device_configuration_v1.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_modbus_slave_device_configuration_v1.png|border|class=tlt-border]]


By default there are no instances created. To add a new slave configuration, enter an instance name, select a serial device instance and click the 'Add' button.
By default there are no instances created. To add a new server configuration, enter an instance name, select a serial device instance and click the 'Add' button.


[[File:Networking_rutos_manual_modbus_modbus_serial_master_modbus_slave_device_configuration_add_button_v1.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_modbus_slave_device_configuration_add_button_v1.png|border|class=tlt-border]]


After clicking 'Add' you will be redirected to the newly added slave's configuration page.
After clicking 'Add' you will be redirected to the newly added server's configuration page.


====Slave Device Configuration====
====Server Device Configuration====
----
----
The <b>Slave Device Configuration</b> section is used to configure the parameters of Modbus RTU slaves that the Master (this {{{name}}} device) will be querying with requests. The figure below is an example of the Slave Device Configuration and the table below provides information on the fields contained in that section:
The <b>Server Device Configuration</b> section is used to configure the parameters of Modbus RTU servers that the Client (this {{{name}}} device) will be querying with requests. The figure below is an example of the Server Device Configuration and the table below provides information on the fields contained in that section:


[[File:Networking_rutos_manual_modbus_modbus_serial_master_slave_device_configuration_v1.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_slave_device_configuration_v1.png|border|class=tlt-border]]
Line 664: Line 664:
         <td>Enabled</td>
         <td>Enabled</td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>Turns communication with the slave device on or off.</td>
         <td>Turns communication with the server device on or off.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Name</td>
         <td>Name</td>
         <td>string; default: <b>none</b></td>
         <td>string; default: <b>none</b></td>
         <td>Slave device's name, used for easier management purposes.</td>
         <td>Server device's name, used for easier management purposes.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Slave device</td>
         <td>Server device</td>
         <td><i>slave device instance</i>; default: <b>none</b></td>
         <td><i>server device instance</i>; default: <b>none</b></td>
         <td>Specifies which serial device will be used on this slave.</td>
         <td>Specifies which serial device will be used on this server.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Slave ID</td>
         <td>Server ID</td>
         <td>integer [0..255]; default: <b>none</b></td>
         <td>integer [0..255]; default: <b>none</b></td>
         <td>Slave ID. Each slave in a network is assigned a unique identifier ranging from 1 to 255. When the master requests data from a slave, the first byte it sends is the Slave ID. When set to 0, the slave will respond to requests addressed to any ID.</td>
         <td>Server ID. Each server in a network is assigned a unique identifier ranging from 1 to 255. When the client requests data from a server, the first byte it sends is the Server ID. When set to 0, the server will respond to requests addressed to any ID.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 704: Line 704:
         <td>Period</td>
         <td>Period</td>
         <td>integer [1..99999]; default: <b>none</b></td>
         <td>integer [1..99999]; default: <b>none</b></td>
         <td>Interval at which requests are sent to the slave device.</td>
         <td>Interval at which requests are sent to the server device.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 715: Line 715:
=====Requests Configuration=====
=====Requests Configuration=====
----
----
A Modbus <b>request</b> is a way of obtaining data from Modbus slaves. The master sends a request to a slave specifying the function code to be performed. The slave then sends the requested data back to the Modbus master.  
A Modbus <b>request</b> is a way of obtaining data from Modbus servers. The client sends a request to a servers specifying the function code to be performed. The server then sends the requested data back to the Modbus client.  


<span style="color:red"> <b>Note: </b></span> Modbus Serial Master uses <i>Register Number</i> instead of <i>Register Address</i> for pointing to a register. For example, to request the <i>Uptime</i> of a device, you must use <b>2</b> in the <i>First Register</i> field.
<span style="color:red"> <b>Note: </b></span> Modbus Serial Client uses <i>Register Number</i> instead of <i>Register Address</i> for pointing to a register. For example, to request the <i>Uptime</i> of a device, you must use <b>2</b> in the <i>First Register</i> field.


The Request Configuration list is empty by default. To add a new Request Configuration loon to the Add New Instance section. Enter a custom name into the 'Name' field and click the 'Add' button:
The Request Configuration list is empty by default. To add a new Request Configuration loon to the Add New Instance section. Enter a custom name into the 'Name' field and click the 'Add' button:
Line 784: Line 784:
[[File:Networking_rutos_manual_modbus_modbus_tcp_master_requests_configuration_testing.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_tcp_master_requests_configuration_testing.png|border|class=tlt-border]]


=====Modbus Master Alarms=====
=====Modbus Client Alarms=====
----
----
<b>Alarms</b> are a way of setting up automated actions when some Modbus values meet user-defined conditions. When the Modbus Serial Master (this {{{name}}} device) requests some information from a slave device it compares that data to with the parameters set in an Alarm Configuration. If the comparison meets the specified condition (more than, less than, equal to, not equal to), the Master performs a user-specified action, for example, a Modbus write request or switching the state of an output.
<b>Alarms</b> are a way of setting up automated actions when some Modbus values meet user-defined conditions. When the Modbus Serial Client (this {{{name}}} device) requests some information from a server device it compares that data to with the parameters set in an Alarm Configuration. If the comparison meets the specified condition (more than, less than, equal to, not equal to), the Client performs a user-specified action, for example, a Modbus write request or switching the state of an output.


The figure below is an example of the Modbus Master Alarms list. To create a new Alarm, click the 'Add' button.
The figure below is an example of the Modbus Client Alarms list. To create a new Alarm, click the 'Add' button.


[[File:Networking_rutos_manual_modbus_modbus_serial_master_modbus_master_alarms_add_button.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_modbus_master_alarms_add_button.png|border|class=tlt-border]]
Line 810: Line 810:
         <td>Function code</td>
         <td>Function code</td>
         <td>Read Coil Status (1) {{!}} Read Input Status (2) {{!}} Read Holding Registers (3) {{!}} Read Input Registers (4); default: <b>Read Coil Status (1)</b></td>
         <td>Read Coil Status (1) {{!}} Read Input Status (2) {{!}} Read Holding Registers (3) {{!}} Read Input Registers (4); default: <b>Read Coil Status (1)</b></td>
         <td>Modbus function used for this alarm's Modbus request. The Modbus TCP Master (this {{{name}}} device) perform this request as often as specified in the 'Period' field in [[#Slave_Device_Configuration|Slave Device Configuration]].</td>
         <td>Modbus function used for this alarm's Modbus request. The Modbus TCP Client (this {{{name}}} device) perform this request as often as specified in the 'Period' field in [[#Slave_Device_Configuration|Server Device Configuration]].</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 853: Line 853:
             <ul>{{#ifeq: {{{mobile}}} | 1 |
             <ul>{{#ifeq: {{{mobile}}} | 1 |
                 <li><b>SMS</b> - sends and SMS message to a specified recipient(s).</li>|}}
                 <li><b>SMS</b> - sends and SMS message to a specified recipient(s).</li>|}}
                 <li><b>Modbus Request</b> - sends a Modbus Write request to a specified slave.</li>
                 <li><b>Modbus Request</b> - sends a Modbus Write request to a specified server.</li>
{{#switch:{{{series}}}|TCR1=|TRB2=|#default=<li><b>Trigger output</b> - changes state of selected I/O output pin.</li>}}
{{#switch:{{{series}}}|TCR1=|TRB2=|#default=<li><b>Trigger output</b> - changes state of selected I/O output pin.</li>}}
             </ul>
             </ul>
Line 876: Line 876:
         <td><span style="color: purple;">MODBUS Write Request: ID</span></td>
         <td><span style="color: purple;">MODBUS Write Request: ID</span></td>
         <td>integer [1..255]; default: <b>none</b></td>
         <td>integer [1..255]; default: <b>none</b></td>
         <td>Modbus slave ID.</td>
         <td>Modbus server ID.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 915: Line 915:
===Console===
===Console===
----
----
This section is used to configure the Modbus Serial Master's <b>Console</b> serial interface settings. Refer to the figure and table below for information on Console configuration.
This section is used to configure the Modbus Serial Client's <b>Console</b> serial interface settings. Refer to the figure and table below for information on Console configuration.


[[File:Networking_rutos_manual_modbus_modbus_serial_master_console_configuration.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_console_configuration.png|border|class=tlt-border]]
Line 928: Line 928:
         <td>Enabled</td>
         <td>Enabled</td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>Turns Modbus Serial Master configuration via RS232 on or off. Both this and RS232 from Services → [[{{{name}}} RS232|RS232]] cannot be enabled at the same time.</td>
         <td>Turns Modbus Serial Client configuration via RS232 on or off. Both this and RS232 from Services → [[{{{name}}} RS232|RS232]] cannot be enabled at the same time.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 968: Line 968:
</table>
</table>


====Console Slave Devices List====
====Console Server Devices List====
----
----
The <b>Console Slave Devices List</b> section is used to configure the parameters of Modbus RTU slaves that the Master (this {{{name}}} device) will be querying with requests.
The <b>Console Server Devices List</b> section is used to configure the parameters of Modbus RTU servers that the Client (this {{{name}}} device) will be querying with requests.


The list is empty by default. In order to create a new slave device configuration, click the 'Add' button. A new configuration window should pop up.
The list is empty by default. In order to create a new server device configuration, click the 'Add' button. A new configuration window should pop up.


[[File:Networking_rutos_manual_modbus_modbus_serial_master_console_slave_devices_list_add_button.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_console_slave_devices_list_add_button.png|border|class=tlt-border]]


=====Slave Device Configuration=====
=====Server Device Configuration=====
----
----
The <b>Slave Device Configuration</b> section is used to configure the parameters of Modbus RTU slaves that the Master (this {{{name}}} device) will be querying with requests. The figure below is an example of the Slave Device Configuration and the table below provides information on the fields contained in that section:
The <b>Server Device Configuration</b> section is used to configure the parameters of Modbus RTU servers that the Client (this {{{name}}} device) will be querying with requests. The figure below is an example of the Server Device Configuration and the table below provides information on the fields contained in that section:


[[File:Networking_rutos_manual_modbus_modbus_serial_master_rs232_slave_device_configuration.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_rs232_slave_device_configuration.png|border|class=tlt-border]]
Line 991: Line 991:
         <td>Enabled</td>
         <td>Enabled</td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>off {{!}} on; default: <b>off</b></td>
         <td>Turns communication with the slave device on or off.</td>
         <td>Turns communication with the server device on or off.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Name</td>
         <td>Name</td>
         <td>string; default: <b>none</b></td>
         <td>string; default: <b>none</b></td>
         <td>Slave device's name, used for easier management purposes.</td>
         <td>Server device's name, used for easier management purposes.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Slave ID</td>
         <td>Server ID</td>
         <td>integer [0..255]; default: <b>none</b></td>
         <td>integer [0..255]; default: <b>none</b></td>
         <td>Slave ID. Each slave in a network is assigned a unique identifier ranging from 1 to 255. When the master requests data from a slave, the first byte it sends is the Slave ID. When set to 0, the slave will respond to requests addressed to any ID.</td>
         <td>Server ID. Each server in a network is assigned a unique identifier ranging from 1 to 255. When the client requests data from a server, the first byte it sends is the Server ID. When set to 0, the server will respond to requests addressed to any ID.</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>Period</td>
         <td>Period</td>
         <td>integer [1..86400]; default: <b>60</b></td>
         <td>integer [1..86400]; default: <b>60</b></td>
         <td>Interval at which requests are sent to the slave device.</td>
         <td>Interval at which requests are sent to the server device.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 1,016: Line 1,016:
=====Requests Configuration=====
=====Requests Configuration=====
----
----
A Modbus <b>request</b> is a way of obtaining data from Modbus slaves. The master sends a request to a slave specifying the function code to be performed. The slave then sends the requested data back to the Modbus master.
A Modbus <b>request</b> is a way of obtaining data from Modbus servers. The client sends a request to a server specifying the function code to be performed. The server then sends the requested data back to the Modbus client.


<span style="color:red"> <b>Note: </b></span> Modbus Serial Master uses <i>Register Number</i> instead of <i>Register Address</i> for pointing to a register. For example, to request the <i>Uptime</i> of a device, you must use <b>2</b> in the <i>First Register</i> field.
<span style="color:red"> <b>Note: </b></span> Modbus Serial Client uses <i>Register Number</i> instead of <i>Register Address</i> for pointing to a register. For example, to request the <i>Uptime</i> of a device, you must use <b>2</b> in the <i>First Register</i> field.


The Request Configuration list is empty by default. To add a new Request Configuration loon to the Add New Instance section. Enter a custom name into the 'Name' field and click the 'Add' button:
The Request Configuration list is empty by default. To add a new Request Configuration loon to the Add New Instance section. Enter a custom name into the 'Name' field and click the 'Add' button:
Line 1,085: Line 1,085:
[[File:Networking_rutos_manual_modbus_modbus_tcp_master_requests_configuration_testing.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_tcp_master_requests_configuration_testing.png|border|class=tlt-border]]


=====Modbus Master Alarms=====
=====Modbus Client Alarms=====
----
----
<b>Alarms</b> are a way of setting up automated actions when some Modbus values meet user-defined conditions. When the Modbus Serial Master (this {{{name}}} device) requests some information from a slave device it compares that data to with the parameters set in an Alarm Configuration. If the comparison meets the specified condition (more than, less than, equal to, not equal to), the Master performs a user-specified action, for example, a Modbus write request or switching the state of an output.
<b>Alarms</b> are a way of setting up automated actions when some Modbus values meet user-defined conditions. When the Modbus Serial Client (this {{{name}}} device) requests some information from a server device it compares that data to with the parameters set in an Alarm Configuration. If the comparison meets the specified condition (more than, less than, equal to, not equal to), the Client performs a user-specified action, for example, a Modbus write request or switching the state of an output.


The figure below is an example of the Modbus Master Alarms list. To create a new Alarm, click the 'Add' button.
The figure below is an example of the Modbus Client Alarms list. To create a new Alarm, click the 'Add' button.


[[File:Networking_rutos_manual_modbus_modbus_serial_master_modbus_master_alarms_add_button.png|border|class=tlt-border]]
[[File:Networking_rutos_manual_modbus_modbus_serial_master_modbus_master_alarms_add_button.png|border|class=tlt-border]]
Line 1,111: Line 1,111:
         <td>Function code</td>
         <td>Function code</td>
         <td>Read Coil Status (1) {{!}} Read Input Status (2) {{!}} Read Holding Registers (3) {{!}} Read Input Registers (4); default: <b>Read Coil Status (1)</b></td>
         <td>Read Coil Status (1) {{!}} Read Input Status (2) {{!}} Read Holding Registers (3) {{!}} Read Input Registers (4); default: <b>Read Coil Status (1)</b></td>
         <td>Modbus function used for this alarm's Modbus request. The Modbus TCP Master (this {{{name}}} device) perform this request as often as specified in the 'Period' field in [[#Slave_Device_Configuration|Slave Device Configuration]].</td>
         <td>Modbus function used for this alarm's Modbus request. The Modbus TCP Client (this {{{name}}} device) perform this request as often as specified in the 'Period' field in [[#Slave_Device_Configuration|Server Device Configuration]].</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 1,154: Line 1,154:
             <ul>{{#ifeq: {{{mobile}}} | 1 |
             <ul>{{#ifeq: {{{mobile}}} | 1 |
                 <li><b>SMS</b> - sends and SMS message to a specified recipient(s).</li>|}}
                 <li><b>SMS</b> - sends and SMS message to a specified recipient(s).</li>|}}
                 <li><b>Modbus Request</b> - sends a Modbus Write request to a specified slave.</li>
                 <li><b>Modbus Request</b> - sends a Modbus Write request to a specified server.</li>
             </ul>
             </ul>
         </td>
         </td>
Line 1,176: Line 1,176:
         <td><span style="color: purple;">MODBUS Write Request: ID</span></td>
         <td><span style="color: purple;">MODBUS Write Request: ID</span></td>
         <td>integer [1..255]; default: <b>none</b></td>
         <td>integer [1..255]; default: <b>none</b></td>
         <td>Modbus slave ID.</td>
         <td>Modbus server ID.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 1,203: Line 1,203:
==MQTT Gateway==
==MQTT Gateway==


The <b>MQTT Gateway</b> function is used to transfer Modbus data (send requests, receive responses) over MQTT. When it is enabled, the device (this {{{name}}}) subscribes to a REQUEST topic and publishes on a RESPONSE topic on a specified MQTT broker. It translates received MQTT message payload to a Modbus request and relays it to the specified Modbus TCP slave.
The <b>MQTT Gateway</b> function is used to transfer Modbus data (send requests, receive responses) over MQTT. When it is enabled, the device (this {{{name}}}) subscribes to a REQUEST topic and publishes on a RESPONSE topic on a specified MQTT broker. It translates received MQTT message payload to a Modbus request and relays it to the specified Modbus TCP server.


When the MQTT Gateway receives a response from the slave, it translates it to an MQTT message and publishes it on the RESPONSE topic.
When the MQTT Gateway receives a response from the server, it translates it to an MQTT message and publishes it on the RESPONSE topic.


[[File:Networking_rutos_manual_modbus_mqtt_gateway_scheme.png]]
[[File:Networking_rutos_manual_modbus_mqtt_gateway_scheme.png]]
Line 1,400: Line 1,400:


* TCP:
* TCP:
   <b>0 <COOKIE> <IP_TYPE> <IP> <PORT> <TIMEOUT> <SLAVE_ID> <MODBUS_FUNCTION> <FIRST_REGISTER> <REGISTER_COUNT/VALUES></b>
   <b>0 <COOKIE> <IP_TYPE> <IP> <PORT> <TIMEOUT> <SERVER_ID> <MODBUS_FUNCTION> <FIRST_REGISTER> <REGISTER_COUNT/VALUES></b>
* Serial:
* Serial:
   <b>1 <COOKIE> <SERIAL_DEVICE_ID> <TIMEOUT> <SLAVE_ID> <MODBUS_FUNCTION> <FIRST_REGISTER> <REGISTER_COUNT/VALUES></b>
   <b>1 <COOKIE> <SERIAL_DEVICE_ID> <TIMEOUT> <SERVER_ID> <MODBUS_FUNCTION> <FIRST_REGISTER> <REGISTER_COUNT/VALUES></b>
* MODBUS TCP connection management messages:
* MODBUS TCP connection management messages:
   <b>2 <COOKIE> <CONNECTION_INDEX> <ACTION></b><br>
   <b>2 <COOKIE> <CONNECTION_INDEX> <ACTION></b><br>
Line 1,418: Line 1,418:
         </ul>
         </ul>
     </li>
     </li>
     <li><b>IP</b> - IP address of a Modbus TCP slave. IPv6 must be presented in full form (e.g., <i>2001:0db8:0000:0000:0000:8a2e:0370:7334</i>).</li>
     <li><b>IP</b> - IP address of a Modbus TCP server. IPv6 must be presented in full form (e.g., <i>2001:0db8:0000:0000:0000:8a2e:0370:7334</i>).</li>
     <li><b>Port</b> - port number of the Modbus TCP slave.</li>
     <li><b>Port</b> - port number of the Modbus TCP server.</li>
     <li><b>Timeout</b> - timeout for Modbus connection, in seconds. Range [1..999].</li>
     <li><b>Timeout</b> - timeout for Modbus connection, in seconds. Range [1..999].</li>
     <li><b>Slave ID</b> - Modbus TCP slave ID. Range [1..255].</li>
     <li><b>Server ID</b> - Modbus TCP server ID. Range [1..255].</li>
     <li><b>Modbus function</b> - Modbus task type that will be executed. Possible values are:
     <li><b>Modbus function</b> - Modbus task type that will be executed. Possible values are:
         <ul>
         <ul>
Line 1,469: Line 1,469:
===Examples===
===Examples===
----
----
Below are a few <b>examples</b> of controlling/monitoring the internal Modbus TCP Slave on {{{name}}}.
Below are a few <b>examples</b> of controlling/monitoring the internal Modbus TCP Server on {{{name}}}.
----
----
<b>Reboot the device</b>
<b>Reboot the device</b>
Line 1,496: Line 1,496:
{{#ifeq: {{{serial}}} | 1 |
{{#ifeq: {{{serial}}} | 1 |
==Modbus TCP over Serial Gateway==
==Modbus TCP over Serial Gateway==
The <b>Modbus TCP over Serial gateway</b> serial type allows redirecting TCP data coming to a specified port to an RTU specified by the Slave ID. The Slave ID can be specified by the user or be obtained directly from the Modbus header.
The <b>Modbus TCP over Serial gateway</b> serial type allows redirecting TCP data coming to a specified port to an RTU specified by the Server ID. The Server ID can be specified by the user or be obtained directly from the Modbus header.


===Modbus TCP over Serial Gateway Configuration===
===Modbus TCP over Serial Gateway Configuration===
Line 1,579: Line 1,579:
     </tr>
     </tr>
     <tr>
     <tr>
     <td>Slave ID configuration type</td>
     <td>Server ID configuration type</td>
         <td><span style="color: green;">User defined</span> {{!}} <span style="color: purple;">Obtained from TCP</span>; default: <b>User defined</b></td>
         <td><span style="color: green;">User defined</span> {{!}} <span style="color: purple;">Obtained from TCP</span>; default: <b>User defined</b></td>
         <td>Specifies whether slave IDs are user defined or automatically obtained from TCP.</td>
         <td>Specifies whether server IDs are user defined or automatically obtained from TCP.</td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td><span style="color: green;">Slave ID</span></td>
     <td><span style="color: green;">Server ID</span></td>
         <td><span style="color: green;">integer</span>; default: <b>none</span></td>
         <td><span style="color: green;">integer</span>; default: <b>none</span></td>
         <td>Specifies the slave ID of range of permitted slave IDs. The way this field is named and its function depends on the value of the ''Slave ID configuration'' field. <br> A range of IDs can be specified by placing a hyphen (<i>-</i>) between two integer numbers. For example, if you permit slave IDs in the range of 10 to 20, you would specify it as: <i>10-20</i><br>You can also specify multiple values that are not connected in a range using commas (<i>,</i>). For example, to specify 6, 50 and 100 as permitted slave IDs, you would have to use: <i>6,50,100</i></td>
         <td>Specifies the server ID of range of permitted server IDs. The way this field is named and its function depends on the value of the ''Server ID configuration'' field. <br> A range of IDs can be specified by placing a hyphen (<i>-</i>) between two integer numbers. For example, if you permit server IDs in the range of 10 to 20, you would specify it as: <i>10-20</i><br>You can also specify multiple values that are not connected in a range using commas (<i>,</i>). For example, to specify 6, 50 and 100 as permitted server IDs, you would have to use: <i>6,50,100</i></td>
     </tr>
     </tr>
     <tr>
     <tr>
     <td><span style="color: purple;">Permitted slave IDs</span></td>
     <td><span style="color: purple;">Permitted server IDs</span></td>
         <td><span style="color: purple;">range of integers</span>; default: <b>1-247</b></td>
         <td><span style="color: purple;">range of integers</span>; default: <b>1-247</b></td>
         <td>Read <i>Slave ID</i> field description.</td>
         <td>Read <i>Server ID</i> field description.</td>
     </tr>
     </tr>
     <tr>
     <tr>