Skip to content

Commit 6143a0e

Browse files
committed
Merge branch 'dev'
2 parents fbf2cef + c1e7f3b commit 6143a0e

File tree

104 files changed

+1292
-2345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1292
-2345
lines changed

API_changes.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,27 @@ API changes
22
===========
33
Versions (X.Y.Z) where Z > 0 e.g. 3.0.1 do NOT have API changes!
44

5+
API changes 3.10.0
56
-----------------
7+
- ModbusSlaveContext replaced by ModbusDeviceContext
8+
- payload removed (replaced by "convert_to/from_registers")
9+
- slave=, slaves= replaced by device_id=, device_ids=
10+
- slave request names changed to device
11+
- bit handling order is LSB (last byte) -> MSB (first byte)
12+
readCoils and other bit functions now return bit in logical order (NOT byte order)
13+
14+
Older versions had LSB -> MSB pr byte
15+
V3.10 have LSB -> MSB across bytes.
16+
17+
Example:
18+
Hex bytes: 0x00 0x01
19+
Older versions would deliver False * 8 True False * 7
20+
V3.10 deliver True False * 15
21+
22+
Hex bytes: 0x01 0x03
23+
Older versions would deliver True False * 7 True True False * 6
24+
V3.10 deliver True True False * 6 True False * 7
25+
626
API changes 3.9.0
727
-----------------
828
- Python 3.9 is reaching end of life, and no longer supported.

AUTHORS.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Thanks to
2525
- banana-sun
2626
- Blaise Thompson
2727
- Breina
28+
- brherger
2829
- CapraTheBest
2930
- cgernert
3031
- corollaries
@@ -41,13 +42,15 @@ Thanks to
4142
- Dries
4243
- duc996
4344
- efdx
45+
- Erlend E. Aasland
4446
- Esco441-91
4547
- Farzad Panahi
4648
- Fredo70
4749
- Gao Fang
4850
- Ghostkeeper
4951
- Hangyu Fan
5052
- Hayden Roche
53+
- igorbga
5154
- Iktek
5255
- Ilkka Ollakka
5356
- Jakob Ruhe
@@ -67,6 +70,8 @@ Thanks to
6770
- Kürşat Aktaş
6871
- laund
6972
- Logan Gunthorpe
73+
- Luke Hoggatt
74+
- Mark Deneen
7075
- Marko Luther
7176
- Martyy
7277
- Máté Szabó

CHANGELOG.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ helps make pymodbus a better product.
77

88
:ref:`Authors`: contains a complete list of volunteers have contributed to each major version.
99

10+
Version 3.10.0
11+
-------------
12+
* Raise runtimeerror if listen() fails. (#2697)
13+
* Correct values parameter in setValues. (#2696)
14+
* Correct return from getValues. (#2695)
15+
* Add request fc to exceptionResponse. (#2694)
16+
* DummyProtocol is not async (#2686)
17+
* Handle "little" for multiple values in to_registers (#2678)
18+
* Remove unused const. (#2676)
19+
* Add retries to ModbusPDU class (#2672)
20+
* Don't invoke `trace_connect` callback twice (#2670)
21+
* ensure unpacking of proper length during decoding (#2664) (#2665)
22+
* README clean-up (#2659)
23+
* Bump coverage to 95,5% (#2658)
24+
* Simplify response rejection. (#2657)
25+
* Bump coverage to 93%. (#2656)
26+
* Solve ModbusDeviceContext bug. (#2653)
27+
* Bit handling LSB -> MSB across bytes. (#2634)
28+
* Change slave to device_id and slave= to device_id=. (#2600)
29+
* Remove payload. (#2524)
30+
1031
Version 3.9.2
1132
-------------
1233
* Reactivate simulator validate. (#2643)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2008-2023 Pymodbus
1+
Copyright 2008-2025 Pymodbus
22

33
Redistribution and use in source and binary forms, with or without
44
modification, are permitted provided that the following conditions

README.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ PyModbus - A Python Modbus Stack
1212
:target: https://gurubase.io/g/pymodbus
1313
:alt: PyModbus Guru
1414

15-
Pymodbus is a full Modbus protocol implementation offering client/server with synchronous/asynchronous API and simulators.
15+
Pymodbus is a full Modbus protocol implementation offering a client and server with synchronous/asynchronous API and simulators.
1616

17-
Our releases is defined as X.Y.Z, and we have strict rules what to release when:
17+
Our releases follow the pattern `X.Y.Z`. We have strict rules for what different version number updates mean:
1818

1919
- **Z**, No API changes! bug fixes and smaller enhancements.
2020
- **Y**, API changes, bug fixes and bigger enhancements.
@@ -23,10 +23,13 @@ Our releases is defined as X.Y.Z, and we have strict rules what to release when:
2323
Upgrade examples:
2424

2525
- 3.9.0 -> 3.9.2: just plugin the new version, no changes needed.
26+
Remark fixing bugs, can lead to a different behaviors/returns
2627
- 3.8.0 -> 3.9.0: Smaller changes to the pymodbus calls might be needed
2728
- 2.5.4 -> 3.0.0: Major changes in the application might be needed
2829

29-
Current release is `3.9.2 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.9.2>`_.
30+
It is always recommended to read the CHANGELOG as well as the API_changes files.
31+
32+
Current release is `3.10.0 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.10.0>`_.
3033

3134
Bleeding edge (not released) is `dev <https://github.com/pymodbus-dev/pymodbus/tree/dev>`_.
3235

@@ -124,10 +127,10 @@ server, the server is handy to verify the functionality of an application.
124127

125128
The simulator and/or server is often used to simulate real life devices testing
126129
applications. The server is excellent to perform high volume testing (e.g.
127-
houndreds of devices connected to the application). The advantage of the server is
128-
that it runs not only a "normal" computers but also on small ones like Raspberry PI.
130+
hundreds of devices connected to the application). The advantage of the server is
131+
that it runs not only on "normal" computers but also on small ones like a Raspberry PI.
129132

130-
Since the library is written in python, it allows for easy scripting and/or integration into their existing
133+
Since the library is written in python, it allows for easy scripting and/or integration into existing
131134
solutions.
132135

133136
For more information please browse the project documentation:
@@ -240,7 +243,7 @@ The repository contains a number of important branches and tags.
240243

241244
Example Code
242245
------------
243-
For those of you that just want to get started fast, here you go::
246+
For those of you who just want to get started quickly, here you go::
244247

245248
from pymodbus.client import ModbusTcpClient
246249

@@ -289,7 +292,7 @@ solving issues:
289292
There are 2 bigger projects ongoing:
290293

291294
* rewriting the internal part of all clients (both sync and async)
292-
* Add features to and simulator, and enhance the web design
295+
* Add features to the simulator, and enhance the web design
293296

294297

295298
Development instructions
@@ -326,7 +329,7 @@ you can also do extended testing::
326329
Internals
327330
^^^^^^^^^
328331

329-
There are no documentation of the architecture (help is welcome), but most classes and
332+
There is no documentation of the architecture (help is welcome), but most classes and
330333
methods are documented:
331334

332335
`Pymodbus internals <https://pymodbus.readthedocs.io/en/dev/source/internals.html>`_

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Please select a topic in the left hand column.
88
:caption: Contents:
99
:hidden:
1010

11+
source/upgrade_40
1112
source/api_changes
1213
source/client
1314
source/server
@@ -20,6 +21,5 @@ Please select a topic in the left hand column.
2021
source/changelog
2122
source/internals
2223
source/roadmap
23-
source/upgrade_40
2424

2525
.. include:: ../README.rst

doc/source/_static/examples.tgz

-3.68 KB
Binary file not shown.

doc/source/_static/examples.zip

11 Bytes
Binary file not shown.

doc/source/client.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ It is allowed to have multiple client objects that e.g. each communicate with a
1515

1616
Client performance
1717
------------------
18-
There are currently a big performance gap between the 2 clients
19-
(try it on your computer :github:`examples/client_performance.py`).
18+
There are currently a big performance gap between the 2 clients.
19+
2020
This is due to a rather old implementation of the synchronous client, we are currently working to update the client code.
2121
Our aim is to achieve a similar data rate with both clients and at least double the data rate while keeping the stability.
2222
Table below is a test with 1000 calls each reading 10 registers.
@@ -127,12 +127,12 @@ Synchronous example
127127

128128
from pymodbus.client import ModbusTcpClient
129129

130-
client = ModbusTcpClient('MyDevice.lan') # Create client object
131-
client.connect() # connect to device
132-
client.write_coil(1, True, slave=1) # set information in device
133-
result = client.read_coils(2, 3, slave=1) # get information from device
134-
print(result.bits[0]) # use information
135-
client.close() # Disconnect device
130+
client = ModbusTcpClient('MyDevice.lan') # Create client object
131+
client.connect() # connect to device
132+
client.write_coil(1, True, device_id=1) # set information in device
133+
result = client.read_coils(2, 3, device_id=1) # get information from device
134+
print(result.bits[0]) # use information
135+
client.close() # Disconnect device
136136

137137
The line :mod:`client.connect()` connects to the device (or comm port). If this cannot connect successfully within
138138
the timeout it throws an exception. After this initial connection, further
@@ -147,22 +147,22 @@ Asynchronous example
147147

148148
from pymodbus.client import AsyncModbusTcpClient
149149

150-
client = AsyncModbusTcpClient('MyDevice.lan') # Create client object
151-
await client.connect() # connect to device, reconnect automatically
152-
await client.write_coil(1, True, slave=1) # set information in device
153-
result = await client.read_coils(2, 3, slave=1) # get information from device
154-
print(result.bits[0]) # use information
155-
client.close() # Disconnect device
150+
client = AsyncModbusTcpClient('MyDevice.lan') # Create client object
151+
await client.connect() # connect to device, reconnect automatically
152+
await client.write_coil(1, True, device_id=1) # set information in device
153+
result = await client.read_coils(2, 3, device_id=1) # get information from device
154+
print(result.bits[0]) # use information
155+
client.close() # Disconnect device
156156

157157
The line :mod:`client = AsyncModbusTcpClient('MyDevice.lan')` only creates the object; it does not activate
158158
anything.
159159

160160
The line :mod:`await client.connect()` connects to the device (or comm port), if this cannot connect successfully within
161161
the timeout it throws an exception. If connected successfully reconnecting later is handled automatically
162162

163-
The line :mod:`await client.write_coil(1, True, slave=1)` is an example of a write request, set address 1 to True on device 1 (slave).
163+
The line :mod:`await client.write_coil(1, True, device_id=1)` is an example of a write request, set address 1 to True on device 1.
164164

165-
The line :mod:`result = await client.read_coils(2, 3, slave=1)` is an example of a read request, get the value of address 2, 3 and 4 (count = 3) from device 1 (slave).
165+
The line :mod:`result = await client.read_coils(2, 3, device_id=1)` is an example of a read request, get the value of address 2, 3 and 4 (count = 3) from device 1.
166166

167167
The last line :mod:`client.close()` closes the connection and render the object inactive.
168168

@@ -194,13 +194,13 @@ Client device addressing
194194
------------------------
195195

196196
With **TCP**, **TLS** and **UDP**, the tcp/ip address of the physical device is defined when creating the object.
197-
Logical devices represented by the device is addressed with the :mod:`slave=` parameter.
197+
Logical devices represented by the device is addressed with the :mod:`device_id=` parameter.
198198

199199
With **Serial**, the comm port is defined when creating the object.
200-
The physical devices are addressed with the :mod:`slave=` parameter.
200+
The physical devices are addressed with the :mod:`device_id=` parameter.
201201

202-
:mod:`slave=0` is defined as broadcast in the modbus standard, but pymodbus treats it as a normal device.
203-
please note :mod:`slave=0` can only be used to address devices that truly have id=0 ! Using :mod:`slave=0` to
202+
:mod:`device_id=0` is defined as broadcast in the modbus standard, but pymodbus treats it as a normal device.
203+
please note :mod:`device_id=0` can only be used to address devices that truly have id=0 ! Using :mod:`device_id=0` to
204204
address a single device with id not 0 is against the protocol.
205205

206206
If an application is expecting multiple responses to a broadcast request, it must call :mod:`client.execute` and deal with the responses.
@@ -217,7 +217,7 @@ All simple request calls (mixin) return a unified result independent whether it
217217
The application should evaluate the result generically::
218218

219219
try:
220-
rr = await client.read_coils(1, 1, slave=1)
220+
rr = await client.read_coils(1, 1, device_id=1)
221221
except ModbusException as exc:
222222
_logger.error(f"ERROR: exception in pymodbus {exc}")
223223
raise exc

doc/source/examples.rst

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ Source: :github:`examples/simple_sync_client.py`
3131
.. literalinclude:: ../../examples/simple_sync_client.py
3232

3333

34-
Client performance sync vs async
35-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36-
Source: :github:`examples/client_performance.py`
37-
38-
.. literalinclude:: ../../examples/client_performance.py
39-
40-
4134
Advanced examples
4235
-----------------
4336

@@ -88,14 +81,6 @@ Source: :github:`examples/custom_msg.py`
8881
:noindex:
8982

9083

91-
Client payload
92-
^^^^^^^^^^^^^^
93-
Source: :github:`examples/client_payload.py`
94-
95-
.. automodule:: examples.client_payload
96-
:undoc-members:
97-
:noindex:
98-
9984
Client synchronous
10085
^^^^^^^^^^^^^^^^^^
10186
Source: :github:`examples/client_sync.py`
@@ -132,15 +117,6 @@ Source: :github:`examples/server_hook.py`
132117
:noindex:
133118

134119

135-
Server payload
136-
^^^^^^^^^^^^^^
137-
Source: :github:`examples/server_payload.py`
138-
139-
.. automodule:: examples.server_payload
140-
:undoc-members:
141-
:noindex:
142-
143-
144120
Server synchronous
145121
^^^^^^^^^^^^^^^^^^
146122
Source: :github:`examples/server_sync.py`
@@ -186,15 +162,6 @@ Source: :github:`examples/message_parser.py`
186162
:noindex:
187163

188164

189-
Modbus forwarder
190-
^^^^^^^^^^^^^^^^
191-
Source: :github:`examples/modbus_forwarder.py`
192-
193-
.. automodule:: examples.modbus_forwarder
194-
:undoc-members:
195-
:noindex:
196-
197-
198165
Examples contributions
199166
----------------------
200167

0 commit comments

Comments
 (0)