mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[modbus] Add support for after connection delays required by some devices. (#12642)
Fixes #12641. Signed-off-by: Łukasz Dywicki <luke@code-house.org>
This commit is contained in:
parent
8d92e9d31e
commit
7323b2e4eb
@ -122,6 +122,7 @@ Advanced parameters
|
||||
| `timeBetweenTransactionsMillis` | | integer | `60` | How long to delay we must have at minimum between two consecutive MODBUS transactions. In milliseconds. |
|
||||
| `timeBetweenReconnectMillis` | | integer | `0` | How long to wait to before trying to establish a new connection after the previous one has been disconnected. In milliseconds. |
|
||||
| `connectMaxTries` | | integer | `1` | How many times we try to establish the connection. Should be at least 1. |
|
||||
| `afterConnectionDelayMillis` | | integer | `0` | Connection warm-up time. Additional time which is spent on preparing connection which should be spent waiting while end device is getting ready to answer first modbus call. In milliseconds. |
|
||||
| `reconnectAfterMillis` | | integer | `0` | The connection is kept open at least the time specified here. Value of zero means that connection is disconnected after every MODBUS transaction. In milliseconds. |
|
||||
| `connectTimeoutMillis` | | integer | `10000` | The maximum time that is waited when establishing the connection. Value of zero means that system/OS default is respected. In milliseconds. |
|
||||
| `enableDiscovery` | | boolean | false | Enable auto-discovery feature. Effective only if a supporting extension has been installed. |
|
||||
@ -158,6 +159,7 @@ Advanced parameters
|
||||
| `flowControlOut` | | text | `"none"` | Type of flow control for sending. Valid values are: `"none"`, `"xon/xoff out"`, `"rts/cts out"`. |
|
||||
| `timeBetweenTransactionsMillis` | | integer | `35` | How long to delay we must have at minimum between two consecutive MODBUS transactions. In milliseconds. |
|
||||
| `connectMaxTries` | | integer | `1` | How many times we try to establish the connection. Should be at least 1. |
|
||||
| `afterConnectionDelayMillis` | | integer | `0` | Connection warm-up time. Additional time which is spent on preparing connection which should be spent waiting while end device is getting ready to answer first modbus call. In milliseconds. |
|
||||
| `connectTimeoutMillis` | | integer | `10000` | The maximum time that is waited when establishing the connection. Value of zero means thatsystem/OS default is respected. In milliseconds. |
|
||||
| `enableDiscovery` | | boolean | false | Enable auto-discovery feature. Effective only if a supporting extension has been installed. |
|
||||
|
||||
|
@ -36,6 +36,7 @@ public class ModbusSerialConfiguration {
|
||||
private String flowControlOut = "none";
|
||||
private int timeBetweenTransactionsMillis = 35;
|
||||
private int connectMaxTries = 1;
|
||||
private int afterConnectionDelayMillis;
|
||||
private int connectTimeoutMillis = 10_000;
|
||||
private boolean enableDiscovery;
|
||||
|
||||
@ -143,6 +144,14 @@ public class ModbusSerialConfiguration {
|
||||
this.connectMaxTries = connectMaxTries;
|
||||
}
|
||||
|
||||
public int getAfterConnectionDelayMillis() {
|
||||
return afterConnectionDelayMillis;
|
||||
}
|
||||
|
||||
public void setAfterConnectionDelayMillis(int afterConnectionDelayMillis) {
|
||||
this.afterConnectionDelayMillis = afterConnectionDelayMillis;
|
||||
}
|
||||
|
||||
public int getConnectTimeoutMillis() {
|
||||
return connectTimeoutMillis;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public class ModbusTcpConfiguration {
|
||||
private int timeBetweenReconnectMillis;
|
||||
private int connectMaxTries = 1;
|
||||
private int reconnectAfterMillis;
|
||||
private int afterConnectionDelayMillis;
|
||||
private int connectTimeoutMillis = 10_000;
|
||||
private boolean enableDiscovery;
|
||||
private boolean rtuEncoded;
|
||||
@ -94,6 +95,14 @@ public class ModbusTcpConfiguration {
|
||||
this.reconnectAfterMillis = reconnectAfterMillis;
|
||||
}
|
||||
|
||||
public int getAfterConnectionDelayMillis() {
|
||||
return afterConnectionDelayMillis;
|
||||
}
|
||||
|
||||
public void setAfterConnectionDelayMillis(int afterConnectionDelayMillis) {
|
||||
this.afterConnectionDelayMillis = afterConnectionDelayMillis;
|
||||
}
|
||||
|
||||
public int getConnectTimeoutMillis() {
|
||||
return connectTimeoutMillis;
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ public class ModbusSerialThingHandler
|
||||
EndpointPoolConfiguration poolConfiguration = new EndpointPoolConfiguration();
|
||||
this.poolConfiguration = poolConfiguration;
|
||||
poolConfiguration.setConnectMaxTries(config.getConnectMaxTries());
|
||||
poolConfiguration.setAfterConnectionDelayMillis(config.getAfterConnectionDelayMillis());
|
||||
poolConfiguration.setConnectTimeoutMillis(config.getConnectTimeoutMillis());
|
||||
poolConfiguration.setInterTransactionDelayMillis(config.getTimeBetweenTransactionsMillis());
|
||||
|
||||
|
@ -56,6 +56,7 @@ public class ModbusTcpThingHandler
|
||||
EndpointPoolConfiguration poolConfiguration = new EndpointPoolConfiguration();
|
||||
this.poolConfiguration = poolConfiguration;
|
||||
poolConfiguration.setConnectMaxTries(config.getConnectMaxTries());
|
||||
poolConfiguration.setAfterConnectionDelayMillis(config.getAfterConnectionDelayMillis());
|
||||
poolConfiguration.setConnectTimeoutMillis(config.getConnectTimeoutMillis());
|
||||
poolConfiguration.setInterConnectDelayMillis(config.getTimeBetweenReconnectMillis());
|
||||
poolConfiguration.setInterTransactionDelayMillis(config.getTimeBetweenTransactionsMillis());
|
||||
|
@ -77,6 +77,8 @@ thing-type.config.modbus.poller.type.option.coil = coil, or digital out (DO)
|
||||
thing-type.config.modbus.poller.type.option.discrete = discrete input, or digital in (DI)
|
||||
thing-type.config.modbus.poller.type.option.holding = holding register
|
||||
thing-type.config.modbus.poller.type.option.input = input register
|
||||
thing-type.config.modbus.serial.afterConnectionDelayMillis.label = Connection warm-up time
|
||||
thing-type.config.modbus.serial.afterConnectionDelayMillis.description = Connection warm-up time. Additional time which is spent on preparing connection which should be spent waiting while end device is getting ready to answer first modbus call. In milliseconds.
|
||||
thing-type.config.modbus.serial.baud.label = Baud
|
||||
thing-type.config.modbus.serial.baud.description = Baud of the connection
|
||||
thing-type.config.modbus.serial.baud.option.75 = 75
|
||||
@ -137,6 +139,8 @@ thing-type.config.modbus.serial.stopBits.option.1.5 = 1.5
|
||||
thing-type.config.modbus.serial.stopBits.option.2.0 = 2
|
||||
thing-type.config.modbus.serial.timeBetweenTransactionsMillis.label = Time Between Transactions
|
||||
thing-type.config.modbus.serial.timeBetweenTransactionsMillis.description = How long to delay we must have at minimum between two consecutive MODBUS transactions. In milliseconds.
|
||||
thing-type.config.modbus.tcp.afterConnectionDelayMillis.label = Connection warm-up time
|
||||
thing-type.config.modbus.tcp.afterConnectionDelayMillis.description = Connection warm-up time. Additional time which is spent on preparing connection which should be spent waiting while end device is getting ready to answer first modbus call. In milliseconds.
|
||||
thing-type.config.modbus.tcp.connectMaxTries.label = Maximum Connection Tries
|
||||
thing-type.config.modbus.tcp.connectMaxTries.description = How many times we try to establish the connection. Should be at least 1.
|
||||
thing-type.config.modbus.tcp.connectTimeoutMillis.label = Timeout for Establishing the Connection
|
||||
|
@ -136,6 +136,13 @@
|
||||
<default>1</default>
|
||||
<advanced>true</advanced>
|
||||
</parameter>
|
||||
<parameter name="afterConnectionDelayMillis" type="integer" min="0" unit="ms">
|
||||
<label>Connection warm-up time</label>
|
||||
<description>Connection warm-up time. Additional time which is spent on preparing connection which should be spent
|
||||
waiting while end device is getting ready to answer first modbus call. In milliseconds.</description>
|
||||
<default>0</default>
|
||||
<advanced>true</advanced>
|
||||
</parameter>
|
||||
<parameter name="connectTimeoutMillis" type="integer" min="0" unit="ms">
|
||||
<label>Timeout for Establishing the Connection</label>
|
||||
<description>The maximum time that is waited when establishing the connection. Value of zero means that system/OS
|
||||
|
@ -58,6 +58,13 @@
|
||||
<default>1</default>
|
||||
<advanced>true</advanced>
|
||||
</parameter>
|
||||
<parameter name="afterConnectionDelayMillis" type="integer" min="0" unit="ms">
|
||||
<label>Connection warm-up time</label>
|
||||
<description>Connection warm-up time. Additional time which is spent on preparing connection which should be spent
|
||||
waiting while end device is getting ready to answer first modbus call. In milliseconds.</description>
|
||||
<default>0</default>
|
||||
<advanced>true</advanced>
|
||||
</parameter>
|
||||
<parameter name="reconnectAfterMillis" type="integer" min="0" unit="ms">
|
||||
<label>Reconnect Again After</label>
|
||||
<description>The connection is kept open at least the time specified here. Value of zero means that connection is
|
||||
|
Loading…
Reference in New Issue
Block a user