Skip to content

Commit b63e96f

Browse files
committed
Rename repl command rtu to serial . Update README
1 parent 2ef0e5d commit b63e96f

File tree

6 files changed

+188
-96
lines changed

6 files changed

+188
-96
lines changed

doc/source/library/REPL.md

Lines changed: 80 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Options:
2828
--help Show this message and exit.
2929
3030
Commands:
31-
rtu
31+
serial
3232
tcp
3333
3434
@@ -50,8 +50,8 @@ Options:
5050

5151
RTU Options
5252
```
53-
bash-3.2$ pymodbus.console rtu --help
54-
Usage: pymodbus.console rtu [OPTIONS]
53+
bash-3.2$ pymodbus.console serial --help
54+
Usage: pymodbus.console serial [OPTIONS]
5555
5656
Options:
5757
--method TEXT Modbus Serial Mode (rtu/ascii)
@@ -84,40 +84,49 @@ $ pymodbus.console tcp --host 192.168.128.126 --port 5020
8484
8585
> help
8686
Available commands:
87-
client.change_ascii_input_delimiter Diagnostic sub command, Change message delimiter for future requests
88-
client.clear_counters Diagnostic sub command, Clear all counters and diag registers
89-
client.clear_overrun_count Diagnostic sub command, Clear over run counter
90-
client.force_listen_only_mode Diagnostic sub command, Forces the addressed remote device to its Listen Only Mode
91-
client.get_clear_modbus_plus Diagnostic sub command, Get or clear stats of remote modbus plus device
92-
client.get_com_event_counter Read status word and an event count from the remote device's communication event counter
87+
client.change_ascii_input_delimiter Diagnostic sub command, Change message delimiter for future requests.
88+
client.clear_counters Diagnostic sub command, Clear all counters and diag registers.
89+
client.clear_overrun_count Diagnostic sub command, Clear over run counter.
90+
client.close Closes the underlying socket connection
91+
client.connect Connect to the modbus tcp server
92+
client.debug_enabled Returns a boolean indicating if debug is enabled.
93+
client.force_listen_only_mode Diagnostic sub command, Forces the addressed remote device to its Listen Only Mode.
94+
client.get_clear_modbus_plus Diagnostic sub command, Get or clear stats of remote modbus plus device.
95+
client.get_com_event_counter Read status word and an event count from the remote device's communication event counter.
9396
client.get_com_event_log Read status word, event count, message count, and a field of event bytes from the remote device.
94-
client.mask_write_register Mask content of holding register at `address` with `and_mask` and `or_mask`
95-
client.read_coils Reads `count` coils from a given slave starting at `address`
96-
client.read_device_information Read the identification and additional information of remote slave
97-
client.read_discrete_inputs Reads `count` number of discrete inputs starting at offset `address`
98-
client.read_exception_status Read the contents of eight Exception Status outputs in a remote device.
99-
client.read_holding_registers Read `count` number of holding registers starting at `address`
100-
client.read_input_registers Read `count` number of input registers starting at `address`
101-
client.readwrite_registers Read `read_count` number of holding registers starting at `read_address` and write `write_registers` starting at `write_address`
102-
client.report_slave_id Report information about remote slave ID
103-
client.restart_comm_option Diagnostic sub command, initialize and restart remote devices serial interface and clear all of its communications event counters .
104-
client.return_bus_com_error_count Diagnostic sub command, Return count of CRC errors received by remote slave
105-
client.return_bus_exception_error_count Diagnostic sub command, Return count of Modbus exceptions returned by remote slave
106-
client.return_bus_message_count Diagnostic sub command, Return count of message detected on bus by remote slave
107-
client.return_diagnostic_register Diagnostic sub command, Read 16-bit diagnostic register
108-
client.return_iop_overrun_count Diagnostic sub command, Return count of iop overrun errors by remote slave
109-
client.return_query_data Diagnostic sub command , Loop back data sent in response
110-
client.return_slave_bus_char_overrun_count Diagnostic sub command, Return count of messages not handled by remote slave due to character overrun condition
111-
client.return_slave_busy_count Diagnostic sub command, Return count of server busy exceptions sent by remote slave
112-
client.return_slave_message_count Diagnostic sub command, Return count of messages addressed to remote slave
113-
client.return_slave_no_ack_count Diagnostic sub command, Return count of NO ACK exceptions sent by remote slave
114-
client.return_slave_no_response_count Diagnostic sub command, Return count of No responses by remote slave
115-
client.write_coil Write `value` to coil at `address`
116-
client.write_coils Write `value` to coil at `address`
117-
client.write_register Write `value` to register at `address`
118-
client.write_registers Write list of `values` to registers starting at `address`
119-
result.decode Decode the register response to known formatters
120-
result.raw Return raw result dict
97+
client.host Read Only!
98+
client.idle_time Bus Idle Time to initiate next transaction
99+
client.is_socket_open Check whether the underlying socket/serial is open or not.
100+
client.last_frame_end Read Only!
101+
client.mask_write_register Mask content of holding register at `address` with `and_mask` and `or_mask`.
102+
client.port Read Only!
103+
client.read_coils Reads `count` coils from a given slave starting at `address`.
104+
client.read_device_information Read the identification and additional information of remote slave.
105+
client.read_discrete_inputs Reads `count` number of discrete inputs starting at offset `address`.
106+
client.read_exception_status Read the contents of eight Exception Status outputs in a remote device.
107+
client.read_holding_registers Read `count` number of holding registers starting at `address`.
108+
client.read_input_registers Read `count` number of input registers starting at `address`.
109+
client.readwrite_registers Read `read_count` number of holding registers starting at `read_address` and write `write_registers` starting at `write_address`.
110+
client.report_slave_id Report information about remote slave ID.
111+
client.restart_comm_option Diagnostic sub command, initialize and restart remote devices serial interface and clear all of its communications event counters .
112+
client.return_bus_com_error_count Diagnostic sub command, Return count of CRC errors received by remote slave.
113+
client.return_bus_exception_error_count Diagnostic sub command, Return count of Modbus exceptions returned by remote slave.
114+
client.return_bus_message_count Diagnostic sub command, Return count of message detected on bus by remote slave.
115+
client.return_diagnostic_register Diagnostic sub command, Read 16-bit diagnostic register.
116+
client.return_iop_overrun_count Diagnostic sub command, Return count of iop overrun errors by remote slave.
117+
client.return_query_data Diagnostic sub command , Loop back data sent in response.
118+
client.return_slave_bus_char_overrun_count Diagnostic sub command, Return count of messages not handled by remote slave due to character overrun condition.
119+
client.return_slave_busy_count Diagnostic sub command, Return count of server busy exceptions sent by remote slave.
120+
client.return_slave_message_count Diagnostic sub command, Return count of messages addressed to remote slave.
121+
client.return_slave_no_ack_count Diagnostic sub command, Return count of NO ACK exceptions sent by remote slave.
122+
client.return_slave_no_response_count Diagnostic sub command, Return count of No responses by remote slave.
123+
client.silent_interval Read Only!
124+
client.state Read Only!
125+
client.timeout Read Only!
126+
client.write_coil Write `value` to coil at `address`.
127+
client.write_coils Write `value` to coil at `address`.
128+
client.write_register Write `value` to register at `address`.
129+
client.write_registers Write list of `values` to registers starting at `address`.
121130
```
122131

123132
Every command has auto suggetion on the arguments supported , supply arg and value are to be supplied in `arg=val` format.
@@ -155,7 +164,41 @@ For Holding and Input register reads, the decoded value could be viewed with `re
155164
>
156165
```
157166

158-
## DEMO
167+
Client settings could be retrived and altered as well.
168+
```
169+
> # For serial settings
170+
> client.get_serial_settings
171+
{
172+
"t1.5": 0.00171875,
173+
"baudrate": 9600,
174+
"read timeout": 0.5,
175+
"port": "/dev/ptyp0",
176+
"t3.5": 0.00401,
177+
"bytesize": 8,
178+
"parity": "N",
179+
"stopbits": 1.0
180+
}
181+
> client.set_timeout value=1
182+
null
183+
184+
> client.get_timeout
185+
1.0
186+
187+
> client.get_serial_settings
188+
{
189+
"t1.5": 0.00171875,
190+
"baudrate": 9600,
191+
"read timeout": 1.0,
192+
"port": "/dev/ptyp0",
193+
"t3.5": 0.00401,
194+
"bytesize": 8,
195+
"parity": "N",
196+
"stopbits": 1.0
197+
}
198+
199+
```
200+
201+
#DEMO
159202

160203
[![asciicast](https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o.png)](https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o)
161204

pymodbus/repl/README.md

Lines changed: 79 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Options:
2828
--help Show this message and exit.
2929
3030
Commands:
31-
rtu
31+
serial
3232
tcp
3333
3434
@@ -50,8 +50,8 @@ Options:
5050

5151
RTU Options
5252
```
53-
bash-3.2$ pymodbus.console rtu --help
54-
Usage: pymodbus.console rtu [OPTIONS]
53+
bash-3.2$ pymodbus.console serial --help
54+
Usage: pymodbus.console serial [OPTIONS]
5555
5656
Options:
5757
--method TEXT Modbus Serial Mode (rtu/ascii)
@@ -84,40 +84,49 @@ $ pymodbus.console tcp --host 192.168.128.126 --port 5020
8484
8585
> help
8686
Available commands:
87-
client.change_ascii_input_delimiter Diagnostic sub command, Change message delimiter for future requests
88-
client.clear_counters Diagnostic sub command, Clear all counters and diag registers
89-
client.clear_overrun_count Diagnostic sub command, Clear over run counter
90-
client.force_listen_only_mode Diagnostic sub command, Forces the addressed remote device to its Listen Only Mode
91-
client.get_clear_modbus_plus Diagnostic sub command, Get or clear stats of remote modbus plus device
92-
client.get_com_event_counter Read status word and an event count from the remote device's communication event counter
87+
client.change_ascii_input_delimiter Diagnostic sub command, Change message delimiter for future requests.
88+
client.clear_counters Diagnostic sub command, Clear all counters and diag registers.
89+
client.clear_overrun_count Diagnostic sub command, Clear over run counter.
90+
client.close Closes the underlying socket connection
91+
client.connect Connect to the modbus tcp server
92+
client.debug_enabled Returns a boolean indicating if debug is enabled.
93+
client.force_listen_only_mode Diagnostic sub command, Forces the addressed remote device to its Listen Only Mode.
94+
client.get_clear_modbus_plus Diagnostic sub command, Get or clear stats of remote modbus plus device.
95+
client.get_com_event_counter Read status word and an event count from the remote device's communication event counter.
9396
client.get_com_event_log Read status word, event count, message count, and a field of event bytes from the remote device.
94-
client.mask_write_register Mask content of holding register at `address` with `and_mask` and `or_mask`
95-
client.read_coils Reads `count` coils from a given slave starting at `address`
96-
client.read_device_information Read the identification and additional information of remote slave
97-
client.read_discrete_inputs Reads `count` number of discrete inputs starting at offset `address`
98-
client.read_exception_status Read the contents of eight Exception Status outputs in a remote device.
99-
client.read_holding_registers Read `count` number of holding registers starting at `address`
100-
client.read_input_registers Read `count` number of input registers starting at `address`
101-
client.readwrite_registers Read `read_count` number of holding registers starting at `read_address` and write `write_registers` starting at `write_address`
102-
client.report_slave_id Report information about remote slave ID
103-
client.restart_comm_option Diagnostic sub command, initialize and restart remote devices serial interface and clear all of its communications event counters .
104-
client.return_bus_com_error_count Diagnostic sub command, Return count of CRC errors received by remote slave
105-
client.return_bus_exception_error_count Diagnostic sub command, Return count of Modbus exceptions returned by remote slave
106-
client.return_bus_message_count Diagnostic sub command, Return count of message detected on bus by remote slave
107-
client.return_diagnostic_register Diagnostic sub command, Read 16-bit diagnostic register
108-
client.return_iop_overrun_count Diagnostic sub command, Return count of iop overrun errors by remote slave
109-
client.return_query_data Diagnostic sub command , Loop back data sent in response
110-
client.return_slave_bus_char_overrun_count Diagnostic sub command, Return count of messages not handled by remote slave due to character overrun condition
111-
client.return_slave_busy_count Diagnostic sub command, Return count of server busy exceptions sent by remote slave
112-
client.return_slave_message_count Diagnostic sub command, Return count of messages addressed to remote slave
113-
client.return_slave_no_ack_count Diagnostic sub command, Return count of NO ACK exceptions sent by remote slave
114-
client.return_slave_no_response_count Diagnostic sub command, Return count of No responses by remote slave
115-
client.write_coil Write `value` to coil at `address`
116-
client.write_coils Write `value` to coil at `address`
117-
client.write_register Write `value` to register at `address`
118-
client.write_registers Write list of `values` to registers starting at `address`
119-
result.decode Decode the register response to known formatters
120-
result.raw Return raw result dict
97+
client.host Read Only!
98+
client.idle_time Bus Idle Time to initiate next transaction
99+
client.is_socket_open Check whether the underlying socket/serial is open or not.
100+
client.last_frame_end Read Only!
101+
client.mask_write_register Mask content of holding register at `address` with `and_mask` and `or_mask`.
102+
client.port Read Only!
103+
client.read_coils Reads `count` coils from a given slave starting at `address`.
104+
client.read_device_information Read the identification and additional information of remote slave.
105+
client.read_discrete_inputs Reads `count` number of discrete inputs starting at offset `address`.
106+
client.read_exception_status Read the contents of eight Exception Status outputs in a remote device.
107+
client.read_holding_registers Read `count` number of holding registers starting at `address`.
108+
client.read_input_registers Read `count` number of input registers starting at `address`.
109+
client.readwrite_registers Read `read_count` number of holding registers starting at `read_address` and write `write_registers` starting at `write_address`.
110+
client.report_slave_id Report information about remote slave ID.
111+
client.restart_comm_option Diagnostic sub command, initialize and restart remote devices serial interface and clear all of its communications event counters .
112+
client.return_bus_com_error_count Diagnostic sub command, Return count of CRC errors received by remote slave.
113+
client.return_bus_exception_error_count Diagnostic sub command, Return count of Modbus exceptions returned by remote slave.
114+
client.return_bus_message_count Diagnostic sub command, Return count of message detected on bus by remote slave.
115+
client.return_diagnostic_register Diagnostic sub command, Read 16-bit diagnostic register.
116+
client.return_iop_overrun_count Diagnostic sub command, Return count of iop overrun errors by remote slave.
117+
client.return_query_data Diagnostic sub command , Loop back data sent in response.
118+
client.return_slave_bus_char_overrun_count Diagnostic sub command, Return count of messages not handled by remote slave due to character overrun condition.
119+
client.return_slave_busy_count Diagnostic sub command, Return count of server busy exceptions sent by remote slave.
120+
client.return_slave_message_count Diagnostic sub command, Return count of messages addressed to remote slave.
121+
client.return_slave_no_ack_count Diagnostic sub command, Return count of NO ACK exceptions sent by remote slave.
122+
client.return_slave_no_response_count Diagnostic sub command, Return count of No responses by remote slave.
123+
client.silent_interval Read Only!
124+
client.state Read Only!
125+
client.timeout Read Only!
126+
client.write_coil Write `value` to coil at `address`.
127+
client.write_coils Write `value` to coil at `address`.
128+
client.write_register Write `value` to register at `address`.
129+
client.write_registers Write list of `values` to registers starting at `address`.
121130
```
122131

123132
Every command has auto suggetion on the arguments supported , supply arg and value are to be supplied in `arg=val` format.
@@ -155,6 +164,40 @@ For Holding and Input register reads, the decoded value could be viewed with `re
155164
>
156165
```
157166

167+
Client settings could be retrived and altered as well.
168+
```
169+
> # For serial settings
170+
> client.get_serial_settings
171+
{
172+
"t1.5": 0.00171875,
173+
"baudrate": 9600,
174+
"read timeout": 0.5,
175+
"port": "/dev/ptyp0",
176+
"t3.5": 0.00401,
177+
"bytesize": 8,
178+
"parity": "N",
179+
"stopbits": 1.0
180+
}
181+
> client.set_timeout value=1
182+
null
183+
184+
> client.get_timeout
185+
1.0
186+
187+
> client.get_serial_settings
188+
{
189+
"t1.5": 0.00171875,
190+
"baudrate": 9600,
191+
"read timeout": 1.0,
192+
"port": "/dev/ptyp0",
193+
"t3.5": 0.00401,
194+
"bytesize": 8,
195+
"parity": "N",
196+
"stopbits": 1.0
197+
}
198+
199+
```
200+
158201
#DEMO
159202

160203
[![asciicast](https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o.png)](https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o)

0 commit comments

Comments
 (0)