Skip to content

Commit b34fa5e

Browse files
committed
Merge branch 'dev'
2 parents dcbcfd7 + a165c7a commit b34fa5e

Some content is hidden

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

88 files changed

+997
-3095
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
- dev
66
- master
77
- wait_next_API
8-
- dev_*
98
tags:
109
- v*
1110
pull_request:
1211
branches:
1312
- dev
13+
- wait_next_api
1414
types: [opened, synchronize, reopened, ready_for_review]
1515
schedule:
1616
# Sunday at 02:10 UTC.

.github/workflows/clean_workflow_runs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Clear cache
25-
uses: actions/github-script@v6
25+
uses: actions/github-script@v7
2626
with:
2727
script: |
2828
console.log("About to clear")

AUTHORS.rst

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Thanks to
1616
- Alexander Lanin
1717
- Alexandre CUER
1818
- Alois Hockenschlohe
19+
- Andy Walker
1920
- Arjan
2021
- André Srinivasan
2122
- andrew-harness
@@ -27,6 +28,7 @@ Thanks to
2728
- Chandler Riehm
2829
- Chris Hung
2930
- Christian Krause
31+
- Daniel Rauber
3032
- dhoomakethu
3133
- doelki
3234
- DominicDataP
@@ -64,6 +66,8 @@ Thanks to
6466
- Logan Gunthorpe
6567
- Marko Luther
6668
- Matthias Straka
69+
- Matthias Urlichs
70+
- Michel F
6771
- Mickaël Schoentgen
6872
- Pavel Kostromitinov
6973
- peufeu2
@@ -77,6 +81,7 @@ Thanks to
7781
- Totally a booplicate
7882
- WouterTuinstra
7983
- wriswith
84+
- Yash Jani
8085
- Yohrog
8186
- yyokusa
8287

CHANGELOG.rst

+38
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,44 @@ 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.7.3
11+
-------------
12+
* 100% test coverage of framers (#2359)
13+
* Framer, final touches. (#2360)
14+
* Readme file renamed (#2357)
15+
* Remove old framers (#2358)
16+
* frameProcessIncomingPacket removed (#2355)
17+
* Cleanup framers (reduce old_framers) (#2342)
18+
* Run CI on PR targeted at wait_next_api.
19+
* Sync client, allow unknown recv msg size. (#2353)
20+
* integrate old rtu framer in new framer (#2344)
21+
* Update README.rst (#2351)
22+
* Client.close should not allow reconnect= (#2347)
23+
* Remove async client.idle_time(). (#2349)
24+
* Client doc, add common methods (base). (#2348)
25+
* Reset receive buffer with send(). (#2343)
26+
* Remove unused protocol_id from pdu (#2340)
27+
* CI run on demand on non-protected branches. (#2339)
28+
* Server listener and client connections have is_server set. (#2338)
29+
* Reopen listener in server if disconnected. (#2337)
30+
* Regroup test. (#2335)
31+
* Improve docs around sync clients and reconnection (#2321)
32+
* transport 100% test coverage (again) (#2333)
33+
* Update actions to new node.js. (#2332)
34+
* Bump 3rd party (#2331)
35+
* Documentation on_connect_callback (#2324)
36+
* Fixes the unexpected implementation of the ModbusSerialClient.connected property (#2327)
37+
* Forward error responses instead of timing out. (#2329)
38+
* Add `stacklevel=2` to logging functions (#2330)
39+
* Fix encoding & decoding of ReadFileRecordResponse (#2319)
40+
* Improvements for example/contib/solar (#2318)
41+
* Update solar.py (#2316)
42+
* Remove double conversion in int (#2315)
43+
* Complete pull request #2310 (#2312)
44+
* fixed type hints for write_register and write_registers (#2309)
45+
* Remove _header from framers. (#2305)
46+
47+
1048
Version 3.7.2
1149
-------------
1250
* Correct README

MAKE_RELEASE.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Prepare/make release on dev.
1414
* Control / Update API_changes.rst
1515
* Update CHANGELOG.rst
1616
* Add commits from last release, but selectively !
17-
git log --oneline v3.7.0..HEAD > commit.log
18-
git log --pretty="%an" v3.7.0..HEAD | sort -uf > authors.log
17+
git log --oneline v3.7.3..HEAD > commit.log
18+
git log --pretty="%an" v3.7.3..HEAD | sort -uf > authors.log
1919
update AUTHORS.rst and CHANGELOG.rst
2020
cd doc; ./build_html
2121
* rm -rf build/* dist/*
@@ -58,4 +58,4 @@ Architecture documentation.
5858
------------------------------------------------------------
5959
* install graphviz
6060
* pyreverse -k -o jpg pymodbus
61-
l
61+
l

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Upgrade examples:
2323
- 3.6.1 -> 3.7.0: Smaller changes to the pymodbus calls might be needed
2424
- 2.5.4 -> 3.0.0: Major changes in the application might be needed
2525

26-
Current release is `3.7.2 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.7.2>`_.
26+
Current release is `3.7.3 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.7.3>`_.
2727

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

@@ -84,7 +84,7 @@ Server Features
8484
* callback to intercept requests/responses
8585
* work on RS485 in parallel with other devices
8686

87-
`Server documentation <https://pymodbus.readthedocs.io/en/latest/source/library/server.html>`_
87+
`Server documentation <https://pymodbus.readthedocs.io/en/latest/source/server.html>`_
8888

8989

9090
REPL Features
File renamed without changes.

doc/source/_static/examples.tgz

3.53 KB
Binary file not shown.

doc/source/_static/examples.zip

-66 Bytes
Binary file not shown.

doc/source/client.rst

+36-6
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ Pymodbus offers clients with transport different protocols and different framers
5555
- ASCII
5656
- RTU
5757
- RTU_OVER_TCP
58-
- Socket
58+
- SOCKET
5959
- TLS
60-
* - Serial (RS-485)
60+
* - SERIAL (RS-485)
6161
- Yes
6262
- Yes
6363
- No
@@ -118,19 +118,32 @@ that a device have received the packet.
118118
Client usage
119119
------------
120120
Using pymodbus client to set/get information from a device (server)
121-
is done in a few simple steps, like the following synchronous example::
121+
is done in a few simple steps.
122+
123+
Synchronous example
124+
^^^^^^^^^^^^^^^^^^^
125+
126+
::
122127

123128
from pymodbus.client import ModbusTcpClient
124129

125130
client = ModbusTcpClient('MyDevice.lan') # Create client object
126-
client.connect() # connect to device, reconnect automatically
131+
client.connect() # connect to device
127132
client.write_coil(1, True, slave=1) # set information in device
128133
result = client.read_coils(2, 3, slave=1) # get information from device
129134
print(result.bits[0]) # use information
130135
client.close() # Disconnect device
131136

137+
The line :mod:`client.connect()` connects to the device (or comm port). If this cannot connect successfully within
138+
the timeout it throws an exception. After this initial connection, further
139+
calls to the same client (here, :mod:`client.write_coil(...)` and
140+
:mod:`client.read_coils(...)` ) will check whether the client is still
141+
connected, and automatically reconnect if not.
132142

133-
and a asynchronous example::
143+
Asynchronous example
144+
^^^^^^^^^^^^^^^^^^^^
145+
146+
::
134147

135148
from pymodbus.client import AsyncModbusTcpClient
136149

@@ -141,7 +154,7 @@ and a asynchronous example::
141154
print(result.bits[0]) # use information
142155
client.close() # Disconnect device
143156

144-
The line :mod:`client = AsyncModbusTcpClient('MyDevice.lan')` only creates the object it does not activate
157+
The line :mod:`client = AsyncModbusTcpClient('MyDevice.lan')` only creates the object; it does not activate
145158
anything.
146159

147160
The line :mod:`await client.connect()` connects to the device (or comm port), if this cannot connect successfully within
@@ -153,6 +166,9 @@ The line :mod:`result = await client.read_coils(2, 3, slave=1)` is an example of
153166

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

169+
Development notes
170+
^^^^^^^^^^^^^^^^^
171+
156172
Large parts of the implementation are shared between the different classes,
157173
to ensure high stability and efficient maintenance.
158174

@@ -232,6 +248,20 @@ There are a client class for each type of communication and for asynchronous/syn
232248
- :mod:`AsyncModbusUdpClient`
233249
- :mod:`ModbusUdpClient`
234250

251+
Client common
252+
^^^^^^^^^^^^^
253+
Some methods are common to all client:
254+
255+
.. autoclass:: pymodbus.client.base.ModbusBaseClient
256+
:members:
257+
:member-order: bysource
258+
:show-inheritance:
259+
260+
.. autoclass:: pymodbus.client.base.ModbusBaseSyncClient
261+
:members:
262+
:member-order: bysource
263+
:show-inheritance:
264+
235265
Client serial
236266
^^^^^^^^^^^^^
237267
.. autoclass:: pymodbus.client.AsyncModbusSerialClient

doc/source/library/framer.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
Framer
22
======
33

4-
pymodbus\.framer\.ModbusAsciiFramer module
4+
pymodbus\.framer\.FramerAscii module
55
------------------------------------------
66

7-
.. automodule:: pymodbus.framer.ModbusAsciiFramer
7+
.. automodule:: pymodbus.framer.FramerAscii
88
:members:
99
:undoc-members:
1010
:show-inheritance:
1111

12-
pymodbus\.framer\.ModbusRtuFramer module
12+
pymodbus\.framer\.FramerRTU module
1313
----------------------------------------
1414

15-
.. automodule:: pymodbus.framer.ModbusRtuFramer
15+
.. automodule:: pymodbus.framer.FramerRTU
1616
:members:
1717
:undoc-members:
1818
:show-inheritance:
1919

20-
pymodbus\.framer\.ModbusSocketFramer module
20+
pymodbus\.framer\.FramerSocket module
2121
-------------------------------------------
2222

23-
.. automodule:: pymodbus.framer.ModbusSocketFramer
23+
.. automodule:: pymodbus.framer.FramerSocket
2424
:members:
2525
:undoc-members:
2626
:show-inheritance:
2727

28-
pymodbus\.framer\.ModbusTlsFramer module
28+
pymodbus\.framer\.FramerTLS module
2929
----------------------------------------
3030

31-
.. automodule:: pymodbus.framer.ModbusTlsFramer
31+
.. automodule:: pymodbus.framer.FramerTLS
3232
:members:
3333
:undoc-members:
3434
:show-inheritance:

doc/source/library/simulator/config.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ The entry “comm” allows the following values:
6363

6464
The entry “framer” allows the following values:
6565

66-
- “ascii” to use :class:`pymodbus.framer.ModbusAsciiFramer`,
67-
- “rtu” to use :class:`pymodbus.framer.ModbusRtuFramer`,
68-
- “tls” to use :class:`pymodbus.framer.ModbusTlsFramer`,
69-
- “socket” to use :class:`pymodbus.framer.ModbusSocketFramer`.
66+
- “ascii” to use :class:`pymodbus.framer.FramerAscii`,
67+
- “rtu” to use :class:`pymodbus.framer.FramerRTU`,
68+
- “socket” to use :class:`pymodbus.framer.FramerSocket`.
69+
- “tls” to use :class:`pymodbus.framer.FramerTLS`,
7070

7171
Optional entry "device_id" will limit server to only accept a single id. If
7272
not set, the server will accept all device id.

examples/client_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def setup_async_client(description=None, cmdline=None):
8181
client = modbusClient.AsyncModbusSerialClient(
8282
args.port,
8383
# Common optional parameters:
84-
# framer=ModbusRtuFramer,
84+
# framer=FramerType.RTU,
8585
timeout=args.timeout,
8686
# retries=3,
8787
# Serial setup parameters

examples/client_custom_msg.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class CustomModbusResponse(ModbusResponse):
3636
function_code = 55
3737
_rtu_byte_count_pos = 2
3838

39-
def __init__(self, values=None, slave=1, transaction=0, protocol=0, skip_encode=False):
39+
def __init__(self, values=None, slave=1, transaction=0, skip_encode=False):
4040
"""Initialize."""
41-
ModbusResponse.__init__(self, slave, transaction, protocol, skip_encode)
41+
ModbusResponse.__init__(self, slave, transaction, skip_encode)
4242
self.values = values or []
4343

4444
def encode(self):
@@ -68,9 +68,9 @@ class CustomModbusRequest(ModbusRequest):
6868
function_code = 55
6969
_rtu_frame_size = 8
7070

71-
def __init__(self, address=None, slave=1, transaction=0, protocol=0, skip_encode=False):
71+
def __init__(self, address=None, slave=1, transaction=0, skip_encode=False):
7272
"""Initialize."""
73-
ModbusRequest.__init__(self, slave, transaction, protocol, skip_encode)
73+
ModbusRequest.__init__(self, slave, transaction, skip_encode)
7474
self.address = address
7575
self.count = 16
7676

@@ -100,12 +100,12 @@ def execute(self, context):
100100
class Read16CoilsRequest(ReadCoilsRequest):
101101
"""Read 16 coils in one request."""
102102

103-
def __init__(self, address, count=None, slave=1, transaction=0, protocol=0, skip_encode=False):
103+
def __init__(self, address, count=None, slave=1, transaction=0, skip_encode=False):
104104
"""Initialize a new instance.
105105
106106
:param address: The address to start reading from
107107
"""
108-
ReadCoilsRequest.__init__(self, address, count=16, slave=slave, transaction=transaction, protocol=protocol, skip_encode=skip_encode)
108+
ReadCoilsRequest.__init__(self, address, count=16, slave=slave, transaction=transaction, skip_encode=skip_encode)
109109

110110

111111
# --------------------------------------------------------------------------- #

examples/client_sync.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def setup_sync_client(description=None, cmdline=None):
8585
client = modbusClient.ModbusSerialClient(
8686
port=args.port, # serial port
8787
# Common optional parameters:
88-
# framer=ModbusRtuFramer,
88+
# framer=FramerType.RTU,
8989
timeout=args.timeout,
9090
# retries=3,
9191
# Serial setup parameters

0 commit comments

Comments
 (0)