Skip to content

Commit af53830

Browse files
authored
Move repl doc to repl repo. (#2522)
1 parent 1e8c9d9 commit af53830

File tree

5 files changed

+4
-310
lines changed

5 files changed

+4
-310
lines changed

CHANGELOG.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Version 3.8.0
3131
* Add trace API to server. (#2479)
3232
* Add trace API for client. (#2478)
3333
* Integrate TransactionManager in server. (#2475)
34-
* Rename test/sub_. (#2473)
34+
* Rename test/sub. (#2473)
3535
* Check server closes file descriptors. (#2472)
3636
* Update http_server.py (#2471)
3737
* Restrict write_registers etc to list[int]. (#2469)

doc/source/_static/examples.tgz

594 KB
Binary file not shown.

doc/source/_static/examples.zip

0 Bytes
Binary file not shown.

doc/source/repl.rst

+2-305
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
Pymodbus REPL (Read Evaluate Print Loop)
22
=========================================
33

4-
.. raw:: html
4+
Pymodbus provides a simple UI to maniplute server/client, this is handled
5+
by a separate repo `pymodbus-repl <https://github.com/pymodbus-dev/repl>`__
56

6-
<p style="color: red;"><strong>Warning:</strong> The Pymodbus REPL documentation is not updated,
7-
because it lives in a different repo.</p>
8-
9-
Installation
10-
------------
11-
12-
Project repo `pymodbus-repl <https://github.com/pymodbus-dev/repl>`__
137

148
Install as pymodbus optional dependency
159
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -24,300 +18,3 @@ Install directly from the github repo
2418
::
2519

2620
$ pip install "git+https://github.com/pymodbus-dev/repl"
27-
28-
Usage Instructions
29-
------------------
30-
31-
RTU and TCP are supported as of now
32-
33-
::
34-
35-
bash-3.2$ pymodbus.console
36-
Usage: pymodbus.console [OPTIONS] COMMAND [ARGS]...
37-
38-
Options:
39-
--version Show the version and exit.
40-
--verbose Verbose logs
41-
--support-diag Support Diagnostic messages
42-
--help Show this message and exit.
43-
44-
Commands:
45-
serial
46-
tcp
47-
48-
TCP Options
49-
50-
::
51-
52-
bash-3.2$ pymodbus.console tcp --help
53-
Usage: pymodbus.console tcp [OPTIONS]
54-
55-
Options:
56-
--host TEXT Modbus TCP IP
57-
--port INTEGER Modbus TCP port
58-
--help Show this message and exit.
59-
60-
61-
SERIAL Options
62-
63-
::
64-
65-
bash-3.2$ pymodbus.console serial --help
66-
Usage: pymodbus.console serial [OPTIONS]
67-
68-
Options:
69-
--method TEXT Modbus Serial Mode (rtu/ascii)
70-
--port TEXT Modbus RTU port
71-
--baudrate INTEGER Modbus RTU serial baudrate to use.
72-
--bytesize [5|6|7|8] Modbus RTU serial Number of data bits. Possible
73-
values: FIVEBITS, SIXBITS, SEVENBITS, EIGHTBITS.
74-
--parity [N|E|O|M|S] Modbus RTU serial parity. Enable parity checking.
75-
Possible values: PARITY_NONE, PARITY_EVEN, PARITY_ODD
76-
PARITY_MARK, PARITY_SPACE. Default to 'N'
77-
--stopbits [1|1.5|2] Modbus RTU serial stop bits. Number of stop bits.
78-
Possible values: STOPBITS_ONE,
79-
STOPBITS_ONE_POINT_FIVE, STOPBITS_TWO. Default to '1'
80-
--xonxoff INTEGER Modbus RTU serial xonxoff. Enable software flow
81-
control.
82-
--rtscts INTEGER Modbus RTU serial rtscts. Enable hardware (RTS/CTS)
83-
flow control.
84-
--dsrdtr INTEGER Modbus RTU serial dsrdtr. Enable hardware (DSR/DTR)
85-
flow control.
86-
--timeout FLOAT Modbus RTU serial read timeout.
87-
--write-timeout FLOAT Modbus RTU serial write timeout.
88-
--help Show this message and exit.
89-
90-
To view all available commands type ``help``
91-
92-
TCP
93-
94-
::
95-
96-
$ pymodbus.console tcp --host 192.168.128.126 --port 5020
97-
98-
> help
99-
Available commands:
100-
client.change_ascii_input_delimiter Diagnostic sub command, Change message delimiter for future requests.
101-
client.clear_counters Diagnostic sub command, Clear all counters and diag registers.
102-
client.clear_overrun_count Diagnostic sub command, Clear over run counter.
103-
client.close Closes the underlying socket connection
104-
client.connect Connect to the modbus tcp server
105-
client.debug_enabled Returns a boolean indicating if debug is enabled.
106-
client.force_listen_only_mode Diagnostic sub command, Forces the addressed remote device to its Listen Only Mode.
107-
client.get_clear_modbus_plus Diagnostic sub command, Get or clear stats of remote modbus plus device.
108-
client.get_com_event_counter Read status word and an event count from the remote device's communication event counter.
109-
client.get_com_event_log Read status word, event count, message count, and a field of event bytes from the remote device.
110-
client.host Read Only!
111-
client.idle_time Bus Idle Time to initiate next transaction
112-
client.is_socket_open Check whether the underlying socket/serial is open or not.
113-
client.last_frame_end Read Only!
114-
client.mask_write_register Mask content of holding register at `address` with `and_mask` and `or_mask`.
115-
client.port Read Only!
116-
client.read_coils Reads `count` coils from a given slave starting at `address`.
117-
client.read_device_information Read the identification and additional information of remote slave.
118-
client.read_discrete_inputs Reads `count` number of discrete inputs starting at offset `address`.
119-
client.read_exception_status Read the contents of eight Exception Status outputs in a remote device.
120-
client.read_holding_registers Read `count` number of holding registers starting at `address`.
121-
client.read_input_registers Read `count` number of input registers starting at `address`.
122-
client.readwrite_registers Read `read_count` number of holding registers starting at `read_address` and write `write_registers` starting at `write_address`.
123-
client.report_slave_id Report information about remote slave ID.
124-
client.restart_comm_option Diagnostic sub command, initialize and restart remote devices serial interface and clear all of its communications event counters .
125-
client.return_bus_com_error_count Diagnostic sub command, Return count of CRC errors received by remote slave.
126-
client.return_bus_exception_error_count Diagnostic sub command, Return count of Modbus exceptions returned by remote slave.
127-
client.return_bus_message_count Diagnostic sub command, Return count of message detected on bus by remote slave.
128-
client.return_diagnostic_register Diagnostic sub command, Read 16-bit diagnostic register.
129-
client.return_iop_overrun_count Diagnostic sub command, Return count of iop overrun errors by remote slave.
130-
client.return_query_data Diagnostic sub command , Loop back data sent in response.
131-
client.return_slave_bus_char_overrun_count Diagnostic sub command, Return count of messages not handled by remote slave due to character overrun condition.
132-
client.return_slave_busy_count Diagnostic sub command, Return count of server busy exceptions sent by remote slave.
133-
client.return_slave_message_count Diagnostic sub command, Return count of messages addressed to remote slave.
134-
client.return_slave_no_ack_count Diagnostic sub command, Return count of NO ACK exceptions sent by remote slave.
135-
client.return_slave_no_response_count Diagnostic sub command, Return count of No responses by remote slave.
136-
client.silent_interval Read Only!
137-
client.state Read Only!
138-
client.timeout Read Only!
139-
client.write_coil Write `value` to coil at `address`.
140-
client.write_coils Write `value` to coil at `address`.
141-
client.write_register Write `value` to register at `address`.
142-
client.write_registers Write list of `values` to registers starting at `address`.
143-
144-
SERIAL
145-
146-
::
147-
148-
$ pymodbus.console serial --port /dev/ttyUSB0 --baudrate 19200 --timeout 2
149-
> help
150-
Available commands:
151-
client.baudrate Read Only!
152-
client.bytesize Read Only!
153-
client.change_ascii_input_delimiter Diagnostic sub command, Change message delimiter for future requests.
154-
client.clear_counters Diagnostic sub command, Clear all counters and diag registers.
155-
client.clear_overrun_count Diagnostic sub command, Clear over run counter.
156-
client.close Closes the underlying socket connection
157-
client.connect Connect to the modbus serial server
158-
client.debug_enabled Returns a boolean indicating if debug is enabled.
159-
client.force_listen_only_mode Diagnostic sub command, Forces the addressed remote device to its Listen Only Mode.
160-
client.get_baudrate Serial Port baudrate.
161-
client.get_bytesize Number of data bits.
162-
client.get_clear_modbus_plus Diagnostic sub command, Get or clear stats of remote modbus plus device.
163-
client.get_com_event_counter Read status word and an event count from the remote device's communication event counter.
164-
client.get_com_event_log Read status word, event count, message count, and a field of event bytes from the remote device.
165-
client.get_parity Enable Parity Checking.
166-
client.get_port Serial Port.
167-
client.get_serial_settings Gets Current Serial port settings.
168-
client.get_stopbits Number of stop bits.
169-
client.get_timeout Serial Port Read timeout.
170-
client.idle_time Bus Idle Time to initiate next transaction
171-
client.inter_byte_timeout Read Only!
172-
client.is_socket_open c l i e n t . i s s o c k e t o p e n
173-
client.mask_write_register Mask content of holding register at `address` with `and_mask` and `or_mask`.
174-
client.method Read Only!
175-
client.parity Read Only!
176-
client.port Read Only!
177-
client.read_coils Reads `count` coils from a given slave starting at `address`.
178-
client.read_device_information Read the identification and additional information of remote slave.
179-
client.read_discrete_inputs Reads `count` number of discrete inputs starting at offset `address`.
180-
client.read_exception_status Read the contents of eight Exception Status outputs in a remote device.
181-
client.read_holding_registers Read `count` number of holding registers starting at `address`.
182-
client.read_input_registers Read `count` number of input registers starting at `address`.
183-
client.readwrite_registers Read `read_count` number of holding registers starting at `read_address` and write `write_registers` starting at `write_address`.
184-
client.report_slave_id Report information about remote slave ID.
185-
client.restart_comm_option Diagnostic sub command, initialize and restart remote devices serial interface and clear all of its communications event counters .
186-
client.return_bus_com_error_count Diagnostic sub command, Return count of CRC errors received by remote slave.
187-
client.return_bus_exception_error_count Diagnostic sub command, Return count of Modbus exceptions returned by remote slave.
188-
client.return_bus_message_count Diagnostic sub command, Return count of message detected on bus by remote slave.
189-
client.return_diagnostic_register Diagnostic sub command, Read 16-bit diagnostic register.
190-
client.return_iop_overrun_count Diagnostic sub command, Return count of iop overrun errors by remote slave.
191-
client.return_query_data Diagnostic sub command , Loop back data sent in response.
192-
client.return_slave_bus_char_overrun_count Diagnostic sub command, Return count of messages not handled by remote slave due to character overrun condition.
193-
client.return_slave_busy_count Diagnostic sub command, Return count of server busy exceptions sent by remote slave.
194-
client.return_slave_message_count Diagnostic sub command, Return count of messages addressed to remote slave.
195-
client.return_slave_no_ack_count Diagnostic sub command, Return count of NO ACK exceptions sent by remote slave.
196-
client.return_slave_no_response_count Diagnostic sub command, Return count of No responses by remote slave.
197-
client.set_baudrate Baudrate setter.
198-
client.set_bytesize Byte size setter.
199-
client.set_parity Parity Setter.
200-
client.set_port Serial Port setter.
201-
client.set_stopbits Stop bit setter.
202-
client.set_timeout Read timeout setter.
203-
client.silent_interval Read Only!
204-
client.state Read Only!
205-
client.stopbits Read Only!
206-
client.timeout Read Only!
207-
client.write_coil Write `value` to coil at `address`.
208-
client.write_coils Write `value` to coil at `address`.
209-
client.write_register Write `value` to register at `address`.
210-
client.write_registers Write list of `values` to registers starting at `address`.
211-
result.decode Decode the register response to known formatters.
212-
result.raw Return raw result dict.
213-
214-
Every command has auto suggestion on the arguments supported, arg and
215-
value are to be supplied in ``arg=val`` format.
216-
217-
::
218-
219-
220-
> client.read_holding_registers count=4 address=9 slave=1
221-
{
222-
"registers": [
223-
60497,
224-
47134,
225-
34091,
226-
15424
227-
]
228-
}
229-
230-
The last result could be accessed with ``result.raw`` command
231-
232-
::
233-
234-
> result.raw
235-
{
236-
"registers": [
237-
15626,
238-
55203,
239-
28733,
240-
18368
241-
]
242-
}
243-
244-
For Holding and Input register reads, the decoded value could be viewed
245-
with ``result.decode``
246-
247-
::
248-
249-
> result.decode word_order=little byte_order=little formatters=float64
250-
28.17
251-
252-
>
253-
254-
Client settings could be retrieved and altered as well.
255-
256-
::
257-
258-
> # For serial settings
259-
260-
> # Check the serial mode
261-
> client.method
262-
"rtu"
263-
264-
> client.get_serial_settings
265-
{
266-
"t1.5": 0.00171875,
267-
"baudrate": 9600,
268-
"read timeout": 0.5,
269-
"port": "/dev/ptyp0",
270-
"t3.5": 0.00401,
271-
"bytesize": 8,
272-
"parity": "N",
273-
"stopbits": 1.0
274-
}
275-
> client.set_timeout value=1
276-
null
277-
278-
> client.get_timeout
279-
1.0
280-
281-
> client.get_serial_settings
282-
{
283-
"t1.5": 0.00171875,
284-
"baudrate": 9600,
285-
"read timeout": 1.0,
286-
"port": "/dev/ptyp0",
287-
"t3.5": 0.00401,
288-
"bytesize": 8,
289-
"parity": "N",
290-
"stopbits": 1.0
291-
}
292-
293-
Demo
294-
----
295-
296-
.. |asciicast| image:: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o.png
297-
:target: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o
298-
.. |asciicast2| image:: https://asciinema.org/a/edUqZN77fdjxL2toisiilJNwI.png
299-
:target: https://asciinema.org/a/edUqZN77fdjxL2toisiilJNwI
300-
301-
302-
Pymodbus REPL Client
303-
^^^^^^^^^^^^^^^^^^^^
304-
305-
Pymodbus REPL comes with many handy features such as payload decoder
306-
to directly retrieve the values in desired format and supports all
307-
the diagnostic function codes directly .
308-
309-
For more info on REPL Client refer `pymodbus repl client <https://github.com/pymodbus-dev/repl/blob/main/pymodbus/repl/client/README.rst>`__
310-
311-
.. image:: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o.png
312-
:target: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o
313-
314-
315-
Pymodbus REPL Server
316-
^^^^^^^^^^^^^^^^^^^^
317-
318-
Pymodbus also comes with a REPL server to quickly run an asynchronous server with additional capabilities out of the box like simulating errors, delay, mangled messages etc.
319-
320-
For more info on REPL Server refer `pymodbus repl server <https://github.com/pymodbus-dev/repl/blob/main/pymodbus/repl/server/README.rst>`__
321-
322-
.. image:: https://img.youtube.com/vi/OutaVz0JkWg/maxresdefault.jpg
323-
:target: https://youtu.be/OutaVz0JkWg

pymodbus/transaction/transaction.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class TransactionManager(ModbusProtocol):
1616
"""Transaction manager.
1717
1818
This is the central class of the library, providing a separation between API and communication:
19-
2019
- clients/servers calls the manager to execute requests/responses
2120
- transport/framer/pdu is by the manager to communicate with the devices
2221
@@ -29,9 +28,7 @@ class TransactionManager(ModbusProtocol):
2928
Transaction manager offers:
3029
- a simple execute interface for requests (client)
3130
- a simple send interface for responses (server)
32-
- external trace methods tracing:
33-
- outgoing/incoming packets (byte stream)
34-
- outgoing/incoming PDUs
31+
- external trace methods tracing outgoing/incoming packets/PDUs (byte stream)
3532
"""
3633

3734
def __init__(

0 commit comments

Comments
 (0)