Template:Networking rutos manual modbus: Difference between revisions
no edit summary
Gytispieze (talk | contribs) No edit summary |
No edit summary |
||
(38 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Template: | {{Template: Networking_device_manual_fw_disclosure | ||
| | | series = {{{series}}} | ||
| | | name = {{{name}}} | ||
| fw_version ={{Template: Networking_device_manual_latest_fw | |||
| series = {{{series}}} | |||
| name = {{{name}}} | |||
}} | |||
}} | }} | ||
{{#ifeq: {{{series}}} | RUT9 |<br><i><b>Note</b>: <b>[[{{{name}}} Modbus (legacy WebUI)|click here]]</b> for the old style WebUI (FW version | {{#ifeq: {{{series}}} | RUT9 |<br><i><b>Note</b>: <b>[[{{{name}}} Modbus (legacy WebUI)|click here]]</b> for the old style WebUI (FW version {{Template: Networking_device_manual_latest_fw | series = RUT9XX}} and earlier) user manual page.</i>|}} | ||
{{#ifeq: {{{series}}} | RUT2 | | {{#ifeq: {{{series}}} | RUT2 |<br><i><b>Note</b>: <b>[[{{{name}}} Modbus (legacy WebUI)|click here]]</b> for the old style WebUI (FW version {{Template: Networking_device_manual_latest_fw | series = RUT2XX}} and earlier) user manual page.</i>|}} | ||
<br><i><b>Note</b>: <b>[[{{{name}}} Modbus (legacy WebUI)|click here]]</b> for the old style WebUI (FW version | |||
|}} | |||
==Summary== | ==Summary== | ||
Line 17: | Line 16: | ||
{{#switch: {{{series}}} | {{#switch: {{{series}}} | ||
| RUTX = | | RUTX = | ||
| RUTM = | |||
| TRB1 = | | TRB1 = | ||
| TRB2 = | | TRB2 = | ||
| RUT9 = | | TRB2M = | ||
| RUT9|RUT9M = | |||
| RUT14X = | |||
| #default = | | #default = | ||
<u><b> | <u><b> | ||
Note:</b> On {{{name}}}, Modbus TCP | Note:</b> On {{{name}}}, Modbus TCP Server/Client and MQTT Gateway is additional software that can be installed from the <b>System → [[{{{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 | ==Modbus TCP Server== | ||
A <b>Modbus TCP | 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: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_server.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 55: | Line 57: | ||
<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 | <td>The device's Modbus server ID. When set to 0, it will respond to requests addressed to any ID.</td> | ||
</tr> | |||
<tr> | |||
<td>Mobile Data type</td> | |||
<td>Bytes | Kilobytes | Megabytes; default: <b>Bytes</b></td> | |||
<td>Selects mobile data unit representation type.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Allow | <td>Allow remote access</td> | ||
<td>off | on; default: <b>off</b></td> | <td>off | on; default: <b>off</b></td> | ||
<td>Allows remote Modbus connections by adding an exception to the device's firewall on the port specified in the field above.</td> | <td>Allows remote Modbus connections by adding an exception to the device's firewall on the port specified in the field above.</td> | ||
Line 64: | Line 71: | ||
<tr> | <tr> | ||
<td>Keep persistent connection</td> | <td>Keep persistent connection</td> | ||
<td>off | on; default: <b> | <td>off | on; default: <b>onn</b></td> | ||
<td>Allows keep the connection open after responding a Modbus TCP | <td>Allows keep the connection open after responding a Modbus TCP client request.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Connection timeout</td> | <td>Connection timeout</td> | ||
<td> integer; default: <b>0</b></td> | <td>integer [0..60]; default: <b>0</b></td> | ||
<td> Sets TCP timeout in seconds after which the connection is forcefully closed.</td> | <td>Sets TCP timeout in seconds after which the connection is forcefully closed.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Enable custom register block</td> | <td>Enable custom register block</td> | ||
<td>off | on; default: <b>off</b></td> | <td>off | <span style="color:blue">on</span>; default: <b>off</b></td> | ||
<td>Allows the usage of custom register block.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">Register file path</span></td> | |||
<td>path; default: <b>/tmp/regfile</b></td> | |||
<td>Path to file in which the custom register block will be stored. Files inside /tmp or /var are stored in RAM. They vanish after reboot, but do not degrade flash memory. Files elsewhere are stored in flash memory. They remain after reboot, but degrade flash memory (severely, if operations are frequent).</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">First register number</span></td> | |||
<td>integer [1025..65536]; default: <b>1025</b></td> | |||
<td>First register in custom register block</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">Register count</span></td> | |||
<td>integer [1..64512]; default: <b>128</b></td> | |||
<td>Register count in custom register block </td> | |||
</tr> | |||
</table> | |||
{{#ifeq: {{{serial}}} | 1 | | |||
==Modbus Serial Server== | |||
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 Server Configuration=== | |||
---- | |||
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_server_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 server instance configuration page. | |||
[[File:Networking_rutos_manual_modbus_modbus_serial_server_configuration_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}_v1.png|border|class=tlt-border]] | |||
<table class="nd-mantable"> | |||
<tr> | |||
<th>Field</th> | |||
<th>Value</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>Enable</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Enables this Modbus Serial Server instance configuration.</td> | |||
</tr> | |||
<tr> | |||
<td>Name</td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Name of the serial server instance. Used for management purposes only.</td> | |||
</tr> | |||
<tr> | |||
<td>Device</td> | |||
<td>{{Template: Networking rutos manual serial ports| rs232={{{rs232}}}| rs485={{{rs485}}}| usb = {{{usb}}}}}; default: <b>{{Template: Networking rutos manual default serial port| rs232={{{rs232}}}| rs485={{{rs485}}}| usb = {{{usb}}}}}</b></td> | |||
<td>Specifies which serial port will be used for serial communication.</td> | |||
</tr> | |||
<tr> | |||
<td>Device ID</td> | |||
<td>integer [0..255]; default: <b>1</b></td> | |||
<td>Specifies which serial port will be used for serial communication.</td> | |||
</tr> | |||
<tr> | |||
<td>Baud rate</td> | |||
<td>300 {{!}} 1200 {{!}} 2400 {{!}} 4800 {{!}} 9600 {{!}} 19200 {{!}} 38400 {{!}} 57600 {{!}} 115200{{#ifeq: {{{rs485}}} | 1 | {{!}} 230400 {{!}} 460800 {{!}} 921600 {{!}} 1000000 {{!}} 3000000|}}; default: <b>9600</b></td> | |||
<td>Serial data transmission rate (in bits per second).</td> | |||
</tr> | |||
<tr> | |||
<td>Data bits</td> | |||
<td>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|{{#switch:{{{series}}}|TRB2|TRB2M=|#default=5 {{!}} 6 {{!}}}} 7 {{!}} |}}8; default: <b>8</b></td> | |||
<td>Number of data bits for each character.</td> | |||
</tr> | |||
<tr> | |||
<td>Stop bits</td> | |||
<td>1{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} 2|}}; default: <b>1</b></td> | |||
<td>Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. Two stop bits are required if slow electromechanical devices are used.</td> | |||
</tr> | |||
<tr> | |||
<td>Parity</td> | |||
<td>Even {{!}} Odd{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} Mark {{!}} Space|}} {{!}} None; default: <b>None</b></td> | |||
<td>In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check. | |||
<ul> | |||
<li><b>None</b> (<b>N</b>) - no parity method is used.</li> | |||
<li><b>Odd</b> (<b>O</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be odd.</li> | |||
<li><b>Even</b> (<b>E</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be even.</li>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|<li><b>Space</b> (<b>s</b>) - the parity bit will always be a binary 0.</li> | |||
<li><b>Mark</b> (<b>M</b>) - the parity bit will always be a binary 1.</li>|}} | |||
</ul> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Flow control</td> | |||
<td>None {{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} RTS/CTS {{!}} Xon/Xoff|}}; default: <b>None</b></td> | |||
<td>In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking. | |||
{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|<ul> | |||
<li><b>RTS/CTS</b> - hardware handshaking. RTS and CTS are turned OFF and ON from alternate ends to control data flow, for instance when a buffer is almost full.</li> | |||
<li><b>Xon/Xoff</b> - software handshaking. The Xon and Xoff characters are sent by the receiver to the sender to control when the sender will send data, i.e., these characters go in the opposite direction to the data being sent. The circuit starts in the "sending allowed" state. When the receiver's buffers approach capacity, the receiver sends the Xoff character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an Xon character to tell the sender to resume transmission.</li> | |||
</ul>|}} | |||
</td> | |||
</tr>{{#ifeq: {{{rs485}}} | 1 | | |||
<tr> | |||
<td><span style="color:blue">RS485:</span> Full Duplex</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Enables RS485 full duplex.</td> | |||
</tr>|}} | |||
<tr> | |||
<td>Enable custom register block</td> | |||
<td>off {{!}} <span style="color:blue">on</span>; default: <b>off</b></td> | |||
<td>Allows the usage of custom register block.</td> | <td>Allows the usage of custom register block.</td> | ||
</tr> | |||
<tr> | |||
<td><span style="color:blue">Register file path</span></td> | |||
<td>path; default: <b>/tmp/regfile</b></td> | |||
<td>Path to file in which the custom register block will be stored. Files inside /tmp or /var are stored in RAM. They vanish after reboot, but do not degrade flash memory. Files elsewhere are stored in flash memory. They remain after reboot, but degrade flash memory (severely, if operations are frequent).</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">First register number</span></td> | |||
<td>integer [1025..65536]; default: <b>1025</b></td> | |||
<td>First register in custom register block</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">Register count</span></td> | |||
<td>integer [1..64512]; default: <b>128</b></td> | |||
<td>Path to file in which the custom register block will be stored. Files inside /tmp or /var are stored in RAM. They vanish after reboot, but do not degrade flash memory. Files elsewhere are stored in flash memory. They remain after reboot, but degrade flash memory (severely, if operations are frequent).</td> | |||
</tr> | </tr> | ||
</table> | </table> | ||
|}} | |||
==Modbus Registers== | |||
{{Template:Networking_rutos_manual_modbus_modbus_tcp_get_parameters_table | {{Template:Networking_rutos_manual_modbus_modbus_tcp_get_parameters_table | ||
Line 95: | Line 225: | ||
|dualsim = {{{dualsim}}} | |dualsim = {{{dualsim}}} | ||
}} | }} | ||
==Modbus TCP | ==Modbus TCP Client== | ||
A <b>Modbus Client</b> device can request data from Modbus servers. The Modbus TCP Client section is used to configure Modbus TCP servers and enable Client. By default, the server list is empty and client is disabled. To add a new server, click the 'Add' button | |||
[[File:Networking_rutos_manual_modbus_modbus_tcp_client_modbus_tcp_server_devices_add_button_v2.png|border|class=tlt-border]] | |||
After clicking 'Add' you will be redirected to the newly added server's configuration page. | |||
=== | ===Server Device Configuration=== | ||
---- | ---- | ||
The <b> | 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: | [[File:Networking_rutos_manual_modbus_modbus_tcp_client_server_device_configuration.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 120: | Line 248: | ||
<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 | <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> | <td>Server device's name, used for easier management purposes.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Server ID</td> | ||
<td>integer [0..255]; default: <b>none</b></td> | <td>integer [0..255]; default: <b>none</b></td> | ||
<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> | <td>ip4; default: <b>none</b></td> | ||
<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> | <td>Server device's Modbus TCP port.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 151: | Line 274: | ||
<td>integer [1..30]; default: '''5'''</td> | <td>integer [1..30]; default: '''5'''</td> | ||
<td>Maximum response wait time.</td> | <td>Maximum response wait time.</td> | ||
</tr> | |||
<tr> | |||
<td>Always reconnect</td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Create new connection after every Modbus request.</td> | |||
</tr> | |||
<tr> | |||
<td>Number of timeouts</td> | |||
<td>integer [0..10]; default: <b>1</b></td> | |||
<td>Skip pending request and reset connection after number of request failures.</td> | |||
</tr> | |||
<tr> | |||
<td>Frequency</td> | |||
<td>Period {{!}} Schedule; default: <b>Period</b></td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>Delay</td> | |||
<td>integer [0..999]; default: <b>0</b></td> | |||
<td>Wait in milliseconds after connection initialization.</td> | |||
</tr> | |||
<tr> | |||
<td>Period</td> | |||
<td>integer [1..99999]; default: <b>none</b></td> | |||
<td>Interval in seconds for sending requests to this device</td> | |||
</tr> | </tr> | ||
</table> | </table> | ||
Line 156: | Line 304: | ||
===Requests Configuration=== | ===Requests Configuration=== | ||
---- | ---- | ||
A Modbus <b>request</b> is a way of obtaining data from Modbus | 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 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: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_client_requests_configuration_add_new_instance.png|border|class=tlt-border]] | ||
The new Request Configuration should become visible in the list: | The new Request Configuration should become visible in the list: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_master_requests_configuration_v1.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 179: | Line 329: | ||
<tr> | <tr> | ||
<td>Data type</td> | <td>Data type</td> | ||
<td>8bit INT | <td>8bit INT {{!}} 8bit UINT {{!}} 16bit INT, high byte first {{!}} 16bit INT, low byte first {{!}} 16bit UINT, high byte first {{!}} 16bit UINT, low byte first {{!}} 32bit float (various Byte order) {{!}} 32bit INT (various Byte order) {{!}} 32bit UINT (various Byte order) {{!}} ASCII {{!}} Hex {{!}} Bool {{!}} PDU; default: <b>16bit INT, high byte first</b></td> | ||
<td>Defines how read data will be stored.</td> | <td>Defines how read data will be stored.</td> | ||
</tr> | </tr> | ||
Line 199: | Line 349: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Remove Brackets</td> | ||
<td>off | on; default: <b>off</b></td> | <td>off | on; default: <b>off</b></td> | ||
<td>Removes the starting and ending brackets from the request (only for read requests).</td> | <td>Removes the starting and ending brackets from the request (only for read requests).</td> | ||
</tr> | |||
<tr> | |||
<td>off/on slider</td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Turns the request on or off.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 207: | Line 362: | ||
<td>- (interactive button)</td> | <td>- (interactive button)</td> | ||
<td>Deletes the request.</td> | <td>Deletes the request.</td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
Line 217: | Line 367: | ||
<b>Additional note:</b> by default the newly added Request Configurations are turned off. You can use the on/off slider to the right of the Request Configuration to turn it on: | <b>Additional note:</b> by default the newly added Request Configurations are turned off. You can use the on/off slider to the right of the Request Configuration to turn it on: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_client_requests_configuration_on_off_slider.png|border|class=tlt-border]] | ||
---- | ---- | ||
After having configured a request, you should see a new 'Request Configuration Testing' section appear. It is used to check whether the configuration works correctly. Simply click the 'Test' button and a response should appear in the box below. A successful response to a test may look something like this: | After having configured a request, you should see a new 'Request Configuration Testing' section appear. It is used to check whether the configuration works correctly. Simply click the 'Test' button and a response should appear in the box below. <b>Note:</b> to use test buttons, you need to enable [[#Modbus_TCP_Client|Client section]]. A successful response to a test may look something like this: | ||
[[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]] | ||
Line 225: | Line 375: | ||
===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 | <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. | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_client_alarms_configuration_add_button_v2.png|border|class=tlt-border]] | ||
After adding the Alarm you should be redirected to its configuration page which should look similar to this: | After adding the Alarm you should be redirected to its configuration page which should look similar to this: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_master_alarms_configuration_v1.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 249: | Line 399: | ||
<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 | <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 [[#Server_Device_Configuration|Server Device Configuration]].</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Compared condition data type</td> | ||
<td>8bit INT {{!}} 8bit UINT {{!}} 16bit INT, high byte first {{!}} 16bit INT, low byte first {{!}} 16bit UINT, high byte first {{!}} 16bit UINT, low byte first {{!}} 32bit float (various Byte order) {{!}} 32bit INT (various Byte order) {{!}} 32bit UINT (various Byte order) {{!}} ASCII {{!}} Hex {{!}} Bool; default: <b>16bit INT, high byte first</b></td> | |||
<td>Select data type that will be used for checking conditions.</td> | |||
</tr> | |||
<tr> | |||
<td>First register number</td> | |||
<td>integer [1..65536]; default: <b>none</b></td> | <td>integer [1..65536]; default: <b>none</b></td> | ||
<td>Number of the Modbus coil/input/holding-register/input-register to read from.</td> | <td>Number of the Modbus coil/input/holding-register/input-register to read from.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Values</td> | ||
<td>various; default: <b>none</b></td> | <td>various; default: <b>none</b></td> | ||
<td>The value against which the read data will be compared.</td> | <td>The value against which the read data will be compared.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Condition</td> | ||
<td> | <td>More than | Less than | Equal to | Not Equal to | Less or equal | More or equal; default: <b>More than</b></td> | ||
<td> | <td>When a value is obtained it will be compared against the value specified in the following field. The comparison will be made in accordance with the condition specified in this field.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 278: | Line 428: | ||
<tr> | <tr> | ||
<td>Redundancy protection</td> | <td>Redundancy protection</td> | ||
<td>off | on; default: <b>off</b></td> | <td>off | <span style="color:blue">on</span>; default: <b>off</b></td> | ||
<td>Protection against executing a configured action too often.</td> | <td>Protection against executing a configured action too often.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Redundancy protection period</td> | <td><span style="color:blue">Redundancy protection period</span></td> | ||
<td>integer [1..86400]; default: <b>none</b></td> | <td>integer [1..86400]; default: <b>none</b></td> | ||
<td>Duration to activate redundancy protection for, measured in seconds. This field becomes visible only when 'Redundancy protection' is turned on.</td> | <td>Duration to activate redundancy protection for, measured in seconds. This field becomes visible only when 'Redundancy protection' is turned on.</td> | ||
Line 288: | Line 438: | ||
<tr> | <tr> | ||
<td>Action</td> | <td>Action</td> | ||
<td>{{#ifeq:{{{mobile}}}|1|SMS {{!}}|}} MODBUS Write Request{{#switch:{{{series}}}|TCR1 | <td>Ubus event {{!}} {{#ifeq:{{{mobile}}}|1|<span style="color: #0054a6;">SMS</span> {{!}}|}} <span style="color: purple;">MODBUS Write Request</span>{{#switch:{{{series}}}|TCR1|TRB2|TRB2M=|#default= {{!}} Trigger output}} | <span style="color: red;">MQTT message</span>; default: <b>MODBUS Write Request</b></td> | ||
<td>Action that will be taken if the condition is met. Possible actions: | <td>Action that will be taken if the condition is met. Possible actions: | ||
<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 | <li><b>Modbus Request</b> - sends a Modbus Write request to a specified server.</li> | ||
{{#switch:{{{series}}}|TCR1|TRB2|TRB2M=|#default=<li><b>Trigger output</b> - changes state of selected I/O output pin.</li>}} | |||
</ul> | </ul> | ||
</td> | </td> | ||
Line 309: | Line 460: | ||
<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 | <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 | <td>Modbus server's port.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 324: | Line 475: | ||
<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 | <td>Modbus server ID.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><span style="color: purple;">MODBUS Write Request: Modbus function</span></td> | <td><span style="color: purple;">MODBUS Write Request: Modbus function</span></td> | ||
<td> | <td>Set Single Coil (5) | Set Single Register (6) | Set Multiple Coils (15) | Set Multiple Registers (16); default: <b>Set Single Coil (5)</b></td> | ||
<td>A function code specifies the type of register being addressed by a Modbus request.</td> | <td>A function code specifies the type of register being addressed by a Modbus request.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><span style="color: purple;">MODBUS Write Request: First register</span></td> | <td><span style="color: purple;">MODBUS Write Request: Executed action data type</span></td> | ||
<td>8bit INT | 8bit UINT | 16bit INT, high byte first | 16bit INT, low byte first | 16bit UINT, high byte first | 16bit UINT, low byte first | 32bit float (various Byte order) | 32bit INT (various Byte order) | 32bit UNIT (various Byte order) | ASCII | Hex | Bool; default: <b>Bool</b></td> | |||
<td>Select data type that will be used for executing action.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">MODBUS Write Request: First register number</span></td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | <td>integer [0..65535]; default: <b>none</b></td> | ||
<td>Begins reading from the register specified in this field.</td> | <td>Begins reading from the register specified in this field.</td> | ||
Line 340: | Line 496: | ||
<td>integer [0..65535]; default: <b>none</b></td> | <td>integer [0..65535]; default: <b>none</b></td> | ||
<td>Register/Coil values to be written (multiple values must be separated by space character).</td> | <td>Register/Coil values to be written (multiple values must be separated by space character).</td> | ||
</tr>{{#switch:{{{series}}}|TCR1 | </tr>{{#switch:{{{series}}}|TCR1|TRB2|TRB2M=|#default= | ||
<tr> | <tr> | ||
<td><span style="color: green;">Trigger output: Output</span></td>{{#switch:{{{series}}} | <td><span style="color: green;">Trigger output: Output</span></td>{{#switch:{{{series}}} | ||
Line 353: | Line 509: | ||
<td>Selects the action performed on the output.</td> | <td>Selects the action performed on the output.</td> | ||
</tr>}} | </tr>}} | ||
<tr> | |||
<td><span style="color: red;">MQTT message: JSON format</span></td> | |||
<td>string; default: <b>none</b> </td> | |||
<td>Below this field you can find special codes that begin with the '%' sign. Each code represents a piece information related to the status of the device. Include these codes in the field for dynamic information reports. Possible values: Local time, Unix time, Router name, Device name, Serial number, Current FW version, LAN IP address, Monitoring status, UTC time in ISO, WAN IP address, New line, Modbus server ID, Modbus server IP, First register number, Register value, Mobile IP addresses, Signal strength, Operator name, Network type, Data connection state, Network state, IMSI, IMEI, Modem model, Modem serial number, SIM pin state, SIM state, RSCP, ECIO, RSRP, SINR, RSRQ, ICCID, CELLID, Neighbour cells, Network info, Network serving, WAN MAC address, Analog Current Loop (6,9), Analog Input (6,9), Input (3), Digital Input (1), Output (4), Isolated Output (3,4,8), Isolated Input (2,7), Relay (5,10) | |||
</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">MQTT message: Hostname</span></td> | |||
<td>host | ip; default: <b>none</b> </td> | |||
<td>Broker’s IP address or hostname.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">MQTT message: Port</span></td> | |||
<td>integer [0..65535]; default: <b>1883</b></td> | |||
<td>Broker's port number.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">MQTT message: Keepalive</span></td> | |||
<td>positive integer; default: <b>none</b></td> | |||
<td>The number of seconds after which the broker should send a PING message to the client if no other messages have been exchanged in that time</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">MQTT message: Topic</span></td> | |||
<td>string; default: <b>none</b></td> | |||
<td>The name of the topic that the broker will subscribe to.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">MQTT message: Client ID</span></td> | |||
<td>positive integer; default: <b>none</b></td> | |||
<td>Client ID to send with the data. If empty, a random client ID will be generated </td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">MQTT message: QoS</span></td> | |||
<td>At most once (0) | At least once (1) | Exactly once (2); default: <b>At most once (0)</b></td> | |||
<td>A period of time (in seconds) which has to pass after a trigger event before this Action is executed.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">MQTT message: Use root CA</span></td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Use root CA for verifying the servers certificates </td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: red;">MQTT message: Use TLS</span></td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Turns the use of TLS/SSL for this MQTT connection on or off.</td> | |||
</tr><tr> | |||
<td><span style="color: red;">MQTT message: Use credentials</span></td> | |||
<td>off | on; default: <b>off</b></td> | |||
<td>Turns the use of username and password for this MQTT connection on or off.</td> | |||
</tr> | |||
</table> | </table> | ||
{{#ifeq: {{{serial}}} | 1 | | {{#ifeq: {{{serial}}} | 1 | | ||
==Modbus Serial | ==Modbus Serial Client== | ||
The <b>Modbus Serial | 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 | [[File:Networking_rutos_manual_modbus_modbus_serial_client_v2.png|border|class=tlt-border]] | ||
<!--<u><b>Note:</b> Modbus Serial Client is additional software that can be installed from the <b>System → [[{{{name}}} Package Manager|Package Manager]]</b> page.</u>--> | |||
=== | |||
===Modbus Serial Device Configuration=== | |||
---- | ---- | ||
This section is used to | 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: | [[File:Networking_rutos_manual_modbus_modbus_serial_master_device_configuration.png|border|class=tlt-border]] | ||
By default there are no instances created. To add a new serial device configuration, enter an instance name and click the 'Add' button. | |||
[[File:Networking_rutos_manual_modbus_modbus_serial_master_device_configuration_add_button_{{#ifexpr:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|0}}.png|border|class=tlt-border]] | |||
After clicking 'Add' you will be redirected to the newly added device's configuration page. | |||
====RS Device Modbus Client Configuration==== | |||
---- | |||
This section is used to configure the Modbus Serial Client's server device interface settings. | |||
[[File:Networking_rutos_manual_modbus_modbus_serial_client_device_configuration_rs_device_modbus_client_configuration_v1_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}.png|border|class=tlt-border]] | |||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 374: | Line 593: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Enable</td> | ||
<td>off < | <td>off {{!}} on; default: <b>off</b></td> | ||
<td> | <td>Enables this Modbus Serial Device instance configuration.</td> | ||
</tr> | |||
<tr> | |||
<td>Name</td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Name of the serial device instance. Used for management purposes only.</td> | |||
</tr> | |||
<tr> | |||
<td>Device</td> | |||
<td>{{Template: Networking rutos manual serial ports| rs232={{{rs232}}}| rs485={{{rs485}}}| usb = {{{usb}}}}}; default: <b>{{Template: Networking rutos manual default serial port| rs232={{{rs232}}}| rs485={{{rs485}}}| usb = {{{usb}}}}}</b></td> | |||
<td>Specifies which serial port will be used for serial communication.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Baud rate</td> | <td>Baud rate</td> | ||
<td>300 | <td>300 {{!}} 1200 {{!}} 2400 {{!}} 4800 {{!}} 9600 {{!}} 19200 {{!}} 38400 {{!}} 57600 {{!}} 115200{{#ifeq: {{{rs485}}} | 1 | {{!}} 230400 {{!}} 460800 {{!}} 921600 {{!}} 1000000 {{!}} 3000000|}}; default: <b>9600</b></td> | ||
<td>Serial data transmission rate (in bits per second).</td> | <td>Serial data transmission rate (in bits per second).</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Data bits</td> | <td>Data bits</td> | ||
<td>5 | <td>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|{{#switch:{{{series}}}|TRB2|TRB2M=|#default=5 {{!}} 6 {{!}}}} 7 {{!}} |}}8; default: <b>8</b></td> | ||
<td>Number of data bits for each character.</td> | <td>Number of data bits for each character.</td> | ||
</tr> | |||
<tr> | |||
<td>Stop bits</td> | |||
<td>1{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} 2|}}; default: <b>1</b></td> | |||
<td>Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. Two stop bits are required if slow electromechanical devices are used.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Parity</td> | <td>Parity</td> | ||
<td> | <td>Even {{!}} Odd{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} Mark {{!}} Space|}} {{!}} None; default: <b>None</b></td> | ||
<td>In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check. | <td>In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check. | ||
<ul> | <ul> | ||
<li><b>None</b> (<b>N</b>) - no parity method is used.</li> | <li><b>None</b> (<b>N</b>) - no parity method is used.</li> | ||
<li><b>Odd</b> (<b>O</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be odd.</li> | <li><b>Odd</b> (<b>O</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be odd.</li> | ||
<li><b>Even</b> (<b>E</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be even.</li> | <li><b>Even</b> (<b>E</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be even.</li>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|<li><b>Space</b> (<b>s</b>) - the parity bit will always be a binary 0.</li> | ||
<li><b>Mark</b> (<b>M</b>) - the parity bit will always be a binary 1.</li>|}} | |||
</ul> | </ul> | ||
</td> | </td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Flow control</td> | <td>Flow control</td> | ||
<td>None | <td>None {{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} RTS/CTS {{!}} Xon/Xoff|}}; default: <b>None</b></td> | ||
<td>In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking. | <td>In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking. | ||
{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|<ul> | |||
<li><b>RTS/CTS</b> - hardware handshaking. RTS and CTS are turned OFF and ON from alternate ends to control data flow, for instance when a buffer is almost full.</li> | <li><b>RTS/CTS</b> - hardware handshaking. RTS and CTS are turned OFF and ON from alternate ends to control data flow, for instance when a buffer is almost full.</li> | ||
<li><b>Xon/Xoff</b> - software handshaking. The Xon and Xoff characters are sent by the receiver to the sender to control when the sender will send data, i.e., these characters go in the opposite direction to the data being sent. The circuit starts in the "sending allowed" state. When the receiver's buffers approach capacity, the receiver sends the Xoff character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an Xon character to tell the sender to resume transmission.</li> | <li><b>Xon/Xoff</b> - software handshaking. The Xon and Xoff characters are sent by the receiver to the sender to control when the sender will send data, i.e., these characters go in the opposite direction to the data being sent. The circuit starts in the "sending allowed" state. When the receiver's buffers approach capacity, the receiver sends the Xoff character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an Xon character to tell the sender to resume transmission.</li> | ||
</ul> | </ul>|}} | ||
</td> | </td> | ||
</tr> | </tr>{{#ifeq: {{{rs485}}} | 1 | | ||
<tr> | |||
<td><span style="color:blue">RS485:</span> Full Duplex</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Enables RS485 full duplex.</td> | |||
</tr>|}} | |||
</table> | </table> | ||
=== | ===Modbus Server Device Configuration=== | ||
---- | ---- | ||
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_client_modbus_server_device_configuration.png|border|class=tlt-border]] | |||
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_client_modbus_server_device_configuration_add_button.png|border|class=tlt-border]] | |||
After clicking 'Add' you will be redirected to the newly added server's configuration page. | |||
==== | ====Server Device Configuration==== | ||
---- | ---- | ||
The <b> | 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: | [[File:Networking_rutos_manual_modbus_modbus_serial_client_server_device_configuration.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 442: | Line 677: | ||
<tr> | <tr> | ||
<td>Enabled</td> | <td>Enabled</td> | ||
<td>off | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>Turns communication with the | <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> | <td>Server device's name, used for easier management purposes.</td> | ||
</tr> | |||
<tr> | |||
<td>Serial device</td> | |||
<td><i>serial device instance</i>; default: <b>none</b></td> | |||
<td>Specifies which serial device will be used on this server.</td> | |||
</tr> | |||
<tr> | |||
<td>Server ID</td> | |||
<td>integer [0..255]; default: <b>1</b></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> | |||
<td>Number of timeouts</td> | |||
<td>integer [0..10]; default: <b>0</b></td> | |||
<td>Skip pending request and reset connection after number of request failures.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Frequency</td> | ||
<td> | <td>Period {{!}} Schedule; default: <b>Period</b></td> | ||
<td> | <td></td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Period</td> | <td>Period</td> | ||
<td>integer [1.. | <td>integer [1..99999]; default: <b>none</b></td> | ||
<td>Interval at which requests are sent to the | <td>Interval at which requests are sent to the server device.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Timeout</td> | <td>Timeout</td> | ||
<td>integer [1.. | <td>integer [1..60]; default: <b>1</b></td> | ||
<td>Maximum response wait time.</td> | <td>Maximum response wait time.</td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
=====Requests Configuration===== | =====Requests Configuration===== | ||
---- | ---- | ||
A Modbus <b>request</b> is a way of obtaining data from Modbus | 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 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: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_client_requests_configuration_add_new_instance.png|border|class=tlt-border]] | ||
The new Request Configuration should become visible in the list: | The new Request Configuration should become visible in the list: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_master_requests_configuration_v1.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 491: | Line 744: | ||
<tr> | <tr> | ||
<td>Data type</td> | <td>Data type</td> | ||
<td>8bit INT | <td>8bit INT {{!}} 8bit UINT {{!}} 16bit INT, high byte first {{!}} 16bit INT, low byte first {{!}} 16bit UINT, high byte first {{!}} 16bit UINT, low byte first {{!}} 32bit float (various Byte order) {{!}} 32bit INT (various Byte order) {{!}} 32bit UINT (various Byte order) {{!}} ASCII {{!}} Hex {{!}} Bool {{!}} PDU; default: <b>16bit INT, high byte first</b></td> | ||
<td>Defines how read data will be stored.</td> | <td>Defines how read data will be stored.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Function</td> | <td>Function</td> | ||
<td>Read coils (1) | <td>Read coils (1) {{!}} Read input coils (2) {{!}} Read holding registers (3) {{!}} Read input registers (4) {{!}} Set single coil (5) {{!}} Set single coil register (6) {{!}} Set multiple coils (15) {{!}} Set multiple holding registers (16); default: <b>Read holding registers (3)</b></td> | ||
<td>Specifies the type of register being addressed by a Modbus request. | <td>Specifies the type of register being addressed by a Modbus request. | ||
</td> | </td> | ||
Line 511: | Line 764: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Remove Brackets</td> | ||
<td>off | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>Removes the starting and ending brackets from the request (only for read requests).</td> | <td>Removes the starting and ending brackets from the request (only for read requests).</td> | ||
</tr> | |||
<tr> | |||
<td>off/on slider</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Turns the request on or off.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 519: | Line 777: | ||
<td>- (interactive button)</td> | <td>- (interactive button)</td> | ||
<td>Deletes the request.</td> | <td>Deletes the request.</td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
Line 529: | Line 782: | ||
<b>Additional note:</b> by default the newly added Request Configurations are turned off. You can use the on/off slider to the right of the Request Configuration to turn it on: | <b>Additional note:</b> by default the newly added Request Configurations are turned off. You can use the on/off slider to the right of the Request Configuration to turn it on: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_client_requests_configuration_on_off_slider.png|border|class=tlt-border]] | ||
---- | ---- | ||
After having configured a request, you should see a new 'Request Configuration Testing' section appear. It is used to check whether the configuration works correctly. Simply click the 'Test' button and a response should appear in the box below. A successful response to a test may look something like this: | After having configured a request, you should see a new 'Request Configuration Testing' section appear. It is used to check whether the configuration works correctly. Simply click the 'Test' button and a response should appear in the box below. <b>Note:</b> to use test buttons, you need to enable [[#Modbus_Serial_Client|Client section]]. A successful response to a test may look something like this: | ||
[[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 | =====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 | <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 | The figure below is an example of the Modbus Client Alarms list. To create a new Alarm, click the 'Add' button. | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_client_alarms_configuration_add_button.png|border|class=tlt-border]] | ||
After this you should be redirected to that Alarm's configuration page which should look similar to this: | After this you should be redirected to that Alarm's configuration page which should look similar to this: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_master_alarms_configuration_v1.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 559: | Line 808: | ||
<tr> | <tr> | ||
<td>Enabled</td> | <td>Enabled</td> | ||
<td>off | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>Turns the alarm on or off.</td> | <td>Turns the alarm on or off.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Function code</td> | <td>Function code</td> | ||
<td>Read Coil Status (1) | <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 | <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 [[#Server_Device_Configuration|Server Device Configuration]].</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Compared condition data type</td> | ||
<td>8bit INT {{!}} 8bit UINT {{!}} 16bit INT, high byte first {{!}} 16bit INT, low byte first {{!}} 16bit UINT, high byte first {{!}} 16bit UINT, low byte first {{!}} 32bit float (various Byte order) {{!}} 32bit INT (various Byte order) {{!}} 32bit UINT (various Byte order) {{!}} ASCII {{!}} Hex {{!}} Bool; default: <b>16bit INT, high byte first</b></td> | |||
<td>Select data type that will be used for checking conditions.</td> | |||
</tr> | |||
<tr> | |||
<td>First register number</td> | |||
<td>integer [1..65536]; default: <b>none</b></td> | <td>integer [1..65536]; default: <b>none</b></td> | ||
<td>Number of the Modbus coil/input/holding-register/input-register to read from.</td> | <td>Number of the Modbus coil/input/holding-register/input-register to read from.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Values</td> | ||
<td>various; default: <b>none</b></td> | <td>various; default: <b>none</b></td> | ||
<td>The value against which the read data will be compared.</td> | <td>The value against which the read data will be compared.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Condition</td> | ||
<td> | <td>More than {{!}} Less than {{!}} Equal to {{!}} Not Equal to {{!}} Less or equal {{!}} More or equal; default: <b>More than</b></td> | ||
<td> | <td>When a value is obtained it will be compared against the value specified in the following field. The comparison will be made in accordance with the condition specified in this field.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Action frequency</td> | <td>Action frequency</td> | ||
<td>Every trigger | <td>Every trigger {{!}} First trigger; default: <b>Every trigger</b></td> | ||
<td>Describes how frequently the specified action will be taken.</td> | <td>Describes how frequently the specified action will be taken.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Redundancy protection</td> | <td>Redundancy protection</td> | ||
<td>off < | <td>off {{!}} <span style="color:blue">on</span>; default: <b>off</b></td> | ||
<td>Protection against executing a configured action too often.</td> | <td>Protection against executing a configured action too often.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Redundancy protection period</td> | <td><span style="color:blue">Redundancy protection period</span></td> | ||
<td>integer [1..86400]; default: <b>none</b></td> | <td>integer [1..86400]; default: <b>none</b></td> | ||
<td>Duration to activate redundancy protection for, measured in seconds. This field becomes visible only when 'Redundancy protection' is turned on.</td> | <td>Duration to activate redundancy protection for, measured in seconds. This field becomes visible only when 'Redundancy protection' is turned on.</td> | ||
Line 604: | Line 853: | ||
<tr> | <tr> | ||
<td>Action</td> | <td>Action</td> | ||
<td>{{#ifeq:{{{mobile}}}|1|SMS {{!}}|}} MODBUS Write Request; default: <b>MODBUS Write Request</b></td> | <td>{{#ifeq:{{{mobile}}}|1|SMS {{!}}|}} MODBUS Write Request{{#switch:{{{series}}}|TCR1|TRB2|TRB2M=|#default= {{!}} Trigger output}}; default: <b>MODBUS Write Request</b></td> | ||
<td>Action that will be taken if the condition is met. Possible actions: | <td>Action that will be taken if the condition is met. Possible actions: | ||
<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 | <li><b>Modbus Request</b> - sends a Modbus Write request to a specified server.</li> | ||
{{#switch:{{{series}}}|TCR1|TRB2|TRB2M|#default=<li><b>Trigger output</b> - changes state of selected I/O output pin.</li>}} | |||
</ul> | </ul> | ||
</td> | </td> | ||
Line 630: | Line 880: | ||
<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 | <td>Modbus server ID.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><span style="color: purple;">MODBUS Write Request: Modbus function</span></td> | <td><span style="color: purple;">MODBUS Write Request: Modbus function</span></td> | ||
<td>Read | <td>Read Single Coil (5) {{!}} Set Single Register (6) {{!}} Set Multiple Coils (15) {{!}} Set Multiple Registers (16); default: <b>Set Single Coil (5)</b></td> | ||
<td>A function code specifies the type of register being addressed by a Modbus request.</td> | <td>A function code specifies the type of register being addressed by a Modbus request.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><span style="color: purple;">MODBUS Write Request: First register</span></td> | <td><span style="color: purple;">MODBUS Write Request: Executed action data type</span></td> | ||
<td>8bit INT {{!}} 8bit UINT {{!}} 16bit INT, high byte first {{!}} 16bit INT, low byte first {{!}} 16bit UINT, high byte first {{!}} 16bit UINT, low byte first {{!}} 32bit float (various Byte order) {{!}} 32bit INT (various Byte order) {{!}} 32bit UNIT (various Byte order) {{!}} ASCII {{!}} Hex {{!}} Bool; default: <b>Bool</b></td> | |||
<td>Select data type that will be used for executing action.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">MODBUS Write Request: First register number</span></td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | <td>integer [0..65535]; default: <b>none</b></td> | ||
<td>Begins reading from the register specified in this field.</td> | <td>Begins reading from the register specified in this field.</td> | ||
Line 646: | Line 901: | ||
<td>integer [0..65535]; default: <b>none</b></td> | <td>integer [0..65535]; default: <b>none</b></td> | ||
<td>Register/Coil values to be written (multiple values must be separated by space character).</td> | <td>Register/Coil values to be written (multiple values must be separated by space character).</td> | ||
</tr>{{#switch:{{{series}}}|TCR1|TRB2|TRB2M=|#default= | |||
<tr> | |||
<td><span style="color: green;">Trigger output: Output</span></td>{{#switch:{{{series}}} | |||
| RUTX|RUT2 =<td>4PIN output; default: <b>4PIN output</b></td> | |||
| TRB1|RUT3 =<td>Configurable Input/Output (3) {{!}} Configurable Input/Output (4); default: <b>Configurable Input/Output (3)</b></td> | |||
| RUT9 =<td>Open collector output {{!}} Relay output {{!}} 4PIN output; default: <b>Open collector output</b></td>}} | |||
<td>Selects which output will be triggered.</td> | |||
</tr> | </tr> | ||
<tr> | |||
<td><span style="color: green;">Trigger output: I/O Action</span></td> | |||
<td>Turn On {{!}} Turn Off {{!}} Invert; default: <b>Turn On</b></td> | |||
<td>Selects the action performed on the output.</td> | |||
</tr>}} | |||
</table> | </table> | ||
|}} | |}} | ||
{{#ifeq: {{{console}}} | 1 | | |||
===Console=== | |||
---- | ---- | ||
This section is used to configure the Modbus Serial | 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: | [[File:Networking_rutos_manual_modbus_modbus_serial_master_console_configuration.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 663: | Line 931: | ||
<tr> | <tr> | ||
<td>Enabled</td> | <td>Enabled</td> | ||
<td>off | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>Turns Modbus Serial | <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> | ||
<td>Baud rate</td> | <td>Baud rate</td> | ||
<td>300 | <td>300 {{!}} 1200 {{!}} 2400 {{!}} 4800 {{!}} 9600 {{!}} 19200 {{!}} 38400 {{!}} 57600 {{!}} 115200 {{!}} 1000000; default: <b>115200</b></td> | ||
<td>Serial data transmission rate (in bits per second).</td> | <td>Serial data transmission rate (in bits per second).</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Data bits</td> | <td>Data bits</td> | ||
<td>5 | <td>5 {{!}} 6 {{!}} 7 {{!}} 8; default: <b>8</b></td> | ||
<td>Number of data bits for each character.</td> | <td>Number of data bits for each character.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Parity</td> | <td>Parity</td> | ||
<td>None | <td>None {{!}} Even {{!}} Odd; default: <b>None</b></td> | ||
<td>In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check. | <td>In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check. | ||
<ul> | <ul> | ||
Line 689: | Line 957: | ||
<tr> | <tr> | ||
<td>Stop bits</td> | <td>Stop bits</td> | ||
<td>1 | <td>1 {{!}} 2; default: <b>1</b></td> | ||
<td>Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. Two stop bits are required if slow electromechanical devices are used.</td> | <td>Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. Two stop bits are required if slow electromechanical devices are used.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Flow control</td> | <td>Flow control</td> | ||
<td>None | <td>None {{!}} RTS/CTS {{!}} Xon/Xoff; default: <b>None</b></td> | ||
<td>In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking. | <td>In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking. | ||
<ul> | <ul> | ||
Line 704: | Line 972: | ||
</table> | </table> | ||
==== | ====Console Server Devices List==== | ||
---- | ---- | ||
The <b> | 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 | 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: | [[File:Networking_rutos_manual_modbus_modbus_serial_master_console_slave_devices_list_add_button.png|border|class=tlt-border]] | ||
=====Server Device Configuration===== | |||
==== | |||
---- | ---- | ||
The <b> | 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: | [[File:Networking_rutos_manual_modbus_modbus_serial_master_rs232_slave_device_configuration.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 730: | Line 994: | ||
<tr> | <tr> | ||
<td>Enabled</td> | <td>Enabled</td> | ||
<td>off | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>Turns communication with the | <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> | <td>Server device's name, used for easier management purposes.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Server ID</td> | ||
<td>integer [0..255]; default: <b>none</b></td> | <td>integer [0..255]; default: <b>none</b></td> | ||
<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 | <td>Interval at which requests are sent to the server device.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 756: | Line 1,020: | ||
=====Requests Configuration===== | =====Requests Configuration===== | ||
---- | ---- | ||
A Modbus <b>request</b> is a way of obtaining data from Modbus | 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 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 764: | Line 1,030: | ||
The new Request Configuration should become visible in the list: | The new Request Configuration should become visible in the list: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_master_requests_configuration_v1.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 779: | Line 1,045: | ||
<tr> | <tr> | ||
<td>Data type</td> | <td>Data type</td> | ||
<td>8bit INT | <td>8bit INT {{!}} 8bit UINT {{!}} 16bit INT, high byte first {{!}} 16bit INT, low byte first {{!}} 16bit UINT, high byte first {{!}} 16bit UINT, low byte first {{!}} 32bit float (various Byte order) {{!}} 32bit INT (various Byte order) {{!}} 32bit UINT (various Byte order) {{!}} ASCII {{!}} Hex {{!}} Bool; default: <b>16bit INT, high byte first</b></td> | ||
<td>Defines how read data will be stored.</td> | <td>Defines how read data will be stored.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Function</td> | <td>Function</td> | ||
<td>Read coils (1) | <td>Read coils (1) {{!}} Read input coils (2) {{!}} Read holding registers (3) {{!}} Read input registers (4) {{!}} Set single coil (5) {{!}} Set single coil register (6) {{!}} Set multiple coils (15) {{!}} Set multiple holding registers (16); default: <b>Read holding registers (3)</b></td> | ||
<td>Specifies the type of register being addressed by a Modbus request. | <td>Specifies the type of register being addressed by a Modbus request. | ||
</td> | </td> | ||
Line 799: | Line 1,065: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Remove Brackets</td> | ||
<td>off | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>Removes the starting and ending brackets from the request (only for read requests).</td> | <td>Removes the starting and ending brackets from the request (only for read requests).</td> | ||
</tr> | |||
<tr> | |||
<td>off/on slider</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Turns the request on or off.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 807: | Line 1,078: | ||
<td>- (interactive button)</td> | <td>- (interactive button)</td> | ||
<td>Deletes the request.</td> | <td>Deletes the request.</td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
Line 823: | Line 1,089: | ||
[[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 | =====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 | <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 | 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]] | ||
After this you should be redirected to that Alarm's configuration page which should look similar to this: | After this you should be redirected to that Alarm's configuration page which should look similar to this: | ||
[[File: | [[File:Networking_rutos_manual_modbus_modbus_tcp_master_alarms_configuration_v1.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 847: | Line 1,109: | ||
<tr> | <tr> | ||
<td>Enabled</td> | <td>Enabled</td> | ||
<td>off | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>Turns the alarm on or off.</td> | <td>Turns the alarm on or off.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Function code</td> | <td>Function code</td> | ||
<td>Read Coil Status (1) | <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 | <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 [[#Server_Device_Configuration|Server Device Configuration]].</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Compared condition data type</td> | ||
<td>8bit INT {{!}} 8bit UINT {{!}} 16bit INT, high byte first {{!}} 16bit INT, low byte first {{!}} 16bit UINT, high byte first {{!}} 16bit UINT, low byte first {{!}} 32bit float (various Byte order) {{!}} 32bit INT (various Byte order) {{!}} 32bit UINT (various Byte order) {{!}} ASCII {{!}} Hex {{!}} Bool; default: <b>16bit INT, high byte first</b></td> | |||
<td>Select data type that will be used for checking conditions.</td> | |||
</tr> | |||
<tr> | |||
<td>First register number</td> | |||
<td>integer [1..65536]; default: <b>none</b></td> | <td>integer [1..65536]; default: <b>none</b></td> | ||
<td>Number of the Modbus coil/input/holding-register/input-register to read from.</td> | <td>Number of the Modbus coil/input/holding-register/input-register to read from.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Values</td> | ||
<td>various; default: <b>none</b></td> | <td>various; default: <b>none</b></td> | ||
<td>The value against which the read data will be compared.</td> | <td>The value against which the read data will be compared.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>Condition</td> | ||
<td> | <td>More than {{!}} Less than {{!}} Equal to {{!}} Not Equal to {{!}} Less or equal {{!}} More or equal; default: <b>More than</b></td> | ||
<td> | <td>When a value is obtained it will be compared against the value specified in the following field. The comparison will be made in accordance with the condition specified in this field.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Action frequency</td> | <td>Action frequency</td> | ||
<td>Every trigger | <td>Every trigger {{!}} First trigger; default: <b>Every trigger</b></td> | ||
<td>Describes how frequently the specified action will be taken.</td> | <td>Describes how frequently the specified action will be taken.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Redundancy protection</td> | <td>Redundancy protection</td> | ||
<td>off < | <td>off {{!}} <span style="color:blue">on</span>; default: <b>off</b></td> | ||
<td>Protection against executing a configured action too often.</td> | <td>Protection against executing a configured action too often.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Redundancy protection period</td> | <td><span style="color:blue">Redundancy protection period</span></td> | ||
<td>integer [1..86400]; default: <b>none</b></td> | <td>integer [1..86400]; default: <b>none</b></td> | ||
<td>Duration to activate redundancy protection for, measured in seconds. This field becomes visible only when 'Redundancy protection' is turned on.</td> | <td>Duration to activate redundancy protection for, measured in seconds. This field becomes visible only when 'Redundancy protection' is turned on.</td> | ||
Line 892: | Line 1,154: | ||
<tr> | <tr> | ||
<td>Action</td> | <td>Action</td> | ||
<td>SMS | <td>{{#ifeq:{{{mobile}}}|1|SMS {{!}}|}} MODBUS Write Request; default: <b>MODBUS Write Request</b></td> | ||
<td>Action that will be taken if the condition is met. Possible actions: | <td>Action that will be taken if the condition is met. Possible actions: | ||
<ul> | <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 | <li><b>Modbus Request</b> - sends a Modbus Write request to a specified server.</li> | ||
</ul> | </ul> | ||
</td> | </td> | ||
</tr> | </tr>{{#ifeq: {{{mobile}}} | 1 | | ||
<tr> | <tr> | ||
<td><span style="color: #0054a6;">SMS: Message</span></td> | <td><span style="color: #0054a6;">SMS: Message</span></td> | ||
Line 909: | Line 1,171: | ||
<td>phone number; default: <b>none</b></td> | <td>phone number; default: <b>none</b></td> | ||
<td>Recipient's phone number.</td> | <td>Recipient's phone number.</td> | ||
</tr> | </tr>|}} | ||
<tr> | <tr> | ||
<td><span style="color: purple;">MODBUS Write Request: Timeout</span></td> | <td><span style="color: purple;">MODBUS Write Request: Timeout</span></td> | ||
Line 918: | Line 1,180: | ||
<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 | <td>Modbus server ID.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><span style="color: purple;">MODBUS Write Request: Modbus function</span></td> | <td><span style="color: purple;">MODBUS Write Request: Modbus function</span></td> | ||
<td>Read | <td>Read Single Coil (5) {{!}} Set Single Register (6) {{!}} Set Multiple Coils (15) {{!}} Set Multiple Registers (16); default: <b>Set Single Coil (5)</b></td> | ||
<td>A function code specifies the type of register being addressed by a Modbus request.</td> | <td>A function code specifies the type of register being addressed by a Modbus request.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><span style="color: purple;">MODBUS Write Request: First register</span></td> | <td><span style="color: purple;">MODBUS Write Request: Executed action data type</span></td> | ||
<td>8bit INT {{!}} 8bit UINT {{!}} 16bit INT, high byte first {{!}} 16bit INT, low byte first {{!}} 16bit UINT, high byte first {{!}} 16bit UINT, low byte first {{!}} 32bit float (various Byte order) {{!}} 32bit INT (various Byte order) {{!}} 32bit UNIT (various Byte order) {{!}} ASCII {{!}} Hex {{!}} Bool; default: <b>Bool</b></td> | |||
<td>Select data type that will be used for executing action.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: purple;">MODBUS Write Request: First register number</span></td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | <td>integer [0..65535]; default: <b>none</b></td> | ||
<td>Begins reading from the register specified in this field.</td> | <td>Begins reading from the register specified in this field.</td> | ||
Line 938: | Line 1,205: | ||
|}} | |}} | ||
==MQTT Gateway== | ==MQTT Modbus 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 | The <b>MQTT Modbus 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 | 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 948: | Line 1,215: | ||
Below is an example of the MQTT Gateway page. Refer to the table for information on MQTT Gateway configuration fields. | Below is an example of the MQTT Gateway page. Refer to the table for information on MQTT Gateway configuration fields. | ||
[[File: | [[File:Networking_rutos_manual_modbus_mqtt_gateway_v1.png|border|class=tlt-border]] | ||
<table class="nd-mantable"> | <table class="nd-mantable"> | ||
Line 958: | Line 1,225: | ||
<tr> | <tr> | ||
<td>Enable</td> | <td>Enable</td> | ||
<td>off | <td>off {{!}} on; default: <b>off</b></td> | ||
<td>Turns MQTT gateway on or off.</td> | <td>Turns MQTT gateway on or off.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Host</td> | <td>Host</td> | ||
<td>ip | <td>ip {{!}} host; default: <b>127.0.0.1</b></td> | ||
<td>IP address or hostname of an MQTT broker.</td> | <td>IP address or hostname of an MQTT broker.</td> | ||
</tr> | </tr> | ||
Line 980: | Line 1,247: | ||
<td>alphanumeric string; default: <b>response</b></td> | <td>alphanumeric string; default: <b>response</b></td> | ||
<td>MQTT topic for subscribing to responses.</td> | <td>MQTT topic for subscribing to responses.</td> | ||
</tr> | |||
<tr> | |||
<td>QoS</td> | |||
<td>At most once (0) {{!}} At least once (1) {{!}} Exactly once (2); default: <b>Exactly once (2)</b></td> | |||
<td>Specifies quality of service.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 990: | Line 1,262: | ||
<td>string; default: <b>none</b></td> | <td>string; default: <b>none</b></td> | ||
<td>Password for authentication to the MQTT broker.</td> | <td>Password for authentication to the MQTT broker.</td> | ||
</tr> | |||
<tr> | |||
<td>Client ID</td> | |||
<td>integer; default: <b>none</b></td> | |||
<td>Specifies client ID for MQTT broker.</td> | |||
</tr> | |||
<tr> | |||
<td>Keepalive</td> | |||
<td>integer; default: <b>5</b></td> | |||
<td>Keepalive message to MQTT broker (seconds)</td> | |||
</tr> | |||
<tr> | |||
<td>Use TLS/SSL</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Turns TLS support on or off</td> | |||
</tr> | |||
<tr> | |||
<td>TLS type</td> | |||
<td><span style="color:blue">cert</span> {{!}} <span style="color:red">psk</span>; default: <b>cert</b></td> | |||
<td>Selects the type of TLS encryption</td> | |||
</tr> | |||
<tr> | |||
<td>TLS insecure</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Disables TLS security</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">Certificate files from device</span></td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Choose this option if you want to use certificate files generated on device.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">CA file</span></td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Upload/select certificate authority file.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">Certificates file</span></td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Upload/select certificate file.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:blue">Key file</span></td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Upload/select certificate key file.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:red">PSK</span></td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Specifies the pre-shared key.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color:red">Identity</span></td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Specifies identity.</td> | |||
</tr> | </tr> | ||
</table> | </table> | ||
{{#ifeq:{{{serial}}}|1| | |||
===Serial Gateway Configuration=== | |||
---- | |||
<b>Serial Gateway Configuration</b> section displays Serial gateway instances currently existing on the router. | |||
By default the list is empty. To create a new gateway instance, enter the ID of serial device, select serial interface and click the 'Add' button. | |||
[[File:Networking_rutos_manual_modbus_mqtt_gateway_serial_gateway_configuration_add_button_v1_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}.png|border|class=tlt-border]] | |||
After this you should be redirected to instance's configuration page which should look similar to this: | |||
[[File:Networking_rutos_manual_modbus_mqtt_gateway_serial_gateway_configuration_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}_v1.png|border|class=tlt-border]] | |||
<table class="nd-mantable"> | |||
<tr> | |||
<th>Field</th> | |||
<th>Value</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>Enable</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Enables this Serial Gateway instance configuration.</td> | |||
</tr> | |||
<tr> | |||
<td>Name</td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Name of the gateway instance. Used for management purposes only.</td> | |||
</tr> | |||
<tr> | |||
<td>Device</td> | |||
<td>{{Template: Networking rutos manual serial ports| rs232={{{rs232}}}| rs485={{{rs485}}}| usb = {{{usb}}}}}; default: <b>{{Template: Networking rutos manual default serial port| rs232={{{rs232}}}| rs485={{{rs485}}}| usb = {{{usb}}}}}</b></td> | |||
<td>Specifies which serial port will be used for serial communication.</td> | |||
</tr> | |||
<tr> | |||
<td>Baud rate</td> | |||
<td>300 {{!}} 1200 {{!}} 2400 {{!}} 4800 {{!}} 9600 {{!}} 19200 {{!}} 38400 {{!}} 57600 {{!}} 115200{{#ifeq: {{{rs485}}} | 1 | {{!}} 230400 {{!}} 460800 {{!}} 921600 {{!}} 1000000 {{!}} 3000000|}}; default: <b>9600</b></td> | |||
<td>Serial data transmission rate (in bits per second).</td> | |||
</tr> | |||
<tr> | |||
<td>Data bits</td> | |||
<td>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|{{#switch:{{{series}}}|TRB2|TRB2M=|#default=5 {{!}} 6 {{!}}}} 7 {{!}} |}}8; default: <b>8</b></td> | |||
<td>Number of data bits for each character.</td> | |||
</tr> | |||
<tr> | |||
<td>Stop bits</td> | |||
<td>1{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} 2|}}; default: <b>1</b></td> | |||
<td>Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. Two stop bits are required if slow electromechanical devices are used.</td> | |||
</tr> | |||
<tr> | |||
<td>Parity</td> | |||
<td>Even {{!}} Odd{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} Mark {{!}} Space|}} {{!}} None; default: <b>None</b></td> | |||
<td>In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check. | |||
<ul> | |||
<li><b>None</b> (<b>N</b>) - no parity method is used.</li> | |||
<li><b>Odd</b> (<b>O</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be odd.</li> | |||
<li><b>Even</b> (<b>E</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be even.</li>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|<li><b>Space</b> (<b>s</b>) - the parity bit will always be a binary 0.</li> | |||
<li><b>Mark</b> (<b>M</b>) - the parity bit will always be a binary 1.</li>|}} | |||
</ul> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Flow control</td> | |||
<td>None {{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} RTS/CTS {{!}} Xon/Xoff|}}; default: <b>None</b></td> | |||
<td>In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking. | |||
{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|<ul> | |||
<li><b>RTS/CTS</b> - hardware handshaking. RTS and CTS are turned OFF and ON from alternate ends to control data flow, for instance when a buffer is almost full.</li> | |||
<li><b>Xon/Xoff</b> - software handshaking. The Xon and Xoff characters are sent by the receiver to the sender to control when the sender will send data, i.e., these characters go in the opposite direction to the data being sent. The circuit starts in the "sending allowed" state. When the receiver's buffers approach capacity, the receiver sends the Xoff character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an Xon character to tell the sender to resume transmission.</li> | |||
</ul>|}} | |||
</td> | |||
</tr>{{#ifeq: {{{rs485}}} | 1 | | |||
<tr> | |||
<td><span style="color:blue">RS485:</span> Full Duplex</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Enables RS485 full duplex.</td> | |||
</tr>|}} | |||
</table> | |||
|}} | |||
===Request messages=== | ===Request messages=== | ||
---- | ---- | ||
<span style="color:red"> <b>Note: </b></span>MQTT Gateway 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>Register Number</i> field. | |||
Modbus request data sent in the MQTT payload should be generated in accordance with the one of the following formats: | |||
* TCP: | |||
<b>0 <COOKIE> <IP_TYPE> <IP> <PORT> <TIMEOUT> <SERVER_ID> <MODBUS_FUNCTION> <FIRST_REGISTER> <REGISTER_COUNT/VALUES></b> | |||
* Serial: | |||
<b>1 <COOKIE> <SERIAL_DEVICE_ID> <TIMEOUT> <SERVER_ID> <MODBUS_FUNCTION> <FIRST_REGISTER> <REGISTER_COUNT/VALUES></b> | |||
* MODBUS TCP connection management messages: | |||
<b>2 <COOKIE> <CONNECTION_INDEX> <ACTION></b><br> | |||
<b>2 <COOKIE> <CONNECTION_INDEX> 0 <IP_TYPE> <IP> <PORT> <TIMEOUT></b> | |||
Explanation: | Explanation: | ||
<ul> | <ul> | ||
<li><b>Cookie</b> - a 64-bit unsigned integer in range [0..2<sup>64</sup>-1]). A cookie is used in order to distinguish which response belongs to which request, each request and the corresponding response contain a matching cookie: a 64-bit unsigned integer.</li> | |||
<li><b>Cookie</b> - a 64-bit unsigned integer in range [0..2<sup>64</sup>]). A cookie is used in order to distinguish which response belongs to which request, each request and the corresponding response contain a matching cookie: a 64-bit unsigned integer.</li> | |||
<li><b>IP type</b> - host IP address type. Possible values: | <li><b>IP type</b> - host IP address type. Possible values: | ||
<ul> | <ul> | ||
Line 1,009: | Line 1,420: | ||
<li><b>1</b> - IPv6 address;</li> | <li><b>1</b> - IPv6 address;</li> | ||
<li><b>2</b> - hostname that will be resolved to an IP address.</li> | <li><b>2</b> - hostname that will be resolved to an IP address.</li> | ||
</ul></li> | </ul> | ||
<li><b>IP</b> - IP address of a Modbus TCP | </li> | ||
<li><b>Port</b> - port number of the Modbus TCP | <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>Timeout</b> - timeout for Modbus | <li><b>Port</b> - port number of the Modbus TCP server.</li> | ||
<li><b> | <li><b>Timeout</b> - timeout for Modbus connection, in seconds. Range [1..999].</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> | ||
<li><b>1</b> - read coils;</li> | |||
<li><b>2</b> - read input coils;</li> | |||
<li><b>3</b> - read holding registers;</li> | <li><b>3</b> - read holding registers;</li> | ||
<li><b>4</b> - read input registers;</li> | |||
<li><b>5</b> - set single coil;</li> | |||
<li><b>6</b> - write to a single holding register;</li> | <li><b>6</b> - write to a single holding register;</li> | ||
<li><b>15</b> - set multiple coils;</li> | |||
<li><b>16</b> - write to multiple holding registers.</li> | <li><b>16</b> - write to multiple holding registers.</li> | ||
</ul></li> | </ul> | ||
<li><b> | </li> | ||
<li><b>First register</b> - number (not address) of the first register/coil/input (in range [1..65536]) from which the registers/coils/inputs will be read/written to.</li> | |||
<li><b>Register count/value</b> - this value depends on the Modbus function: | <li><b>Register count/value</b> - this value depends on the Modbus function: | ||
<ul> | <ul> | ||
<li><b>3</b> - <u>register count</u> (in range [ | <li><b>1</b> - <u>coil count</u> (in range [1..2000]); must not exceed the boundary (first coil number + coil count <= 65537);</li> | ||
<li><b>6</b> - <u>register value</u> (in range [0..65535]);</li> | <li><b>2</b> - <u>input count</u> (in range [1..2000]); must not exceed the boundary (first input number + input count <= 65537);</li> | ||
<li><b>3</b> - <u>holding register count</u> (in range [0..125]); must not exceed the boundary (first register number + holding register count <= 65537);</li> | |||
<li><b>4</b> - <u>input register count</u> (in range [0..125]); must not exceed the boundary (first register number + input register count <= 65537);</li> | |||
<li><b>5</b> - <u>coil value</u> (in range [0..1]);</li> | |||
<li><b>6</b> - <u>holding register value</u> (in range [0..65535]);</li> | |||
<li><b>15</b> - <u>coil count</u> (in range [1..1968]); must not exceed the boundary (first coil number + coil count <= 65537); and <u>coil values</u> separated with commas, without spaces (e.g., <i>1,2,3,654,21,789</i>); there must be exactly as many values as specified (with coil count); each value must be in the range of [0..1].</li> | |||
<li><b>16</b> - <u>register count</u> (in range [1..123]); must not exceed the boundary (first register number + register count <= 65537); and <u>register values</u> separated with commas, without spaces (e.g., <i>1,2,3,654,21,789</i>); there must be exactly as many values as specified (with register count); each value must be in the range of [0..65535].</li> | <li><b>16</b> - <u>register count</u> (in range [1..123]); must not exceed the boundary (first register number + register count <= 65537); and <u>register values</u> separated with commas, without spaces (e.g., <i>1,2,3,654,21,789</i>); there must be exactly as many values as specified (with register count); each value must be in the range of [0..65535].</li> | ||
</ul></li> | </ul> | ||
</li> | |||
<li><b>Serial device ID</b> - a string used to identify a serial device. Must match with <u>Device ID</u> field in MQTT Gateway page Serial gateway configuration section.</li> | |||
<li><b>Connection index</b> - a number used to identify a connection on which an action will be preformed (in range [0..7]).</li> | |||
<li><b>Action</b> - a connection action. Possible values are: | |||
<ul> | |||
<li><b>0</b> - OPEN. This will open a closed connection, reopen an already open connection with the same parameters or close an already open connection and open a new one with new parameters.</li> | |||
<li><b>1</b> - CLOSE. This will close an open connection and do nothing to the closed one.</li> | |||
<li><b>2</b> - STATUS. This will respond with either <b>OK 1</b> for an open connection or <b>OK 0</b> for a closed connection.</li> | |||
</ul> | |||
</li> | |||
<!-- <li><b>Timeout count</b> - number of timeouts. (in range []) </li> --> | |||
</ul> | </ul> | ||
Line 1,039: | Line 1,473: | ||
===Examples=== | ===Examples=== | ||
---- | ---- | ||
Below are a few <b>examples</b> of controlling/monitoring the internal Modbus TCP | 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,064: | Line 1,498: | ||
65432 OK 0 5590</pre></li> | 65432 OK 0 5590</pre></li> | ||
</ul> | </ul> | ||
{{#ifeq: {{{serial}}} | 1 | | |||
==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 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=== | |||
---- | |||
<b>Modbus TCP over Serial Gateway Configuration</b> section displays gateway instances currently existing on the router. | |||
By default the list is empty. To create a new gateway instance, enter the name of instance, select serial interface and click the 'Add' button. | |||
[[File:Networking_rutos_manual_modbus_modbus_tcp_over_serial_gateway_add_button_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}_v1.png|border|class=tlt-border]] | |||
After this you should be redirected to instance's configuration page which should look similar to this: | |||
[[File:Networking_rutos_manual_modbus_modbus_tcp_over_serial_gateway_configuration_rs232_{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|1|0}}_v2.png|border|class=tlt-border]] | |||
<table class="nd-mantable"> | |||
<tr> | |||
<th>Field</th> | |||
<th>Value</th> | |||
<th>Description</th> | |||
</tr> | |||
<tr> | |||
<td>Enable</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Enables this Modbus TCP over Serial Gateway instance configuration.</td> | |||
</tr> | |||
<tr> | |||
<td>Name</td> | |||
<td>string; default: <b>none</b></td> | |||
<td>Name of the gateway instance. Used for management purposes only.</td> | |||
</tr> | |||
<tr> | |||
<td>Device</td> | |||
<td>{{Template: Networking rutos manual serial ports| rs232={{{rs232}}}| rs485={{{rs485}}}| usb = {{{usb}}}}}; default: <b>{{Template: Networking rutos manual default serial port| rs232={{{rs232}}}| rs485={{{rs485}}}| usb = {{{usb}}}}}</b></td> | |||
<td>Specifies which serial port will be used for serial communication.</td> | |||
</tr> | |||
<tr> | |||
<td>Baud rate</td> | |||
<td>300 {{!}} 1200 {{!}} 2400 {{!}} 4800 {{!}} 9600 {{!}} 19200 {{!}} 38400 {{!}} 57600 {{!}} 115200{{#ifeq: {{{rs485}}} | 1 | {{!}} 230400 {{!}} 460800 {{!}} 921600 {{!}} 1000000 {{!}} 3000000|}}; default: <b>9600</b></td> | |||
<td>Serial data transmission rate (in bits per second).</td> | |||
</tr> | |||
<tr> | |||
<td>Data bits</td> | |||
<td>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|{{#ifeq:{{{series}}}|TRB2|TRB2M=|#default=5 {{!}} 6 {{!}}}} 7 {{!}} |}}8; default: <b>8</b></td> | |||
<td>Number of data bits for each character.</td> | |||
</tr> | |||
<tr> | |||
<td>Stop bits</td> | |||
<td>1{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} 2|}}; default: <b>1</b></td> | |||
<td>Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. Two stop bits are required if slow electromechanical devices are used.</td> | |||
</tr> | |||
<tr> | |||
<td>Parity</td> | |||
<td>Even {{!}} Odd{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} Mark {{!}} Space|}} {{!}} None; default: <b>None</b></td> | |||
<td>In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check. | |||
<ul> | |||
<li><b>None</b> (<b>N</b>) - no parity method is used.</li> | |||
<li><b>Odd</b> (<b>O</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be odd.</li> | |||
<li><b>Even</b> (<b>E</b>) - the parity bit is set so that the number of "logical ones (1s)" has to be even.</li>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|<li><b>Space</b> (<b>s</b>) - the parity bit will always be a binary 0.</li> | |||
<li><b>Mark</b> (<b>M</b>) - the parity bit will always be a binary 1.</li>|}} | |||
</ul> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Flow control</td> | |||
<td>None{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| {{!}} RTS/CTS {{!}} Xon/Xoff|}}; default: <b>None</b></td> | |||
<td>In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking. | |||
{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1|<ul> | |||
<li><b>RTS/CTS</b> - hardware handshaking. RTS and CTS are turned OFF and ON from alternate ends to control data flow, for instance when a buffer is almost full.</li> | |||
<li><b>Xon/Xoff</b> - software handshaking. The Xon and Xoff characters are sent by the receiver to the sender to control when the sender will send data, i.e., these characters go in the opposite direction to the data being sent. The circuit starts in the "sending allowed" state. When the receiver's buffers approach capacity, the receiver sends the Xoff character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an Xon character to tell the sender to resume transmission.</li> | |||
</ul>|}} | |||
</td> | |||
</tr> | |||
<tr> | |||
<td>Listening IP</td> | |||
<td>ip; default: <b>none</b></td> | |||
<td>IP address to listen for incoming connections. (<i>0.0.0.0</i>) value may be used to listen for incoming connections on any interface or IP address.</td> | |||
</tr> | |||
<tr> | |||
<td>Port</td> | |||
<td>integer [0..65535]; default: <b>none</b></td> | |||
<td>Port number to listen for incoming connections.</td> | |||
</tr> | |||
<tr> | |||
<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>Specifies whether server IDs are user defined or automatically obtained from TCP.</td> | |||
</tr> | |||
<tr> | |||
<td><span style="color: green;">Server ID</span></td> | |||
<td><span style="color: green;">integer</span>; default: <b>none</span></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> | |||
<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>Read <i>Server ID</i> field description.</td> | |||
</tr> | |||
<tr> | |||
<td>CRC verification</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Checks if sent serial message is not disturbed.</td> | |||
</tr>{{#ifeq:{{#expr: {{{rs232}}} or {{{usb}}}}} |1| | |||
<tr> | |||
<td>Echo</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Turns RS232 echo on or off. RS232 echo is a loopback test usually used to check whether the RS232 cable is working properly.</td> | |||
</tr>|}}{{#ifeq: {{{rs485}}} | 1 | | |||
<tr> | |||
<td><span style="color:blue">RS485:</span> Full Duplex</td> | |||
<td>off {{!}} on; default: <b>off</b></td> | |||
<td>Enables RS485 full duplex.</td> | |||
</tr>|}} | |||
</table> | |||
===IP Filter=== | |||
---- | |||
The <b>IP Filter</b> section is used for configuring which network is allowed to communicate with the device. You may add a new instance by selecting the Interface and pressing Add. | |||
[[File:Networking_rutos_manual_console_ip_filter.png|border|class=tlt-border]] | |||
Then enter the IP address and save. | |||
[[File:Networking_rutos_manual_console_ip_filter_instance_v2.png|border|class=tlt-border]] | |||
|}} | |||
==See also== | ==See also== | ||
<ul> | <ul> | ||
<li><b>[[ | <li><b>[[Monitoring via Modbus|Monitoring via Modbus]]</b> - detailed examples on how to use Modbus TCP</li> | ||
</ul> | </ul> | ||
[[Category:{{{name}}} Services section]] | [[Category:{{{name}}} Services section]] |