1111class Defaults (Singleton ): # pylint: disable=too-few-public-methods
1212 """A collection of modbus default values.
1313
14- .. attribute:: Port
14+ .. attribute:: Port
1515
16- The default modbus tcp server port (502)
16+ The default modbus tcp server port (502)
1717
18- .. attribute:: TLSPort
18+ .. attribute:: TLSPort
1919
20- The default modbus tcp over tls server port (802)
20+ The default modbus tcp over tls server port (802)
2121
2222
23- .. attribute:: Backoff
23+ .. attribute:: Backoff
2424
25- The default exponential backoff delay (0.3 seconds)
25+ The default exponential backoff delay (0.3 seconds) for a request
2626
27- .. attribute:: Retries
27+ .. attribute:: Retries
2828
29- The default number of times a client should retry the given
30- request before failing (3)
29+ The default number of times a client should retry the given
30+ request before failing (3)
3131
32- .. attribute:: RetryOnEmpty
32+ .. attribute:: RetryOnEmpty
3333
34- A flag indicating if a transaction should be retried in the
35- case that an empty response is received. This is useful for
36- slow clients that may need more time to process a request.
34+ A flag indicating if a transaction should be retried in the
35+ case that an empty response is received. This is useful for
36+ slow clients that may need more time to process a request.
3737
38- .. attribute:: RetryOnInvalid
38+ .. attribute:: RetryOnInvalid
3939
40- A flag indicating if a transaction should be retried in the
41- case that an invalid response is received.
40+ A flag indicating if a transaction should be retried in the
41+ case that an invalid response is received.
4242
43- .. attribute:: Timeout
43+ .. attribute:: Timeout
4444
45- The default amount of time a client should wait for a request
46- to be processed (3 seconds)
45+ The default amount of time a client should wait for a request
46+ to be processed (3 seconds)
4747
48- .. attribute:: Reconnects
48+ .. attribute:: Reconnects
4949
50- The default number of times a client should attempt to reconnect
51- before deciding the server is down (0)
50+ The default number of times a client should attempt to reconnect
51+ before deciding the server is down (0)
5252
53- .. attribute:: TransactionId
53+ .. attribute:: TransactionId
5454
55- The starting transaction identifier number (0)
55+ The starting transaction identifier number (0)
5656
57- .. attribute:: ProtocolId
57+ .. attribute:: ProtocolId
5858
59- The modbus protocol id. Currently, this is set to 0 in all
60- but proprietary implementations.
59+ The modbus protocol id. Currently, this is set to 0 in all
60+ but proprietary implementations.
6161
62- .. attribute:: Slave
62+ .. attribute:: Slave
6363
64- The modbus slave address. Currently, this is set to 0x00 which
65- means this request should be broadcast to all the slave devices
66- (really means that all the devices should respond).
64+ The modbus slave address. Currently, this is set to 0x00 which
65+ means this request should be broadcast to all the slave devices
66+ (really means that all the devices should respond).
6767
68- .. attribute:: Baudrate
68+ .. attribute:: Baudrate
6969
70- The speed at which the data is transmitted over the serial line.
71- This defaults to 19200.
70+ The speed at which the data is transmitted over the serial line.
71+ This defaults to 19200.
7272
73- .. attribute:: Parity
73+ .. attribute:: Parity
7474
75- The type of checksum to use to verify data integrity. This can be
76- on of the following::
75+ The type of checksum to use to verify data integrity. This can be
76+ on of the following::
7777
78- - (E)ven - 1 0 1 0 | P(0)
79- - (O)dd - 1 0 1 0 | P(1)
80- - (N)one - 1 0 1 0 | no parity
78+ - (E)ven - 1 0 1 0 | P(0)
79+ - (O)dd - 1 0 1 0 | P(1)
80+ - (N)one - 1 0 1 0 | no parity
8181
82- This defaults to (N)one.
82+ This defaults to (N)one.
8383
84- .. attribute:: Bytesize
84+ .. attribute:: Bytesize
8585
86- The number of bits in a byte of serial data. This can be one of
87- 5, 6, 7, or 8. This defaults to 8.
86+ The number of bits in a byte of serial data. This can be one of
87+ 5, 6, 7, or 8. This defaults to 8.
8888
89- .. attribute:: Stopbits
89+ .. attribute:: Stopbits
9090
91- The number of bits sent after each character in a message to
92- indicate the end of the byte. This defaults to 1.
91+ The number of bits sent after each character in a message to
92+ indicate the end of the byte. This defaults to 1.
9393
94- .. attribute:: ZeroMode
94+ .. attribute:: ZeroMode
9595
96- Indicates if the slave datastore should use indexing at 0 or 1.
97- More about this can be read in section 4.4 of the modbus specification.
96+ Indicates if the slave datastore should use indexing at 0 or 1.
97+ More about this can be read in section 4.4 of the modbus specification.
9898
99- .. attribute:: IgnoreMissingSlaves
99+ .. attribute:: IgnoreMissingSlaves
100100
101- In case a request is made to a missing slave, this defines if an error
102- should be returned or simply ignored. This is useful for the case of a
103- serial server emulater where a request to a non-existent slave on a bus
104- will never respond. The client in this case will simply timeout.
101+ In case a request is made to a missing slave, this defines if an error
102+ should be returned or simply ignored. This is useful for the case of a
103+ serial server emulater where a request to a non-existent slave on a bus
104+ will never respond. The client in this case will simply timeout.
105105
106- .. attribute:: broadcast_enable
106+ .. attribute:: broadcastEnable
107+
108+ When False unit_id 0 will be treated as any other unit_id. When True and
109+ the unit_id is 0 the server will execute all requests on all server
110+ contexts and not respond and the client will skip trying to receive a
111+ response. Default value False does not conform to Modbus spec but maintains
112+ legacy behavior for existing pymodbus users.
113+
114+ .. attribute: reconnectDelayMin
115+
116+ When a connection has been dropped, the client will initially wait
117+ reconnectDelayMin milliseconds before attempting a reconnect. If the
118+ attempt fails, it will double the delay before attempting again, up to a
119+ a maximum of ReconnectDelayMax. (binary exponential backoff).
120+
121+ .. attribute: reconnectDelayMax
122+
123+ When a connection has been dropped, the client will initially wait
124+ reconnectDelayMin milliseconds before attempting a reconnect. If the
125+ attempt fails, it will double the delay before attempting again, up to a
126+ a maximum of ReconnectDelayMax. (binary exponential backoff)
107127
108- When False unit_id 0 will be treated as any other unit_id. When True and
109- the unit_id is 0 the server will execute all requests on all server
110- contexts and not respond and the client will skip trying to receive a
111- response. Default value False does not conform to Modbus spec but maintains
112- legacy behavior for existing pymodbus users.
113128
114129 """
115130
@@ -136,7 +151,8 @@ class Defaults(Singleton): # pylint: disable=too-few-public-methods
136151 IgnoreMissingSlaves = False
137152 ReadSize = 1024
138153 BroadcastEnable = False
139- ReconnectDelay = 1000 * 60 * 5
154+ ReconnectDelay = 100
155+ ReconnectDelayMax = 1000 * 60 * 5
140156 Count = 1
141157
142158
0 commit comments