pymodbus.repl package

Pymodbus REPL Module.

Copyright (c) 2018 Riptide IO, Inc. All Rights Reserved.

Submodules

pymodbus.repl.client module

Modbus Clients to be used with REPL.

Copyright (c) 2018 Riptide IO, Inc. All Rights Reserved.

class pymodbus.repl.client.ExtendedRequestSupport

Bases: object

change_ascii_input_delimiter(data=0, **kwargs)

Diagnostic sub command, Change message delimiter for future requests.

Parameters:
  • data – New delimiter character
  • unit – The slave unit this request is targeting
Returns:

clear_counters(data=0, **kwargs)

Diagnostic sub command, Clear all counters and diag registers.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

clear_overrun_count(data=0, **kwargs)

Diagnostic sub command, Clear over run counter.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

force_listen_only_mode(data=0, **kwargs)

Diagnostic sub command, Forces the addressed remote device to its Listen Only Mode.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

get_clear_modbus_plus(data=0, **kwargs)

Diagnostic sub command, Get or clear stats of remote modbus plus device.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

get_com_event_counter(**kwargs)

Read status word and an event count from the remote device’s communication event counter.

Parameters:unit – The slave unit this request is targeting
Returns:
get_com_event_log(**kwargs)

Read status word, event count, message count, and a field of event bytes from the remote device.

Parameters:unit – The slave unit this request is targeting
Returns:
mask_write_register(address=0, and_mask=65535, or_mask=0, **kwargs)

Mask content of holding register at address with and_mask and or_mask.

Parameters:
  • address – Reference address of register
  • and_mask – And Mask
  • or_mask – OR Mask
  • unit – The slave unit this request is targeting
Returns:

read_coils(address, count=1, **kwargs)

Reads count coils from a given slave starting at address.

Parameters:
  • address – The starting address to read from
  • count – The number of coils to read
  • unit – The slave unit this request is targeting
Returns:

List of register values

read_device_information(read_code=None, object_id=0, **kwargs)

Read the identification and additional information of remote slave.

Parameters:
  • read_code – Read Device ID code (0x01/0x02/0x03/0x04)
  • object_id – Identification of the first object to obtain.
  • unit – The slave unit this request is targeting
Returns:

read_discrete_inputs(address, count=1, **kwargs)

Reads count number of discrete inputs starting at offset address.

Parameters:
  • address – The starting address to read from
  • count – The number of coils to read
  • unit – The slave unit this request is targeting
Returns:

List of bits

read_exception_status(**kwargs)
Read the contents of eight Exception Status outputs in a remote device.
Parameters:unit – The slave unit this request is targeting
Returns:
read_holding_registers(address, count=1, **kwargs)

Read count number of holding registers starting at address.

Parameters:
  • address – starting register offset to read from
  • count – Number of registers to read
  • unit – The slave unit this request is targeting
Returns:

read_input_registers(address, count=1, **kwargs)

Read count number of input registers starting at address.

Parameters:
  • address – starting register offset to read from to
  • count – Number of registers to read
  • unit – The slave unit this request is targeting
Returns:

readwrite_registers(read_address, read_count, write_address, write_registers, **kwargs)

Read read_count number of holding registers starting at read_address and write write_registers starting at write_address.

Parameters:
  • read_address – register offset to read from
  • read_count – Number of registers to read
  • write_address – register offset to write to
  • write_registers – List of register values to write (comma seperated)
  • unit – The slave unit this request is targeting
Returns:

report_slave_id(**kwargs)

Report information about remote slave ID.

Parameters:unit – The slave unit this request is targeting
Returns:
restart_comm_option(toggle=False, **kwargs)

Diagnostic sub command, initialize and restart remote devices serial interface and clear all of its communications event counters .

Parameters:
  • toggle – Toggle Status [ON(0xff00)/OFF(0x0000]
  • unit – The slave unit this request is targeting
Returns:

return_bus_com_error_count(data=0, **kwargs)

Diagnostic sub command, Return count of CRC errors received by remote slave.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_bus_exception_error_count(data=0, **kwargs)

Diagnostic sub command, Return count of Modbus exceptions returned by remote slave.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_bus_message_count(data=0, **kwargs)

Diagnostic sub command, Return count of message detected on bus by remote slave.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_diagnostic_register(data=0, **kwargs)

Diagnostic sub command, Read 16-bit diagnostic register.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_iop_overrun_count(data=0, **kwargs)

Diagnostic sub command, Return count of iop overrun errors by remote slave.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_query_data(message=0, **kwargs)

Diagnostic sub command , Loop back data sent in response.

Parameters:
  • message – Message to be looped back
  • unit – The slave unit this request is targeting
Returns:

return_slave_bus_char_overrun_count(data=0, **kwargs)

Diagnostic sub command, Return count of messages not handled by remote slave due to character overrun condition.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_slave_busy_count(data=0, **kwargs)

Diagnostic sub command, Return count of server busy exceptions sent by remote slave.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_slave_message_count(data=0, **kwargs)

Diagnostic sub command, Return count of messages addressed to remote slave.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_slave_no_ack_count(data=0, **kwargs)

Diagnostic sub command, Return count of NO ACK exceptions sent by remote slave.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

return_slave_no_response_count(data=0, **kwargs)

Diagnostic sub command, Return count of No responses by remote slave.

Parameters:
  • data – Data field (0x0000)
  • unit – The slave unit this request is targeting
Returns:

write_coil(address, value, **kwargs)

Write value to coil at address.

Parameters:
  • address – coil offset to write to
  • value – bit value to write
  • unit – The slave unit this request is targeting
Returns:

write_coils(address, values, **kwargs)

Write value to coil at address.

Parameters:
  • address – coil offset to write to
  • value – list of bit values to write (comma seperated)
  • unit – The slave unit this request is targeting
Returns:

write_register(address, value, **kwargs)

Write value to register at address.

Parameters:
  • address – register offset to write to
  • value – register value to write
  • unit – The slave unit this request is targeting
Returns:

write_registers(address, values, **kwargs)

Write list of values to registers starting at address.

Parameters:
  • address – register offset to write to
  • value – list of register value to write (comma seperated)
  • unit – The slave unit this request is targeting
Returns:

class pymodbus.repl.client.ModbusSerialClient(method, **kwargs)

Bases: pymodbus.repl.client.ExtendedRequestSupport, pymodbus.client.sync.ModbusSerialClient

get_baudrate()

Serial Port baudrate.

Returns:Current baudrate
get_bytesize()

Number of data bits.

Returns:Current bytesize
get_parity()

Enable Parity Checking.

Returns:Current parity setting
get_port()

Serial Port.

Returns:Current Serial port
get_serial_settings()

Gets Current Serial port settings.

Returns:Current Serial settings as dict.
get_stopbits()

Number of stop bits.

Returns:Current Stop bits
get_timeout()

Serial Port Read timeout.

Returns:Current read imeout.
set_baudrate(value)

Baudrate setter.

Parameters:value – <supported baudrate>
set_bytesize(value)

Byte size setter.

Parameters:value – Possible values (5, 6, 7, 8)
set_parity(value)

Parity Setter.

Parameters:value – Possible values (‘N’, ‘E’, ‘O’, ‘M’, ‘S’)
set_port(value)

Serial Port setter.

Parameters:value – New port
set_stopbits(value)

Stop bit setter.

Parameters:value – Possible values (1, 1.5, 2)
set_timeout(value)

Read timeout setter.

Parameters:value – Read Timeout in seconds
class pymodbus.repl.client.ModbusTcpClient(**kwargs)

Bases: pymodbus.repl.client.ExtendedRequestSupport, pymodbus.client.sync.ModbusTcpClient

pymodbus.repl.completer module

pymodbus.repl.helper module

pymodbus.repl.main module