[modbus] Added support for RTU encoding over TCP (#9435)
* [modbus] add support for rtu encoded over tcp * [modbus] move classes to openhab/jamod * [modbus] spotless * [modbus] revert EndpointPoolConfiguration * [modbus] remove virtual serial * [modbus] resolve dependencies * [modbus.studer] add support for RTU over TCP bridge Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
committed by
GitHub
parent
6cb9f3a93e
commit
aebe1d4a0b
@@ -37,8 +37,8 @@ The binding can also *write* data to Modbus slaves using FC05 (Write single coil
|
||||
|
||||
Please note the following caveats or limitations
|
||||
|
||||
* the binding does *not* act as Modbus slave (e.g. as Modbus TCP server).
|
||||
* the binding does *not* support Modbus RTU over Modbus TCP, also known as "Modbus over TCP/IP" or "Modbus over TCP" or "Modbus RTU/IP", although normal "Modbus TCP" is supported. However, there is a workaround: you can use a Virtual Serial Port Server, to emulate a COM Port and Bind it with openHAB using Modbus Serial.
|
||||
* The binding does *not* act as Modbus slave (e.g. as Modbus TCP server).
|
||||
* The binding *does* support Modbus RTU over Modbus TCP, (also known as "Modbus over TCP/IP" or "Modbus over TCP" or "Modbus RTU/IP"), as well as normal "Modbus TCP".
|
||||
|
||||
|
||||
## Background Material
|
||||
@@ -108,11 +108,12 @@ When optional parameters are not specified, they default to the values shown in
|
||||
|
||||
Basic parameters
|
||||
|
||||
| Parameter | Type | Required | Default if omitted | Description |
|
||||
| --------- | ------- | -------- | ------------------ | ----------------------------------------------------------- |
|
||||
| `host` | text | | `"localhost"` | IP Address or hostname |
|
||||
| `port` | integer | | `502` | Port number |
|
||||
| `id` | integer | | `1` | Slave id. Also known as station address or unit identifier. |
|
||||
| Parameter | Type | Required | Default if omitted | Description |
|
||||
| ------------ | ------- | -------- | ------------------ | ----------------------------------------------------------- |
|
||||
| `host` | text | | `"localhost"` | IP Address or hostname |
|
||||
| `port` | integer | | `502` | Port number |
|
||||
| `id` | integer | | `1` | Slave id. Also known as station address or unit identifier. |
|
||||
| `rtuEncoded` | boolean | | `false` | Use RTU encoding instead of regular TCP encoding. |
|
||||
|
||||
Advanced parameters
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ public class ModbusTcpConfiguration {
|
||||
private int reconnectAfterMillis;
|
||||
private int connectTimeoutMillis;
|
||||
private boolean enableDiscovery;
|
||||
private boolean rtuEncoded;
|
||||
|
||||
public boolean getRtuEncoded() {
|
||||
return rtuEncoded;
|
||||
}
|
||||
|
||||
public @Nullable String getHost() {
|
||||
return host;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ModbusTcpThingHandler
|
||||
}
|
||||
|
||||
this.config = config;
|
||||
endpoint = new ModbusTCPSlaveEndpoint(host, config.getPort());
|
||||
endpoint = new ModbusTCPSlaveEndpoint(host, config.getPort(), config.getRtuEncoded());
|
||||
|
||||
EndpointPoolConfiguration poolConfiguration = new EndpointPoolConfiguration();
|
||||
this.poolConfiguration = poolConfiguration;
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
<default>false</default>
|
||||
</parameter>
|
||||
|
||||
<parameter name="rtuEncoded" type="boolean">
|
||||
<label>RTU Encoding</label>
|
||||
<description>Use RTU Encoding over IP</description>
|
||||
<default>false</default>
|
||||
</parameter>
|
||||
|
||||
<!-- connection handling -->
|
||||
<parameter name="timeBetweenTransactionsMillis" type="integer" min="0" unit="ms">
|
||||
<label>Time Between Transactions</label>
|
||||
|
||||
Reference in New Issue
Block a user