Modbus — The Modbus Testing Framework
htf
includes a full-stack Modbus implementation since version 1.3 with the following features:
Serial RTU, Serial ASCII, TCP, TLS and UDP support
client support
device simulator support
default Modbus protocol
extended Modbus protocol
supported endianness: little endian, big endian, word aligned and half-word aligned
protocol abstraction is based on
oser
working with data
oser
structures instead of bits and bytesfault insertion
possibility to extend client and device simulator with own commands
The Modbus implementation is capable of testing Modbus clients and servers.
Examples
Simulating a Modbus-Device
import htf
from htf.modbus import ModbusTCPDevice, ModbusTCPClient
ADDRESS = 'localhost'
PORT = 10502 # must be able to run for non-root users
@htf.fixture(scope='class', name='device')
def create_device_simulator():
device = ModbusTCPDevice(ADDRESS, port=PORT)
yield device
device.close()
@htf.fixture(scope='test', name='client')
def create_client():
client = ModbusTCPClient(ADDRESS,
port=PORT,
references_start_at_one=False,
auto_disconnect=False,
debuglevel=0) # set debuglevel to 1 or 2
yield client
client.close()
class ModbusTCPTests:
"""
This tests shows how to simulate a modbus device and how to use the client to
query it via TCP/IP.
"""
def test_holding_registers(self, device, client, assertions):
registers = client.read_multiple_holding_registers(0, 8)
assertions.assert_equal(registers, [0] * 8)
for address in range(10):
client.write_multiple_holding_registers(address, [0, 1, 0, 1, 1, 0, 1, 0])
registers = client.read_multiple_holding_registers(address, 8)
assertions.assert_equal(registers, [0, 1, 0, 1, 1, 0, 1, 0])
device.write_multiple_holding_registers(address, [1, 1, 0, 0, 1, 0, 1, 0])
registers = client.read_multiple_holding_registers(address, 8)
assertions.assert_equal(registers, [1, 1, 0, 0, 1, 0, 1, 0])
def test_input_registers(self, device, client, assertions):
device.write_multiple_input_registers(0, list(range(10)))
registers = client.read_multiple_input_registers(0, 10)
assertions.assert_equal(registers, list(range(10)))
registers = device.read_multiple_input_registers(0, 10)
assertions.assert_equal(registers, list(range(10)))
device.write_multiple_input_registers(10, list(range(20, 31)))
registers = client.read_multiple_input_registers(5, 15)
assertions.assert_equal(registers, list(range(5, 10)) + list(range(20, 30)))
for i in range(10):
r = client.read_input_register(i)
assertions.assert_equal(r, i)
r = device.read_input_register(i)
assertions.assert_equal(r, i)
for i in range(10, 20):
r = client.read_input_register(i)
assertions.assert_equal(r, i+10)
r = device.read_input_register(i)
assertions.assert_equal(r, i + 10)
device.write_input_register(2323, 1)
r = client.read_input_register(2323)
assertions.assert_equal(r, 1)
if __name__ == '__main__':
htf.main()
Special Modbus Data Structures
import htf
import oser
from datetime import datetime
from htf.modbus import ModbusTCPDevice, ModbusTCPClient
ADDRESS = 'localhost'
PORT = 10502 # must be able to run for non-root users
class DateTime(oser.ByteStruct):
def __init__(self, value=None):
"""
``DateTime`` data type.
Args:
value (datetime): a datetime instance to be used
"""
super(DateTime, self).__init__()
self.year = oser.UBInt16()
self.month = oser.UBInt8()
self.day = oser.UBInt8()
self.hour = oser.UBInt8()
self.minute = oser.UBInt8()
self.second = oser.UBInt8()
if value is not None:
self.set(value)
def set(self, value):
"""
Set values from a ``datetime`` instance.
Args:
value (datetime): a ``datetime`` instance to be used
"""
if not isinstance(value, datetime):
raise ValueError("value must be of type datetime")
self.year.set(value.year)
self.month.set(value.month)
self.day.set(value.day)
self.hour.set(value.hour)
self.minute.set(value.minute)
self.second.set(value.second)
def get(self):
"""
Get values as datetime.
Returns:
datetime: an instance of ``datetime`` containing the current values
"""
return datetime(year=self.year.get(), month=self.month.get(), day=self.day.get(),
hour=self.hour.get(), minute=self.minute.get(), second=self.second.get())
@htf.fixture(scope='class', name='device')
def create_device_simulator():
device = ModbusTCPDevice(ADDRESS, port=PORT)
yield device
device.close()
@htf.fixture(scope='test', name='client')
def create_client():
client = ModbusTCPClient(ADDRESS,
port=PORT,
references_start_at_one=False,
auto_disconnect=False,
debuglevel=0) # set debuglevel to 1 or 2
yield client
client.close()
class ModbusDataStructureTests:
"""
This test shows how to read and write own data structures using Modbus.
"""
def test_datetime_data_structure(self, device, client, assertions):
"""
A DateTime data type can be read from input registers at address 23.
"""
now = datetime.now()
device.write_input_register_data(23, DateTime(now))
current_date_struct = client.read_input_register_data(23, DateTime)
assertions.assert_equal(current_date_struct.year, now.year)
assertions.assert_equal(current_date_struct.month, now.month)
assertions.assert_equal(current_date_struct.day, now.day)
assertions.assert_equal(current_date_struct.hour, now.hour)
assertions.assert_equal(current_date_struct.minute, now.minute)
assertions.assert_equal(current_date_struct.second, now.second)
print("device date time is:", current_date_struct.get())
if __name__ == '__main__':
htf.main()
Interfaces
Interfaces are used to implement communication. The user may add other interfaces if needed.
Serial RTU Client Interface
- class htf.modbus.ModbusSerialRTUClientInterface(com_port: str | None = None, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, timeout: int | float = 1.0, response_parser: ByteStruct | BitStruct | ByteType | BitType = <class 'htf.modbus.protocol.SerialRTUModbusResponse'>)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
timeout – the timeout in seconds
response_parser – the parser to parse responses
- read() Tuple[bytes, None]
Read Modbus serial RTU responses from server.
- Returns:
a tuple containing buffer,
None
- write(adu: SerialRTUModbusRequest) None
Write
adu
.- Parameters:
adu – serializable RTU adu
Serial RTU Server Interface
- class htf.modbus.ModbusSerialRTUServerInterface(com_port: str | None = None, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, timeout: int | float = 1.0, response_parser: ByteStruct | BitStruct | ByteType | BitType = <class 'htf.modbus.protocol.SerialRTUModbusRequest'>)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
timeout – the timeout in seconds
response_parser – the parser to parse responses
- read() Tuple[bytes, None]
Read Modbus serial RTU requests from client.
- Returns:
a tuple containing buffer,
None
- write(adu: SerialRTUModbusRequest) None
Write
adu
.- Parameters:
adu – serializable RTU adu
Serial ASCII Client Interface
- class htf.modbus.ModbusSerialASCIIClientInterface(com_port: str | None = None, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, timeout: int | float = 1.0, response_parser: ByteStruct | BitStruct | ByteType | BitType = <class 'htf.modbus.protocol.SerialASCIIModbusResponse'>)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
timeout – the timeout in seconds
response_parser – the parser to parse responses
- change_ascii_delimiter(delimiter: bytes) None
Change LF character to
delimiter
.- Parameters:
delimiter – bytes of length 1 containing the new ASCII delimiter
- read() Tuple[bytes, None]
Read Modbus serial ASCII responses from server. Read until line feed character.
- Returns:
a tuple containing buffer,
None
- write(adu: SerialASCIIModbusRequest) None
Write
adu
.- Parameters:
adu – serializable RTU adu
Serial ASCII Server Interface
- class htf.modbus.ModbusSerialASCIIServerInterface(com_port: str | None = None, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, timeout: int | float = 1.0, response_parser: ByteStruct | BitStruct | ByteType | BitType = <class 'htf.modbus.protocol.SerialASCIIModbusRequest'>)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
timeout – the timeout in seconds
response_parser – the parser to parse responses
- change_ascii_delimiter(delimiter: bytes) None
Change LF character to
delimiter
.- Parameters:
delimiter – bytes of length 1 containing the new ASCII delimiter
- read() Tuple[bytes, None]
Read serial ASCII Modbus requests from client.
- Returns:
a tuple containing buffer,
None
- write(adu: SerialASCIIModbusRequest) None
Write
adu
.- Parameters:
adu – serializable RTU adu
TCP Client Interface
- class htf.modbus.ModbusTCPClientInterface(address: str, port: int = 502, timeout: int | float = 1.0, connect: bool = True)
- Parameters:
address – the ip-address to connect to
port – the port
timeout – the timeout in seconds
connect – if set to
True
the socket connects automatically
- read() Tuple[bytes | None, None]
Read a TCP request from TCP server.
- Returns:
a tuple containing buffer,
None
- write(adu: TCPModbusRequest) None
Write
adu
.- Parameters:
adu – serializable TCP adu
TCP Server Interface
- class htf.modbus.ModbusTCPServerInterface(address: str, port: int = 502, timeout: int | float = 1.0)
- Parameters:
address – the ip-address to listen on
port – the port to listen on
timeout – the timeout in seconds
- accept() Tuple[socket, Any]
Accept a new connection.
- Returns:
a tuple containing connection, address
- read(connection: socket) bytes
Read a TCP request from TLS client.
- Returns:
a tuple containing buffer,
None
- write(connection: socket, adu: TCPModbusRequest) None
Write
adu
.- Parameters:
adu – serializable TCP adu
UDP Client Interface
- class htf.modbus.ModbusUDPClientInterface(address: str, port: int = 502, timeout: int | float = 1.0)
- Parameters:
address – the ip-address to connect to
port – the port
timeout – the timeout in seconds
- read() Tuple[bytes | None, None]
Read a TLS request from TLS server.
- Returns:
a tuple containing buffer,
None
- write(adu: TCPModbusRequest) None
Write
adu
.- Parameters:
adu – serializable TCP adu
UDP Server Interface
- class htf.modbus.ModbusUDPServerInterface(address: str, port: int = 502, timeout: Tuple[int, float] | None = None)
- Parameters:
address – the ip-address to listen on
port – the port to listen on
timeout=None – the timeout in seconds
- read(bufsize: int = 300) Tuple[bytes, Any]
Read a request from an UDP client.
- Parameters:
bufsize – buffer size
- Returns:
the received request
- write(address: str, adu: TCPModbusRequest) None
Write
adu
.- Parameters:
address – the target ip-address
adu – serializable TCP adu
TLS Client Interface
- class htf.modbus.ModbusTLSClientInterface(address: str, port: int = 502, timeout: int | float = 1.0, verify: bool = True, connect: bool = True, cafile: str | None = None, capath: str | None = None, cadata: str | None = None)
- Parameters:
address – the ip-address to connect to
port – the port
timeout – the timeout in seconds
verify – set to
False
to disable TLS certificate verificationconnect – if set to
True
the socket connects automaticallycafile – path to a file of concatenated CA certificates in PEM format
capath – path to a directory containing several CA certificates in PEM format
cadata – either an ASCII string of one or more PEM-encoded certificates or a bytes-like object of DER-encoded certificates
- read() Tuple[bytes | None, None]
Read a TCP request from TCP server.
- Returns:
a tuple containing buffer,
None
- write(adu: TCPModbusRequest) None
Write
adu
.- Parameters:
adu – serializable TCP adu
TLS Server Interface
- class htf.modbus.ModbusTLSServerInterface(address: str, port: int = 502, timeout: int | float = 1.0, certfile: str | None = None, keyfile: str | None = None, password: str | None = None)
- Parameters:
address – the ip-address to listen on
port – the port to listen on
timeout – the timeout in seconds
certfile – path to TLS certificate
keyfile – path to TLS keyfile
password – TLS password
- accept() Tuple[socket, Any]
Accept a new connection.
- Returns:
a tuple containing connection, address
- read(connection: socket) bytes
Read a TCP request from TLS client.
- Returns:
a tuple containing buffer,
None
- write(connection: socket, adu: TCPModbusRequest) None
Write
adu
.- Parameters:
adu – serializable TCP adu
Clients
Clients are used to query Modbus devices. Users can add own clients using own interfaces.
Base Client
- class htf.modbus.ModbusBaseClient(interface: ModbusBaseInterface, request_parser: Type[SerialRTUModbusRequest] | Type[SerialASCIIModbusRequest] | Type[TCPModbusRequest], response_parser: Type[SerialRTUModbusResponse] | Type[SerialASCIIModbusResponse] | Type[TCPModbusResponse], retries: int | None = None, references_start_at_one: bool = True, debuglevel: int | None = None)
- Parameters:
interface – an interface to be used for communication
request_parser – a parser for requests
response_parser – a parser for responses
retries=None – the number of retries until an exception is raised
references_start_at_one=True – if set to
True
all references start at1
else0
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- build_request() SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest
Build and return an instance of the desired request parser.
- Returns:
request parser
- build_response() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Build and return an instance of the desired response parser.
- Returns:
response parser
- get_device_identification() Dict[int, bytes]
Query and return the device identification using Modbus function code 43.14.
- Returns:
containing key values pairs with the device identifiers
- get_fifo_queue_content(address: int) List[int]
Query and return the fifo content of
address
using Modbus function code 24.- Parameters:
address – the fifo queue pointer address
- Returns:
list of content from the fifo queue at
address
- mask_holding_register(reference: int, and_mask: int, or_mask: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Mask write single holding register using Modbus function code 22.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- query(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Query
adu
using the interface and return the decoded response. This method is thread-safe.- Parameters:
adu – a serializable adu
- Returns:
the decoded response if no exception occurred
- Return type:
adu
- Raises:
ModbusException – in case of an exception response
- read() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Read a message from the interface and decode it.
- Returns:
the decoded adu as is
- Return type:
adu
- Raises:
Exception if no answer was received –
- read_coil(reference: int) int
Read a single coil using Modbus function code 1.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils using Modbus function code 1.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input using Modbus function code 2.
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs using Modbus function code 2.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_extended_memory(memory_number: int, record_number: int, record_length: int) List[int]
Query and return extended memory from device using Modbus function code 20.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to start reading from
record_length – the length of records
- Returns:
the read records
- read_holding_register(reference: int) int
Read a single holding register using Modbus function code 3.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers using Modbus function code 3.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register using Modbus function code 4.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers using Modbus function code 4.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils using Modbus function code 1.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs using Modbus function code 2.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers using Modbus function code 3.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers using Modbus function code 4.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- read_write_multiple_holding_registers(read_reference: int, read_quantity: int, write_reference: int, write_values: List[int]) List[int]
Read/Write multiple holding registers using Modbus function code 23.
- Parameters:
read_reference – the register reference to read from.
read_quantity – the number of registers to read.
write_reference – the register reference to to write to.
write_values – the values to be written.
- Returns:
the read registers
- write(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) None
Write
adu
encoded using the interface.- Parameters:
adu – a serializable adu
- write_coil(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a single coil using Modbus function code 5.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to coils using Modbus function code 15.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_extended_memory(memory_number: int, record_number: int, records: List[int]) None
Write extended memory using Modbus function code 21.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to write to
records – the records to be written
- write_holding_register(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write single holding register using Modbus function code 6.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple coils using Modbus function code 15.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_holding_registers(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
values – the values to be written.
Serial RTU Client
- class htf.modbus.ModbusSerialRTUClient(com_port: str, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, device_address: int = 1, timeout: int | float = 1.0, retries: int | None = None, references_start_at_one: bool = True, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.SerialRTUModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.SerialRTUModbusResponse'>, debuglevel: int | None = None)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
device_address – the device address (Slave ID)
timeout – the timeout in seconds
retries=None – the number of retries until an exception is raised
references_start_at_one=True – if set to
True
all references start at1
else0
request_parser – a parser for requests
response_parser – a parser for responses
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- build_request() SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest
Build and return an instance of the desired request parser.
- Returns:
request parser
- build_response() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Build and return an instance of the desired response parser.
- Returns:
response parser
- clear_counters_and_diagnostic_register() None
Clear counters and diagnostic register using Modbus function code 8.10.
- clear_overrun_counter_and_flag() None
Clear overrun counter and reset the error flag using Modbus function code 8.20.
- echo(data: bytes) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Query data and return echo using Modbus function code 8.0. An exception is raised if the received data differ from the sent data or the request is too long.
- Parameters:
data – The bytes to be sent.
- Returns:
response
- get_bus_character_overrun_count() int
Query and return the bus character overrun count from the device using Modbus function code 8.18.
- Returns:
the bus character overrun count
- get_bus_communication_error_count() int
Query and return the bus communication error count from the device using Modbus function code 8.12.
- Returns:
the bus communication error count
- get_bus_exception_error_count() int
Query and return the bus exception error count from the device using Modbus function code 8.13.
- Returns:
the bus exception error count
- get_bus_message_count() int
Query and return the bus message count from the device using Modbus function code 8.11.
- Returns:
the bus message count
- get_busy_count() int
Query and return the slave busy count from the device using Modbus function code 8.17.
- Returns:
the slave busy count
- get_busy_status() bool
Query and return busy status using Modbus function code 11.
- Returns:
busy_status
- get_communication_event_counter_and_busy_status() Tuple[int, bool]
Query and return communication event counter and busy status using Modbus function code 11.
- Returns:
a tuple containing communication_event_counter (int), busy_status (bool)
- get_device_identification() Dict[int, bytes]
Query and return the device identification using Modbus function code 43.14.
- Returns:
containing key values pairs with the device identifiers
- get_diagnostic_register() bytes
Query and return the diagnostic register using Modbus function 8.2.
- Returns:
the content of the diagnostic register
- get_event_count() int
Query and return event count status using Modbus function code 11.
- Returns:
communication_event_counter
- get_event_log() Tuple[int, int, int, List[int]]
Query and return the event log using Modbus function code 12.
- Returns:
a tuple containing busy_status (int), event_count (int), message_count (int), events (list of int)
- get_exception_status() int
Read and return exception status using Modbus function code 7.
- Returns:
the current exception status
- get_fifo_queue_content(address: int) List[int]
Query and return the fifo content of
address
using Modbus function code 24.- Parameters:
address – the fifo queue pointer address
- Returns:
list of content from the fifo queue at
address
- get_slave_id() Tuple[int, bool, bytes]
Query and return the slave id using Modbus function code 17.
- Returns:
a tuple containing slave-id, running, data
- get_slave_message_count() int
Query and return the slave message count from the device using Modbus function code 8.14.
- Returns:
the slave message count
- get_slave_nak_count() int
Query and return the slave nak count from the device using Modbus function code 8.16.
- Returns:
the slave nak count
- get_slave_no_response_count() int
Query and return the slave no response count from the device using Modbus function code 8.15.
- Returns:
the slave no response count
- mask_holding_register(reference: int, and_mask: int, or_mask: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Mask write single holding register using Modbus function code 22.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- query(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Query
adu
using the interface and return the decoded response. This method is thread-safe.- Parameters:
adu – a serializable adu
- Returns:
the decoded response if no exception occurred
- Return type:
adu
- Raises:
ModbusException – in case of an exception response
- read() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Read a message from the interface and decode it.
- Returns:
the decoded adu as is
- Return type:
adu
- Raises:
Exception if no answer was received –
- read_coil(reference: int) int
Read a single coil using Modbus function code 1.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils using Modbus function code 1.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input using Modbus function code 2.
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs using Modbus function code 2.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_extended_memory(memory_number: int, record_number: int, record_length: int) List[int]
Query and return extended memory from device using Modbus function code 20.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to start reading from
record_length – the length of records
- Returns:
the read records
- read_holding_register(reference: int) int
Read a single holding register using Modbus function code 3.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers using Modbus function code 3.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register using Modbus function code 4.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers using Modbus function code 4.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils using Modbus function code 1.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs using Modbus function code 2.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers using Modbus function code 3.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers using Modbus function code 4.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- read_write_multiple_holding_registers(read_reference: int, read_quantity: int, write_reference: int, write_values: List[int]) List[int]
Read/Write multiple holding registers using Modbus function code 23.
- Parameters:
read_reference – the register reference to read from.
read_quantity – the number of registers to read.
write_reference – the register reference to to write to.
write_values – the values to be written.
- Returns:
the read registers
- restart_communications(reset_eventlog: bool = False) None
Restart communications using Modbus function code 8.1.
- set_device_address(device_address: int) None
Set device address.
- Parameters:
device_address – the device address to be used for the next requests.
- write(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) None
Write
adu
encoded using the interface.- Parameters:
adu – a serializable adu
- write_coil(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a single coil using Modbus function code 5.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to coils using Modbus function code 15.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_extended_memory(memory_number: int, record_number: int, records: List[int]) None
Write extended memory using Modbus function code 21.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to write to
records – the records to be written
- write_holding_register(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write single holding register using Modbus function code 6.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple coils using Modbus function code 15.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_holding_registers(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
values – the values to be written.
Serial ASCII Client
- class htf.modbus.ModbusSerialASCIIClient(com_port: str, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, device_address: int = 1, timeout: int | float = 1.0, retries: int | None = None, references_start_at_one: bool = True, ascii_delimiter: bytes = b'\n', request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.SerialASCIIModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.SerialASCIIModbusResponse'>, debuglevel: int | None = None)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
device_address – the device address (Slave ID)
timeout – the timeout in seconds
retries=None – the number of retries until an exception is raised
references_start_at_one=True – if set to
True
all references start at1
else0
ascii_delimiter – the ascii delimiter to be used
request_parser – a parser for requests
response_parser – a parser for responses
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- build_request() SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest
Build and return an instance of the desired request parser.
- Returns:
request parser
- build_response() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Build and return an instance of the desired response parser.
- Returns:
response parser
- change_ascii_delimiter(delimiter: bytes) None
Change ASCII delimiter in the device.
- Parameters:
delimiter – the new ASCII delimiter.
- clear_counters_and_diagnostic_register() None
Clear counters and diagnostic register using Modbus function code 8.10.
- clear_overrun_counter_and_flag() None
Clear overrun counter and reset the error flag using Modbus function code 8.20.
- echo(data: bytes) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Query data and return echo using Modbus function code 8.0. An exception is raised if the received data differ from the sent data or the request is too long.
- Parameters:
data – The bytes to be sent.
- Returns:
response
- get_bus_character_overrun_count() int
Query and return the bus character overrun count from the device using Modbus function code 8.18.
- Returns:
the bus character overrun count
- get_bus_communication_error_count() int
Query and return the bus communication error count from the device using Modbus function code 8.12.
- Returns:
the bus communication error count
- get_bus_exception_error_count() int
Query and return the bus exception error count from the device using Modbus function code 8.13.
- Returns:
the bus exception error count
- get_bus_message_count() int
Query and return the bus message count from the device using Modbus function code 8.11.
- Returns:
the bus message count
- get_busy_count() int
Query and return the slave busy count from the device using Modbus function code 8.17.
- Returns:
the slave busy count
- get_busy_status() bool
Query and return busy status using Modbus function code 11.
- Returns:
busy_status
- get_communication_event_counter_and_busy_status() Tuple[int, bool]
Query and return communication event counter and busy status using Modbus function code 11.
- Returns:
a tuple containing communication_event_counter (int), busy_status (bool)
- get_device_identification() Dict[int, bytes]
Query and return the device identification using Modbus function code 43.14.
- Returns:
containing key values pairs with the device identifiers
- get_diagnostic_register() bytes
Query and return the diagnostic register using Modbus function 8.2.
- Returns:
the content of the diagnostic register
- get_event_count() int
Query and return event count status using Modbus function code 11.
- Returns:
communication_event_counter
- get_event_log() Tuple[int, int, int, List[int]]
Query and return the event log using Modbus function code 12.
- Returns:
a tuple containing busy_status (int), event_count (int), message_count (int), events (list of int)
- get_exception_status() int
Read and return exception status using Modbus function code 7.
- Returns:
the current exception status
- get_fifo_queue_content(address: int) List[int]
Query and return the fifo content of
address
using Modbus function code 24.- Parameters:
address – the fifo queue pointer address
- Returns:
list of content from the fifo queue at
address
- get_slave_id() Tuple[int, bool, bytes]
Query and return the slave id using Modbus function code 17.
- Returns:
a tuple containing slave-id, running, data
- get_slave_message_count() int
Query and return the slave message count from the device using Modbus function code 8.14.
- Returns:
the slave message count
- get_slave_nak_count() int
Query and return the slave nak count from the device using Modbus function code 8.16.
- Returns:
the slave nak count
- get_slave_no_response_count() int
Query and return the slave no response count from the device using Modbus function code 8.15.
- Returns:
the slave no response count
- mask_holding_register(reference: int, and_mask: int, or_mask: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Mask write single holding register using Modbus function code 22.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- query(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Query
adu
using the interface and return the decoded response. This method is thread-safe.- Parameters:
adu – a serializable adu
- Returns:
the decoded response if no exception occurred
- Return type:
adu
- Raises:
ModbusException – in case of an exception response
- read() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Read a message from the interface and decode it.
- Returns:
the decoded adu as is
- Return type:
adu
- Raises:
Exception if no answer was received –
- read_coil(reference: int) int
Read a single coil using Modbus function code 1.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils using Modbus function code 1.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input using Modbus function code 2.
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs using Modbus function code 2.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_extended_memory(memory_number: int, record_number: int, record_length: int) List[int]
Query and return extended memory from device using Modbus function code 20.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to start reading from
record_length – the length of records
- Returns:
the read records
- read_holding_register(reference: int) int
Read a single holding register using Modbus function code 3.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers using Modbus function code 3.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register using Modbus function code 4.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers using Modbus function code 4.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils using Modbus function code 1.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs using Modbus function code 2.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers using Modbus function code 3.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers using Modbus function code 4.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- read_write_multiple_holding_registers(read_reference: int, read_quantity: int, write_reference: int, write_values: List[int]) List[int]
Read/Write multiple holding registers using Modbus function code 23.
- Parameters:
read_reference – the register reference to read from.
read_quantity – the number of registers to read.
write_reference – the register reference to to write to.
write_values – the values to be written.
- Returns:
the read registers
- restart_communications(reset_eventlog: bool = False) None
Restart communications using Modbus function code 8.1.
- set_device_address(device_address: int) None
Set device address.
- Parameters:
device_address – the device address to be used for the next requests.
- write(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) None
Write
adu
encoded using the interface.- Parameters:
adu – a serializable adu
- write_coil(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a single coil using Modbus function code 5.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to coils using Modbus function code 15.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_extended_memory(memory_number: int, record_number: int, records: List[int]) None
Write extended memory using Modbus function code 21.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to write to
records – the records to be written
- write_holding_register(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write single holding register using Modbus function code 6.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple coils using Modbus function code 15.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_holding_registers(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
values – the values to be written.
TCP Client
- class htf.modbus.ModbusTCPClient(address: str, port: int = 502, unit_identifier: int = 0, timeout: int | float = 1.0, retries: int | None = None, references_start_at_one: bool = True, transaction_identifier: int = 0, auto_disconnect: bool = False, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.TCPModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.TCPModbusResponse'>, debuglevel: int | None = None)
- Parameters:
address – the ip address to connect to
port – the port to be used
unit_identifier – the unit identifier for Modbus TCP
timeout – the timeout in seconds
retries=None – the number of retries until an exception is raised
references_start_at_one=True – if set to
True
all references start at1
else0
transaction_identifier – the initial transaction identifier
auto_disconnect=False – if set to
True
the TCP connection is closed immediately and re-opened on next requestrequest_parser – a parser for requests
response_parser – a parser for responses
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- build_request() SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest
Build and return an instance of the desired request parser.
- Returns:
request parser
- build_response() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Build and return an instance of the desired response parser.
- Returns:
response parser
- get_device_identification() Dict[int, bytes]
Query and return the device identification using Modbus function code 43.14.
- Returns:
containing key values pairs with the device identifiers
- get_fifo_queue_content(address: int) List[int]
Query and return the fifo content of
address
using Modbus function code 24.- Parameters:
address – the fifo queue pointer address
- Returns:
list of content from the fifo queue at
address
- get_transaction_identifier() int
Create and return a new transaction identifer. Is thread-safe.
- Returns:
the next transaction identifier
- mask_holding_register(reference: int, and_mask: int, or_mask: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Mask write single holding register using Modbus function code 22.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- query(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Query
adu
using the interface and return the decoded response.- Parameters:
adu – a serializable adu
- Returns:
the decoded response if no exception occurred
- Return type:
adu
- Raises:
ModbusException – in case of an exception response
- read() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Read a message from the interface and decode it.
- Returns:
the decoded adu as is
- Return type:
adu
- Raises:
Exception if no answer was received –
- read_coil(reference: int) int
Read a single coil using Modbus function code 1.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils using Modbus function code 1.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input using Modbus function code 2.
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs using Modbus function code 2.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_extended_memory(memory_number: int, record_number: int, record_length: int) List[int]
Query and return extended memory from device using Modbus function code 20.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to start reading from
record_length – the length of records
- Returns:
the read records
- read_holding_register(reference: int) int
Read a single holding register using Modbus function code 3.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers using Modbus function code 3.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register using Modbus function code 4.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers using Modbus function code 4.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils using Modbus function code 1.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs using Modbus function code 2.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers using Modbus function code 3.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers using Modbus function code 4.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- read_write_multiple_holding_registers(read_reference: int, read_quantity: int, write_reference: int, write_values: List[int]) List[int]
Read/Write multiple holding registers using Modbus function code 23.
- Parameters:
read_reference – the register reference to read from.
read_quantity – the number of registers to read.
write_reference – the register reference to to write to.
write_values – the values to be written.
- Returns:
the read registers
- write(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest, auto_length: bool = True) None
Write
adu
encoded using the interface. The transaction identifier is set automatically. The unit identifier is put into the adu automatically, too.- Parameters:
adu – a serializable adu
auto_length=True – if set to
True
the length is calculated automatically
- write_coil(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a single coil using Modbus function code 5.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to coils using Modbus function code 15.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_extended_memory(memory_number: int, record_number: int, records: List[int]) None
Write extended memory using Modbus function code 21.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to write to
records – the records to be written
- write_holding_register(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write single holding register using Modbus function code 6.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple coils using Modbus function code 15.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_holding_registers(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
values – the values to be written.
TLS Client
- class htf.modbus.ModbusTLSClient(address: str, port: int = 502, unit_identifier: int = 0, timeout: int | float = 1.0, retries: int | None = None, references_start_at_one: bool = True, transaction_identifier: int = 0, auto_disconnect: bool = False, verify: bool = True, cafile: str | None = None, capath: str | None = None, cadata: str | None = None, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.TCPModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.TCPModbusResponse'>, debuglevel: int | None = None)
- Parameters:
address – the ip address to connect to
port – the port to be used
unit_identifier – the unit identifier for Modbus TCP
timeout – the timeout in seconds
retries=None – the number of retries until an exception is raised
references_start_at_one=True – if set to
True
all references start at1
else0
transaction_identifier – the initial transaction identifier
auto_disconnect=False – if set to
True
the TCP connection is closed immediately and re-opened on next requestcafile – path to a file of concatenated CA certificates in PEM format
capath – path to a directory containing several CA certificates in PEM format
cadata – either an ASCII string of one or more PEM-encoded certificates or a bytes-like object of DER-encoded certificates
request_parser – a parser for requests
response_parser – a parser for responses
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- build_request() SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest
Build and return an instance of the desired request parser.
- Returns:
request parser
- build_response() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Build and return an instance of the desired response parser.
- Returns:
response parser
- get_device_identification() Dict[int, bytes]
Query and return the device identification using Modbus function code 43.14.
- Returns:
containing key values pairs with the device identifiers
- get_fifo_queue_content(address: int) List[int]
Query and return the fifo content of
address
using Modbus function code 24.- Parameters:
address – the fifo queue pointer address
- Returns:
list of content from the fifo queue at
address
- get_transaction_identifier() int
Create and return a new transaction identifer. Is thread-safe.
- Returns:
the next transaction identifier
- mask_holding_register(reference: int, and_mask: int, or_mask: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Mask write single holding register using Modbus function code 22.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- query(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Query
adu
using the interface and return the decoded response.- Parameters:
adu – a serializable adu
- Returns:
the decoded response if no exception occurred
- Return type:
adu
- Raises:
ModbusException – in case of an exception response
- read() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Read a message from the interface and decode it.
- Returns:
the decoded adu as is
- Return type:
adu
- Raises:
Exception if no answer was received –
- read_coil(reference: int) int
Read a single coil using Modbus function code 1.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils using Modbus function code 1.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input using Modbus function code 2.
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs using Modbus function code 2.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_extended_memory(memory_number: int, record_number: int, record_length: int) List[int]
Query and return extended memory from device using Modbus function code 20.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to start reading from
record_length – the length of records
- Returns:
the read records
- read_holding_register(reference: int) int
Read a single holding register using Modbus function code 3.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers using Modbus function code 3.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register using Modbus function code 4.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers using Modbus function code 4.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils using Modbus function code 1.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs using Modbus function code 2.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers using Modbus function code 3.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers using Modbus function code 4.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- read_write_multiple_holding_registers(read_reference: int, read_quantity: int, write_reference: int, write_values: List[int]) List[int]
Read/Write multiple holding registers using Modbus function code 23.
- Parameters:
read_reference – the register reference to read from.
read_quantity – the number of registers to read.
write_reference – the register reference to to write to.
write_values – the values to be written.
- Returns:
the read registers
- write(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest, auto_length: bool = True) None
Write
adu
encoded using the interface. The transaction identifier is set automatically. The unit identifier is put into the adu automatically, too.- Parameters:
adu – a serializable adu
auto_length=True – if set to
True
the length is calculated automatically
- write_coil(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a single coil using Modbus function code 5.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to coils using Modbus function code 15.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_extended_memory(memory_number: int, record_number: int, records: List[int]) None
Write extended memory using Modbus function code 21.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to write to
records – the records to be written
- write_holding_register(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write single holding register using Modbus function code 6.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple coils using Modbus function code 15.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_holding_registers(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
values – the values to be written.
UDP Client
- class htf.modbus.ModbusUDPClient(address: str, port: int = 502, unit_identifier: int = 0, timeout: int | float = 1.0, retries: int | None = None, references_start_at_one: bool = True, transaction_identifier: int = 0, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.TCPModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.TCPModbusResponse'>, debuglevel: int | None = None)
- Parameters:
address – the ip address to connect to
port – the port to be used
unit_identifier – the unit identifier for Modbus TCP
timeout – the timeout in seconds
retries=None – the number of retries until an exception is raised
references_start_at_one=True – if set to
True
all references start at1
else0
transaction_identifier – the initial transaction identifier
request_parser – a parser for requests
response_parser – a parser for responses
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- build_request() SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest
Build and return an instance of the desired request parser.
- Returns:
request parser
- build_response() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Build and return an instance of the desired response parser.
- Returns:
response parser
- get_device_identification() Dict[int, bytes]
Query and return the device identification using Modbus function code 43.14.
- Returns:
containing key values pairs with the device identifiers
- get_fifo_queue_content(address: int) List[int]
Query and return the fifo content of
address
using Modbus function code 24.- Parameters:
address – the fifo queue pointer address
- Returns:
list of content from the fifo queue at
address
- get_transaction_identifier() int
Create and return a new transaction identifer. Is thread-safe.
- Returns:
the next transaction identifier
- mask_holding_register(reference: int, and_mask: int, or_mask: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Mask write single holding register using Modbus function code 22.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- query(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Query
adu
using the interface and return the decoded response.- Parameters:
adu – a serializable adu
- Returns:
the decoded response if no exception occurred
- Return type:
adu
- Raises:
ModbusException – in case of an exception response
- read() SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Read a message from the interface and decode it.
- Returns:
the decoded adu as is
- Return type:
adu
- Raises:
Exception if no answer was received –
- read_coil(reference: int) int
Read a single coil using Modbus function code 1.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils using Modbus function code 1.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input using Modbus function code 2.
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs using Modbus function code 2.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_extended_memory(memory_number: int, record_number: int, record_length: int) List[int]
Query and return extended memory from device using Modbus function code 20.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to start reading from
record_length – the length of records
- Returns:
the read records
- read_holding_register(reference: int) int
Read a single holding register using Modbus function code 3.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers using Modbus function code 3.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register using Modbus function code 4.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers using Modbus function code 4.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils using Modbus function code 1.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs using Modbus function code 2.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers using Modbus function code 3.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers using Modbus function code 4.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- read_write_multiple_holding_registers(read_reference: int, read_quantity: int, write_reference: int, write_values: List[int]) List[int]
Read/Write multiple holding registers using Modbus function code 23.
- Parameters:
read_reference – the register reference to read from.
read_quantity – the number of registers to read.
write_reference – the register reference to to write to.
write_values – the values to be written.
- Returns:
the read registers
- write(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest, auto_length: bool = True) None
Write
adu
encoded using the interface. The transaction identifier is set automatically. The unit identifier is put into the adu automatically, too.- Parameters:
adu – a serializable adu
auto_length=True – if set to
True
the length is calculated automatically
- write_coil(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a single coil using Modbus function code 5.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to coils using Modbus function code 15.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_extended_memory(memory_number: int, record_number: int, records: List[int]) None
Write extended memory using Modbus function code 21.
- Parameters:
memory_number – the memory number (0x0001 to 0xffff)
record_number – the record to write to
records – the records to be written
- write_holding_register(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write single holding register using Modbus function code 6.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write data to holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple coils using Modbus function code 15.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_holding_registers(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write multiple holding registers using Modbus function code 16.
- Parameters:
reference – the register reference.
values – the values to be written.
Servers
Servers are used to respond to queries initiated by clients. Servers are used by devices. Users can add own servers using own interfaces.
Base Server
- class htf.modbus.ModbusBaseServer
Modbus Base Server is an abstract base class.
- handle_request(data: bytes) None
Request handler.
- Raises:
Exception – abstract base class has no implementation.
Serial RTU Server
- class htf.modbus.ModbusSerialRTUServer(com_port: str, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, device_address: int = 1, timeout: int | float = 1.0, request_parser: ByteStruct | BitStruct | ByteType | BitType = <class 'htf.modbus.protocol.SerialRTUModbusRequest'>, response_parser: ByteStruct | BitStruct | ByteType | BitType = <class 'htf.modbus.protocol.SerialRTUModbusResponse'>, callback: ~typing.Callable | None = None)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
device_address – the device address to be used (Slave ID)
timeout – the timeout in seconds
request_parser – the request parser
response_parser – the response parser
callback – a callback used as a request handler
- static get_broadcast_enabled_function_codes() List[int]
Return a list of functions codes that are processed for broadcast requests. By default the function codes
5
,6
,15
and16
are supported. This method can be overwritten easily.- Returns:
a list of int containing the supported function codes
- handle_request(data: bytes) None
Request handler. A request is handled by calling the callback.
- Parameters:
data – a request to be handled
- set_listen_only_mode(listen_only_mode_enabled: bool = True) None
Set listen only mode.
- Parameters:
listen_only_mode_enabled –
True
enables the listen only mode.False
disables it.
Serial ASCII Server
- class htf.modbus.ModbusSerialASCIIServer(com_port: str, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, device_address: int = 1, timeout: int | float = 1.0, request_parser: ByteStruct | BitStruct | ByteType | BitType = <class 'htf.modbus.protocol.SerialASCIIModbusRequest'>, response_parser: ByteStruct | BitStruct | ByteType | BitType = <class 'htf.modbus.protocol.SerialASCIIModbusResponse'>, callback: ~typing.Callable | None = None)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
device_address – the device address to be used (Slave ID)
timeout – the timeout in seconds
request_parser – the request parser
response_parser – the response parser
callback – a callback used as a request handler
- change_ascii_delimiter(delimiter: bytes) None
Change ASCII delimiter to
ascii_delimiter
.- Parameters:
delimiter – bytes of length 1 representing the new lf character
- static get_broadcast_enabled_function_codes() List[int]
Return a list of functions codes that are processed for broadcast requests. By default the function codes
5
,6
,15
and16
are supported. This method can be overwritten easily.- Returns:
a list of int containing the supported function codes
- handle_request(data: bytes) None
Request handler. A request is handled by calling the callback.
- Parameters:
data – a request to be handled
- set_listen_only_mode(listen_only_mode_enabled: bool = True) None
Set listen only mode.
- Parameters:
listen_only_mode_enabled –
True
enables the listen only mode.False
disables it.
Device Simulators
Devices are used to simulate Modbus devices. Users can add own devices with own commands easily.
Base Device
- class htf.modbus.ModbusBaseDevice(server: ModbusBaseServer, memory: ModbusMemory, debuglevel: int | None = None)
- Parameters:
server – a server instance to be used
memory – a memory instance to be used
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- create_exception_response(request_pdu: RequestPDU, exception_code: str) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler to response with an exception.
- Parameters:
request_pdu – the request pdu
exception_code – the exception code to be sent
- Returns:
the response to be sent to the client
- handle_function_code_1(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 1
``Read Coils
.``.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_15(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 15
Write Multiple Coils
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_16(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 16
Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_2(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 2
Read Discrete Inputs
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_20(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 20
Read File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_21(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 21
Write File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_22(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 22
Mask Write Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_23(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 23
Read/Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_24(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 24
Read FIFO Queue
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_3(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 3
Read Holding Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_4(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 4
Read Input Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport.
Calls a handler by mei type with the name
handle_function_code_43_mei_type_<mei type>
. To add more mei types more handlers have to be added.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43_mei_type_14(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport: Read Device Identification. Basic object ids can be read.
- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_5(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 5
Write Single Coil
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_6(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 6
Write Single Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_request(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for an incoming request.
- Parameters:
adu – a request adu
- Returns:
the command or exception handler
- mask_holding_register(reference: int, and_mask: int, or_mask: int) None
Mask write single holding register from device memory.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers from device memory.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- read_coil(reference: int) int
Read a single coil from device memory.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils device memory.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input from device memory
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs device memory.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register(reference: int) int
Read a single holding register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers from device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils from device memory.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs from device memory.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- set_device_identifier(object_id: int | None, value: str | bytes | None) None
Set a device identifier. The objects
"vendor_name"
,"product_code"
,"major_minor_version"
,"vendor_url"
,"product_name"
,"model_name"
and"user_application_name"
are predefined.Set
value
toNone
to remove an entry.Entries can be read using Modbus function code 43.14.
- Parameters:
object_id – the object identifier
value – the value to be used
- set_extended_memory(memory_number: int, records: List[int] | None) None
Set extended memory that can be read with Modbus function code 20 and written with Modbus function code 21.
If
records
isNone
the memore is removed.- Parameters:
memory_number – the memory number (0x0001 to 0xFFFF)
records – the records to be stored
- set_fifo_queue_content(address: int, content: List[int] | None) None
Set the FIFO queue content.
- Parameters:
address – the address
content – a list of integers or
None
to delete the queue contents
- write_coil(reference: int, value: int) None
Write a single coil to device memory.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to coils device memory.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_discrete_input(reference: int, value: int) None
Read multiple discrete inputs from device memory
- Parameters:
reference – the register reference.
value – the value to be written
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- write_discrete_input_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_discrete_input_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to discrete input device memory.
- Parameters:
reference – the discrete input reference.
data – the type or instance or the decoder for the data
- write_discrete_input_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to discrete input memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_discrete_input_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_discrete_input_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_discrete_input_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register(reference: int, value: int) None
Write single holding register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to holding registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register(reference: int, value: int) None
Write single input register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_input_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_input_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to input registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_input_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to input register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_input_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_input_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to input register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_input_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_input_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) None
Write multiple coils to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_discrete_inputs(reference: int, values: List[int]) None
Write multiple discrete inputs to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
Serial RTU Device
- class htf.modbus.ModbusSerialRTUDevice(com_port: str, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, device_address: int = 1, shared_memory: bool = False, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.SerialRTUModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.SerialRTUModbusResponse'>, debuglevel: int | None = None)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
device_address – the device address to be used (Slave ID)
shared_memory – if set to
True
a single shared memory is usedrequest_parser – the request parser
response_parser – the response parser
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- add_receive_event(is_communication_error: bool = False, is_character_overrun: bool = False, is_broadcast: bool = False, is_listen_only_mode: bool = False) None
Add a receive event.
- Parameters:
is_communication_error – set to
True
if a communication error occurredis_character_overrun – set to
True
if a character overrun occurredis_broadcast – set to
True
if a broadcast message was receivedis_listen_only_mode – set to
True
if the server is currently in listen only mode
- add_send_event(read_exception_sent: bool = False, slave_abort_exeception_sent: bool = False, slave_busy_exception_sent: bool = False, slave_program_nak_exception_sent: bool = False, write_timeout_occurred: bool = False) None
Add a send event. The current listen only mode is determined automatically.
- Parameters:
read_exception_sent – set to
True
if a read exception sent occurred (exception codes 1-3)slave_abort_exeception_sent – set to
True
if a slave abort exception sent occurred (execption code 4)slave_busy_exception_sent – set to
True
if a slave busy exception sent occurred (exception codes 5-6)slave_program_nak_exception_sent – set to
True
if a slave program NAK exception sent occurred (exception code 7)write_timeout_occurred – set to
True
if a write timeout occurred
- create_exception_response(request_pdu: RequestPDU, exception_code: str) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler to response with an exception.
- Parameters:
request_pdu – the request pdu
exception_code – the exception code to be sent
- Returns:
the response to be sent to the client
- get_bus_character_overrun_count() int
Get the bus character overrun count.
- Returns:
the bus character overrun count
- get_busy_status() bool
Return the current busy status.
- Returns:
True
if the device is busy elseFalse
- get_diagnostic_register() bytes
Return the diagnostic register
- Returns:
the content of the diagnostic register
- get_exception_status() int
Return the current exception status.
- Returns:
the current exception status
- handle_function_code_1(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 1
``Read Coils
.``.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_11(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 11
Get Comm Event Counter (Serial Line only)
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_12(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 12
Get Comm Event Log (Serial Line only)
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_15(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 15
Write Multiple Coils
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_16(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 16
Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_17(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 17
Report Slave ID (Serial Line only)
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_2(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 2
Read Discrete Inputs
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_20(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 20
Read File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_21(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 21
Write File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_22(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 22
Mask Write Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_23(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 23
Read/Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_24(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 24
Read FIFO Queue
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_3(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 3
Read Holding Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_4(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 4
Read Input Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport.
Calls a handler by mei type with the name
handle_function_code_43_mei_type_<mei type>
. To add more mei types more handlers have to be added.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43_mei_type_14(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport: Read Device Identification. Basic object ids can be read.
- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_5(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 5
Write Single Coil
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_6(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 6
Write Single Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_7(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 7
Read Exception Status
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.x Diagnostics (Serial Line only).
Calls a handler by sub function code like
handle_function_code_8_sub_function_<sub function code>
. To add more sub functions more handlers have to be added.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_0(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.0
Diagnostics Send Echo Response
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_1(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.1
Diagnostics Restart Communications Option
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_10(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.10
Diagnostics Clear counters and diagnostic register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_11(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.11
Diagnostics Bus message count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_12(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.12
Diagnostics Bus communication error count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_13(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.13
Diagnostics Bus exception error count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_14(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.14
Diagnostics Return slave message count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_15(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.15
Diagnostics Slave No Response Count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_16(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.16
Diagnostics Slave NAK Count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_17(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.17
Diagnostics Slave Busy Count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_18(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.18
Diagnostics Slave Character Overrun Count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_2(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.2
Diagnostics Return diagnostic register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_20(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.20
Diagnostics
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_3(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.3
Diagnostics Change ASCII Input Delimiter
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_4(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.4
Diagnostics Force Listen Only Mode
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_request(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for an incoming request.
- Parameters:
adu – a request adu
- Returns:
the command or exception handler
- mask_holding_register(reference: int, and_mask: int, or_mask: int) None
Mask write single holding register from device memory.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers from device memory.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- read_coil(reference: int) int
Read a single coil from device memory.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils device memory.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input from device memory
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs device memory.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register(reference: int) int
Read a single holding register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers from device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils from device memory.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs from device memory.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- send_function_code_8_echo_response(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Generate an echo response using the request
pdu
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- set_bus_character_overrun_count(count: int) None
Set the bus character overrun count to
count
.- Parameters:
count – the bus character overrun count
- set_bus_communication_error_count(count: int) None
Set the bus communication error count to
count
.- Parameters:
count – the bus communication error count
- set_bus_exception_error_count(count: int) None
Set the bus exception error count to
count
.- Parameters:
count – the bus exception error count
- set_bus_message_count(count: int) None
Set the bus message count to
count
.- Parameters:
count – the bus message count
- set_busy_count(count: int) None
Set the slave busy count to
count
.- Parameters:
count – the slave busy count
- set_busy_status(busy: bool = True) None
Set busy flag which will be reported in Modbus function 11.
- Parameters:
busy – if set to
True
the busy state is set to busy else not busy.
- set_device_identifier(object_id: int | None, value: str | bytes | None) None
Set a device identifier. The objects
"vendor_name"
,"product_code"
,"major_minor_version"
,"vendor_url"
,"product_name"
,"model_name"
and"user_application_name"
are predefined.Set
value
toNone
to remove an entry.Entries can be read using Modbus function code 43.14.
- Parameters:
object_id – the object identifier
value – the value to be used
- set_diagnostic_register(content: bytes) None
Set the diagnostic register to
content
- Parameters:
content – the new content for the diagnostic register
- set_exception_status(status: int) None
Set exception status to
status
.- Parameters:
status – the new exception status
- set_extended_memory(memory_number: int, records: List[int] | None) None
Set extended memory that can be read with Modbus function code 20 and written with Modbus function code 21.
If
records
isNone
the memore is removed.- Parameters:
memory_number – the memory number (0x0001 to 0xFFFF)
records – the records to be stored
- set_fifo_queue_content(address: int, content: List[int] | None) None
Set the FIFO queue content.
- Parameters:
address – the address
content – a list of integers or
None
to delete the queue contents
- set_listen_only_mode(listen_only_mode_enabled: bool = True) None
Set listen only mode.
- Parameters:
listen_only_enabled –
True
enables the listen only mode.False
disables it.
- set_slave_message_count(count: int) None
Set the slave message count to
count
.- Parameters:
count – the slave message count
- set_slave_nak_count(count: int) None
Set the slave nak count to
count
.- Parameters:
count – the slave nak count
- set_slave_no_response_count(count: int) None
Set the slave no response count to
count
.- Parameters:
count – the slave no response count
- write_coil(reference: int, value: int) None
Write a single coil to device memory.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to coils device memory.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_discrete_input(reference: int, value: int) None
Read multiple discrete inputs from device memory
- Parameters:
reference – the register reference.
value – the value to be written
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- write_discrete_input_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_discrete_input_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to discrete input device memory.
- Parameters:
reference – the discrete input reference.
data – the type or instance or the decoder for the data
- write_discrete_input_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to discrete input memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_discrete_input_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_discrete_input_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_discrete_input_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register(reference: int, value: int) None
Write single holding register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to holding registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register(reference: int, value: int) None
Write single input register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_input_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_input_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to input registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_input_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to input register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_input_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_input_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to input register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_input_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_input_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) None
Write multiple coils to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_discrete_inputs(reference: int, values: List[int]) None
Write multiple discrete inputs to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
Serial ASCII Device
- class htf.modbus.ModbusSerialASCIIDevice(com_port: str, baud: int = 9600, bytesize: int = 8, parity: str = 'E', stopbits: int = 1, rtscts: bool = False, device_address: int = 1, shared_memory: bool = False, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.SerialASCIIModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.SerialASCIIModbusResponse'>, debuglevel: int | None = None)
- Parameters:
com_port – the com port to be used
baud – the baud rate
bytesize – number of bits in a byte
parity – serial.PARITY_NONE, serial.PARITY_ODD or serial.PARITY_EVEN
stopbits – number of stopbits (1, 1.5 or 2)
rtscts – if True use flow control
device_address – the device address to be used (Slave ID)
shared_memory – if set to
True
a single shared memory is usedrequest_parser – the request parser
response_parser – the response parser
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- add_receive_event(is_communication_error: bool = False, is_character_overrun: bool = False, is_broadcast: bool = False, is_listen_only_mode: bool = False) None
Add a receive event.
- Parameters:
is_communication_error – set to
True
if a communication error occurredis_character_overrun – set to
True
if a character overrun occurredis_broadcast – set to
True
if a broadcast message was receivedis_listen_only_mode – set to
True
if the server is currently in listen only mode
- add_send_event(read_exception_sent: bool = False, slave_abort_exeception_sent: bool = False, slave_busy_exception_sent: bool = False, slave_program_nak_exception_sent: bool = False, write_timeout_occurred: bool = False) None
Add a send event. The current listen only mode is determined automatically.
- Parameters:
read_exception_sent – set to
True
if a read exception sent occurred (exception codes 1-3)slave_abort_exeception_sent – set to
True
if a slave abort exception sent occurred (execption code 4)slave_busy_exception_sent – set to
True
if a slave busy exception sent occurred (exception codes 5-6)slave_program_nak_exception_sent – set to
True
if a slave program NAK exception sent occurred (exception code 7)write_timeout_occurred – set to
True
if a write timeout occurred
- change_ascii_delimiter(delimiter: bytes) None
Change ASCII delimiter.
- Parameters:
new_lf – the new ASCII delimiter
- create_exception_response(request_pdu: RequestPDU, exception_code: str) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler to response with an exception.
- Parameters:
request_pdu – the request pdu
exception_code – the exception code to be sent
- Returns:
the response to be sent to the client
- get_bus_character_overrun_count() int
Get the bus character overrun count.
- Returns:
the bus character overrun count
- get_busy_status() bool
Return the current busy status.
- Returns:
True
if the device is busy elseFalse
- get_diagnostic_register() bytes
Return the diagnostic register
- Returns:
the content of the diagnostic register
- get_exception_status() int
Return the current exception status.
- Returns:
the current exception status
- handle_function_code_1(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 1
``Read Coils
.``.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_11(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 11
Get Comm Event Counter (Serial Line only)
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_12(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 12
Get Comm Event Log (Serial Line only)
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_15(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 15
Write Multiple Coils
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_16(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 16
Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_17(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 17
Report Slave ID (Serial Line only)
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_2(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 2
Read Discrete Inputs
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_20(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 20
Read File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_21(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 21
Write File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_22(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 22
Mask Write Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_23(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 23
Read/Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_24(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 24
Read FIFO Queue
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_3(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 3
Read Holding Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_4(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 4
Read Input Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport.
Calls a handler by mei type with the name
handle_function_code_43_mei_type_<mei type>
. To add more mei types more handlers have to be added.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43_mei_type_14(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport: Read Device Identification. Basic object ids can be read.
- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_5(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 5
Write Single Coil
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_6(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 6
Write Single Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_7(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 7
Read Exception Status
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.x Diagnostics (Serial Line only).
Calls a handler by sub function code like
handle_function_code_8_sub_function_<sub function code>
. To add more sub functions more handlers have to be added.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_0(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.0
Diagnostics Send Echo Response
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_1(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.1
Diagnostics Restart Communications Option
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_10(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.10
Diagnostics Clear counters and diagnostic register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_11(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.11
Diagnostics Bus message count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_12(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.12
Diagnostics Bus communication error count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_13(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.13
Diagnostics Bus exception error count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_14(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.14
Diagnostics Return slave message count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_15(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.15
Diagnostics Slave No Response Count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_16(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.16
Diagnostics Slave NAK Count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_17(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.17
Diagnostics Slave Busy Count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_18(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.18
Diagnostics Slave Character Overrun Count
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_2(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.2
Diagnostics Return diagnostic register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_20(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.20
Diagnostics
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_3(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.3
Diagnostics Change ASCII Input Delimiter
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_8_sub_function_4(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 8.4
Diagnostics Force Listen Only Mode
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_request(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for an incoming request.
- Parameters:
adu – a request adu
- Returns:
the command or exception handler
- mask_holding_register(reference: int, and_mask: int, or_mask: int) None
Mask write single holding register from device memory.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers from device memory.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- read_coil(reference: int) int
Read a single coil from device memory.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils device memory.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input from device memory
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs device memory.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register(reference: int) int
Read a single holding register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers from device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils from device memory.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs from device memory.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- send_function_code_8_echo_response(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Generate an echo response using the request
pdu
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- set_bus_character_overrun_count(count: int) None
Set the bus character overrun count to
count
.- Parameters:
count – the bus character overrun count
- set_bus_communication_error_count(count: int) None
Set the bus communication error count to
count
.- Parameters:
count – the bus communication error count
- set_bus_exception_error_count(count: int) None
Set the bus exception error count to
count
.- Parameters:
count – the bus exception error count
- set_bus_message_count(count: int) None
Set the bus message count to
count
.- Parameters:
count – the bus message count
- set_busy_count(count: int) None
Set the slave busy count to
count
.- Parameters:
count – the slave busy count
- set_busy_status(busy: bool = True) None
Set busy flag which will be reported in Modbus function 11.
- Parameters:
busy – if set to
True
the busy state is set to busy else not busy.
- set_device_identifier(object_id: int | None, value: str | bytes | None) None
Set a device identifier. The objects
"vendor_name"
,"product_code"
,"major_minor_version"
,"vendor_url"
,"product_name"
,"model_name"
and"user_application_name"
are predefined.Set
value
toNone
to remove an entry.Entries can be read using Modbus function code 43.14.
- Parameters:
object_id – the object identifier
value – the value to be used
- set_diagnostic_register(content: bytes) None
Set the diagnostic register to
content
- Parameters:
content – the new content for the diagnostic register
- set_exception_status(status: int) None
Set exception status to
status
.- Parameters:
status – the new exception status
- set_extended_memory(memory_number: int, records: List[int] | None) None
Set extended memory that can be read with Modbus function code 20 and written with Modbus function code 21.
If
records
isNone
the memore is removed.- Parameters:
memory_number – the memory number (0x0001 to 0xFFFF)
records – the records to be stored
- set_fifo_queue_content(address: int, content: List[int] | None) None
Set the FIFO queue content.
- Parameters:
address – the address
content – a list of integers or
None
to delete the queue contents
- set_listen_only_mode(listen_only_mode_enabled: bool = True) None
Set listen only mode.
- Parameters:
listen_only_enabled –
True
enables the listen only mode.False
disables it.
- set_slave_message_count(count: int) None
Set the slave message count to
count
.- Parameters:
count – the slave message count
- set_slave_nak_count(count: int) None
Set the slave nak count to
count
.- Parameters:
count – the slave nak count
- set_slave_no_response_count(count: int) None
Set the slave no response count to
count
.- Parameters:
count – the slave no response count
- write_coil(reference: int, value: int) None
Write a single coil to device memory.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to coils device memory.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_discrete_input(reference: int, value: int) None
Read multiple discrete inputs from device memory
- Parameters:
reference – the register reference.
value – the value to be written
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- write_discrete_input_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_discrete_input_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to discrete input device memory.
- Parameters:
reference – the discrete input reference.
data – the type or instance or the decoder for the data
- write_discrete_input_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to discrete input memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_discrete_input_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_discrete_input_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_discrete_input_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register(reference: int, value: int) None
Write single holding register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to holding registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register(reference: int, value: int) None
Write single input register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_input_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_input_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to input registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_input_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to input register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_input_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_input_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to input register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_input_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_input_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) None
Write multiple coils to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_discrete_inputs(reference: int, values: List[int]) None
Write multiple discrete inputs to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
TCP Device
- class htf.modbus.ModbusTCPDevice(bind_address: str, port: int = 502, timeout: int | float = 1.0, shared_memory: bool = False, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.TCPModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.TCPModbusResponse'>, debuglevel: int | None = None)
- Parameters:
bind_address – the ip-address to listen on
port – the port to listen on
timeout – the timeout in seconds
shared_memory – if set to
True
a single shared memory is usedrequest_parser – the request parser
response_parser – the response parser
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- create_exception_response(request_pdu: RequestPDU, exception_code: str) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler to response with an exception.
- Parameters:
request_pdu – the request pdu
exception_code – the exception code to be sent
- Returns:
the response to be sent to the client
- handle_function_code_1(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 1
``Read Coils
.``.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_15(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 15
Write Multiple Coils
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_16(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 16
Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_2(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 2
Read Discrete Inputs
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_20(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 20
Read File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_21(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 21
Write File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_22(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 22
Mask Write Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_23(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 23
Read/Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_24(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 24
Read FIFO Queue
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_3(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 3
Read Holding Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_4(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 4
Read Input Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport.
Calls a handler by mei type with the name
handle_function_code_43_mei_type_<mei type>
. To add more mei types more handlers have to be added.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43_mei_type_14(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport: Read Device Identification. Basic object ids can be read.
- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_5(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 5
Write Single Coil
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_6(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 6
Write Single Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_request(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for an incoming request.
- Parameters:
adu – a request adu
- Returns:
the command or exception handler
- mask_holding_register(reference: int, and_mask: int, or_mask: int) None
Mask write single holding register from device memory.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers from device memory.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- read_coil(reference: int) int
Read a single coil from device memory.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils device memory.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input from device memory
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs device memory.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register(reference: int) int
Read a single holding register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers from device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils from device memory.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs from device memory.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- set_device_identifier(object_id: int | None, value: str | bytes | None) None
Set a device identifier. The objects
"vendor_name"
,"product_code"
,"major_minor_version"
,"vendor_url"
,"product_name"
,"model_name"
and"user_application_name"
are predefined.Set
value
toNone
to remove an entry.Entries can be read using Modbus function code 43.14.
- Parameters:
object_id – the object identifier
value – the value to be used
- set_extended_memory(memory_number: int, records: List[int] | None) None
Set extended memory that can be read with Modbus function code 20 and written with Modbus function code 21.
If
records
isNone
the memore is removed.- Parameters:
memory_number – the memory number (0x0001 to 0xFFFF)
records – the records to be stored
- set_fifo_queue_content(address: int, content: List[int] | None) None
Set the FIFO queue content.
- Parameters:
address – the address
content – a list of integers or
None
to delete the queue contents
- write_coil(reference: int, value: int) None
Write a single coil to device memory.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to coils device memory.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_discrete_input(reference: int, value: int) None
Read multiple discrete inputs from device memory
- Parameters:
reference – the register reference.
value – the value to be written
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- write_discrete_input_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_discrete_input_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to discrete input device memory.
- Parameters:
reference – the discrete input reference.
data – the type or instance or the decoder for the data
- write_discrete_input_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to discrete input memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_discrete_input_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_discrete_input_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_discrete_input_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register(reference: int, value: int) None
Write single holding register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to holding registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register(reference: int, value: int) None
Write single input register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_input_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_input_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to input registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_input_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to input register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_input_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_input_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to input register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_input_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_input_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) None
Write multiple coils to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_discrete_inputs(reference: int, values: List[int]) None
Write multiple discrete inputs to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
UDP Device
- class htf.modbus.ModbusUDPDevice(bind_address: str, port: int = 502, shared_memory: bool = False, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.TCPModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.TCPModbusResponse'>, debuglevel: int | None = None)
- Parameters:
bind_address – the ip-address to listen on
port – the port to listen on
shared_memory – if set to
True
a single shared memory is usedrequest_parser – the request parser
response_parser – the response parser
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- create_exception_response(request_pdu: RequestPDU, exception_code: str) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler to response with an exception.
- Parameters:
request_pdu – the request pdu
exception_code – the exception code to be sent
- Returns:
the response to be sent to the client
- handle_function_code_1(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 1
``Read Coils
.``.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_15(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 15
Write Multiple Coils
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_16(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 16
Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_2(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 2
Read Discrete Inputs
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_20(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 20
Read File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_21(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 21
Write File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_22(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 22
Mask Write Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_23(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 23
Read/Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_24(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 24
Read FIFO Queue
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_3(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 3
Read Holding Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_4(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 4
Read Input Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport.
Calls a handler by mei type with the name
handle_function_code_43_mei_type_<mei type>
. To add more mei types more handlers have to be added.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43_mei_type_14(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport: Read Device Identification. Basic object ids can be read.
- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_5(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 5
Write Single Coil
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_6(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 6
Write Single Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_request(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for an incoming request.
- Parameters:
adu – a request adu
- Returns:
the command or exception handler
- mask_holding_register(reference: int, and_mask: int, or_mask: int) None
Mask write single holding register from device memory.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers from device memory.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- read_coil(reference: int) int
Read a single coil from device memory.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils device memory.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input from device memory
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs device memory.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register(reference: int) int
Read a single holding register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers from device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils from device memory.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs from device memory.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- set_device_identifier(object_id: int | None, value: str | bytes | None) None
Set a device identifier. The objects
"vendor_name"
,"product_code"
,"major_minor_version"
,"vendor_url"
,"product_name"
,"model_name"
and"user_application_name"
are predefined.Set
value
toNone
to remove an entry.Entries can be read using Modbus function code 43.14.
- Parameters:
object_id – the object identifier
value – the value to be used
- set_extended_memory(memory_number: int, records: List[int] | None) None
Set extended memory that can be read with Modbus function code 20 and written with Modbus function code 21.
If
records
isNone
the memore is removed.- Parameters:
memory_number – the memory number (0x0001 to 0xFFFF)
records – the records to be stored
- set_fifo_queue_content(address: int, content: List[int] | None) None
Set the FIFO queue content.
- Parameters:
address – the address
content – a list of integers or
None
to delete the queue contents
- write_coil(reference: int, value: int) None
Write a single coil to device memory.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to coils device memory.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_discrete_input(reference: int, value: int) None
Read multiple discrete inputs from device memory
- Parameters:
reference – the register reference.
value – the value to be written
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- write_discrete_input_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_discrete_input_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to discrete input device memory.
- Parameters:
reference – the discrete input reference.
data – the type or instance or the decoder for the data
- write_discrete_input_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to discrete input memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_discrete_input_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_discrete_input_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_discrete_input_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register(reference: int, value: int) None
Write single holding register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to holding registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register(reference: int, value: int) None
Write single input register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_input_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_input_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to input registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_input_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to input register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_input_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_input_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to input register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_input_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_input_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) None
Write multiple coils to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_discrete_inputs(reference: int, values: List[int]) None
Write multiple discrete inputs to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
TLS Device
- class htf.modbus.ModbusTLSDevice(bind_address: str, port: int = 502, shared_memory: bool = False, certfile: str | None = None, keyfile: str | None = None, password: str | None = None, request_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusRequest] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusRequest] | ~typing.Type[~htf.modbus.protocol.TCPModbusRequest] = <class 'htf.modbus.protocol.TCPModbusRequest'>, response_parser: ~typing.Type[~htf.modbus.protocol.SerialRTUModbusResponse] | ~typing.Type[~htf.modbus.protocol.SerialASCIIModbusResponse] | ~typing.Type[~htf.modbus.protocol.TCPModbusResponse] = <class 'htf.modbus.protocol.TCPModbusResponse'>, debuglevel: int | None = None)
- Parameters:
bind_address – the ip-address to listen on
port – the port to listen on
shared_memory – if set to
True
a single shared memory is usedcallback – the callback to handle requests
certfile – path to TLS certificate
keyfile – path to TLS keyfile
password – TLS password
request_parser – the request parser
response_parser – the response parser
debuglevel – the debuglevel (
None
disables debug,1
prints requests and responses and2
prints introspection)
- create_exception_response(request_pdu: RequestPDU, exception_code: str) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler to response with an exception.
- Parameters:
request_pdu – the request pdu
exception_code – the exception code to be sent
- Returns:
the response to be sent to the client
- handle_function_code_1(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 1
``Read Coils
.``.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_15(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 15
Write Multiple Coils
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_16(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 16
Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_2(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 2
Read Discrete Inputs
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_20(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 20
Read File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_21(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 21
Write File Record
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_22(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 22
Mask Write Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_23(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 23
Read/Write Multiple Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_24(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 24
Read FIFO Queue
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_3(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 3
Read Holding Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_4(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 4
Read Input Registers
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport.
Calls a handler by mei type with the name
handle_function_code_43_mei_type_<mei type>
. To add more mei types more handlers have to be added.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_43_mei_type_14(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Encapsulated Interface Transport: Read Device Identification. Basic object ids can be read.
- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_5(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 5
Write Single Coil
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_function_code_6(pdu: RequestPDU) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for function code 6
Write Single Register
.- Parameters:
pdu – the request pdu
- Returns:
the response to be sent to the client
- handle_request(adu: SerialRTUModbusRequest | SerialASCIIModbusRequest | TCPModbusRequest) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Request handler for an incoming request.
- Parameters:
adu – a request adu
- Returns:
the command or exception handler
- mask_holding_register(reference: int, and_mask: int, or_mask: int) None
Mask write single holding register from device memory.
- Parameters:
reference – the register reference
and_mask – the and mask
or_mask – the or mask
- mask_multiple_holding_registers(reference: int, quantity: int, and_mask: int, or_mask: int) None
Mask write multiple holding registers from device memory.
- Parameters:
reference – the register reference
quantity – the number of registers to be masked
and_mask – the and mask
or_mask – the or mask
- read_coil(reference: int) int
Read a single coil from device memory.
- Parameters:
reference – the register reference.
- Returns:
1
if the coil is set and0
else.
- read_coil_bitfield(reference: int, length: int) int
Read a bitfield from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_coil_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from coil memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from coils device memory.
- Parameters:
reference – the coil reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_coil_flag(reference: int) bool
Read a bit from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_coil_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_coil_nibble(reference: int) int
Read a nibble from coil memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_coil_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from coil memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input(reference: int) int
Read single discrete input from device memory
- Parameters:
reference – the register reference.
- Returns:
1
if the discrete input is set and0
else.
- read_discrete_input_bitfield(reference: int, length: int) int
Read a bitfield from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_discrete_input_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from discrete input memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from discrete inputs device memory.
- Parameters:
reference – the discrete input reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_discrete_input_flag(reference: int) bool
Read a bit from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_discrete_input_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_discrete_input_nibble(reference: int) int
Read a nibble from discrete input memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_discrete_input_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from discrete input memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register(reference: int) int
Read a single holding register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the holding register value
- read_holding_register_bdouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_bitfield(reference: int, length: int) int
Read a bitfield from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_holding_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from holding registers device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_holding_register_double21436587(reference: int) float
Read a 21436587-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_double78563412(reference: int) float
Read a 78563412-endian double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_flag(reference: int) bool
Read a bit from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_holding_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_holding_register_float2143(reference: int) float
Read a 2143-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_float3412(reference: int) float
Read a 3412-endian float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_ldouble(reference: int) float
Read a double from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_lfloat(reference: int) float
Read a float from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_holding_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_holding_register_nibble(reference: int) int
Read a nibble from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sbint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint16(reference: int) int
Read a signed 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint32(reference: int) int
Read a signed 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint64(reference: int) int
Read a signed 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_slint8(reference: int) int
Read a signed 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_string(reference: int, length: int) bytes
Read a string from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_holding_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from holding register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_holding_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_holding_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from holding register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_holding_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from holding register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register(reference: int) int
Read a single input register from device memory.
- Parameters:
reference – the register reference.
- Returns:
the input register value
- read_input_register_bdouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bdouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_bfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_bitfield(reference: int, length: int) int
Read a bitfield from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
int value read from
reference
- read_input_register_bitfield_list(reference: int, quantity: int, length: int) List[int]
Read a list of bitfields from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) ByteStruct | ByteType
Read data from input registers from device memory.
- Parameters:
reference – the register reference
data – the type or instance or the decoder for the data
- Returns:
instance of
datatype
containing the read data
- read_input_register_double21436587(reference: int) float
Read a 21436587-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double21436587_list(reference: int, quantity: int) List[float]
Read a list of 21436587-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_double78563412(reference: int) float
Read a 78563412-endian double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_double78563412_list(reference: int, quantity: int) List[float]
Read a list of 78563412-endian doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_flag(reference: int) bool
Read a bit from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
bool value read from
reference
- read_input_register_flag_list(reference: int, quantity: int) List[bool]
Read a list of bits from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of bool values read from
reference
- read_input_register_float2143(reference: int) float
Read a 2143-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float2143_list(reference: int, quantity: int) List[float]
Read a list of 2143-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_float3412(reference: int) float
Read a 3412-endian float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_float3412_list(reference: int, quantity: int) List[float]
Read a list of 3412-endian floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_ldouble(reference: int) float
Read a double from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_ldouble_list(reference: int, quantity: int) List[float]
Read a list of doubles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_lfloat(reference: int) float
Read a float from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
float value read from
reference
- read_input_register_lfloat_list(reference: int, quantity: int) List[float]
Read a list of floats from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of float values read from
reference
- read_input_register_nibble(reference: int) int
Read a nibble from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_nibble_list(reference: int, quantity: int) List[int]
Read a list of nibbles from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sbint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sbint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143(reference: int) int
Read a signed 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587(reference: int) int
Read a signed 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint21436587_list(reference: int, quantity: int) List[int]
Read a list of signed 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint2143_list(reference: int, quantity: int) List[int]
Read a list of signed 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint3412(reference: int) int
Read a signed 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint3412_list(reference: int, quantity: int) List[int]
Read a list of signed 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_sint78563412(reference: int) int
Read a signed 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_sint78563412_list(reference: int, quantity: int) List[int]
Read a list of signed 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint16(reference: int) int
Read a signed 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint16_list(reference: int, quantity: int) List[int]
Read a list of signed 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint32(reference: int) int
Read a signed 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint32_list(reference: int, quantity: int) List[int]
Read a list of signed 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint64(reference: int) int
Read a signed 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint64_list(reference: int, quantity: int) List[int]
Read a list of signed 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_slint8(reference: int) int
Read a signed 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_slint8_list(reference: int, quantity: int) List[int]
Read a list of signed 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_string(reference: int, length: int) bytes
Read a string from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
- Returns:
bytes value read from
reference
- read_input_register_string_list(reference: int, quantity: int, length: int) List[bytes]
Read a list of strings from input register memory.
- Parameters:
reference – the reference to read from
length – the length of the value
quantity – the number of elements to read
- Returns:
list of bytes values read from
reference
- read_input_register_ubint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ubint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ubint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143(reference: int) int
Read an unsigned 2143-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587(reference: int) int
Read an unsigned 21436587-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint21436587_list(reference: int, quantity: int) List[int]
Read a list of unsigned 21436587-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint2143_list(reference: int, quantity: int) List[int]
Read a list of unsigned 2143-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint3412(reference: int) int
Read an unsigned 3412-endian 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint3412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 3412-endian 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_uint78563412(reference: int) int
Read an unsigned 78563412-endian 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_uint78563412_list(reference: int, quantity: int) List[int]
Read a list of unsigned 78563412-endian 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint16(reference: int) int
Read an unsigned 16-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint16_list(reference: int, quantity: int) List[int]
Read a list of unsigned 16-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint32(reference: int) int
Read an unsigned 32-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint32_list(reference: int, quantity: int) List[int]
Read a list of unsigned 32-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint64(reference: int) int
Read an unsigned 64-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint64_list(reference: int, quantity: int) List[int]
Read a list of unsigned 64-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_input_register_ulint8(reference: int) int
Read an unsigned 8-bit integer from input register memory.
- Parameters:
reference – the reference to read from
- Returns:
int value read from
reference
- read_input_register_ulint8_list(reference: int, quantity: int) List[int]
Read a list of unsigned 8-bit integers from input register memory.
- Parameters:
reference – the reference to read from
quantity – the number of elements to read
- Returns:
list of int values read from
reference
- read_multiple_coils(reference: int, quantity: int) List[int]
Read multiple coils from device memory.
- Parameters:
reference – the register reference.
quantity – the number of coils to be read.
- Returns:
a list of coil states where each element is
1
if the corresponding coil is set and0
else.
- read_multiple_discrete_inputs(reference: int, quantity: int) List[int]
Read multiple discrete inputs from device memory.
- Parameters:
reference – the register reference.
quantity – the number of discrete inputs to be read.
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- read_multiple_holding_registers(reference: int, quantity: int) List[int]
Read multiple holding registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the holding register values
- read_multiple_input_registers(reference: int, quantity: int) List[int]
Read multiple input registers from device memory.
- Parameters:
reference – the register reference.
quantity – the number of registers to be read.
- Returns:
the input register values
- set_device_identifier(object_id: int | None, value: str | bytes | None) None
Set a device identifier. The objects
"vendor_name"
,"product_code"
,"major_minor_version"
,"vendor_url"
,"product_name"
,"model_name"
and"user_application_name"
are predefined.Set
value
toNone
to remove an entry.Entries can be read using Modbus function code 43.14.
- Parameters:
object_id – the object identifier
value – the value to be used
- set_extended_memory(memory_number: int, records: List[int] | None) None
Set extended memory that can be read with Modbus function code 20 and written with Modbus function code 21.
If
records
isNone
the memore is removed.- Parameters:
memory_number – the memory number (0x0001 to 0xFFFF)
records – the records to be stored
- set_fifo_queue_content(address: int, content: List[int] | None) None
Set the FIFO queue content.
- Parameters:
address – the address
content – a list of integers or
None
to delete the queue contents
- write_coil(reference: int, value: int) None
Write a single coil to device memory.
- Parameters:
reference – the register reference.
value – the value to be written.
- write_coil_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_coil_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_coil_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to coils device memory.
- Parameters:
reference – the coil reference.
data – the type or instance or the decoder for the data
- write_coil_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to coil memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_coil_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to coil memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_coil_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to coil memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_coil_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to coil memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_discrete_input(reference: int, value: int) None
Read multiple discrete inputs from device memory
- Parameters:
reference – the register reference.
value – the value to be written
- Returns:
a list of discrete inputs where each element is
1
if the corresponding discrete input is set and0
else.
- write_discrete_input_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_discrete_input_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_discrete_input_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to discrete input device memory.
- Parameters:
reference – the discrete input reference.
data – the type or instance or the decoder for the data
- write_discrete_input_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to discrete input memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_discrete_input_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_discrete_input_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to discrete input memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_discrete_input_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to discrete input memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register(reference: int, value: int) None
Write single holding register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_holding_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_holding_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_holding_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to holding registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_holding_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to holding register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_holding_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_holding_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to holding register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_holding_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_holding_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to holding register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_holding_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_holding_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_holding_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to holding register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_holding_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to holding register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register(reference: int, value: int) None
Write single input register to device memory.
- Parameters:
reference – the register reference.
value – the value to be written into the corresponding register.
- write_input_register_bdouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bdouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_bfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_bitfield(reference: int, value: int, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bitfield to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
length – the length of the value
- write_input_register_bitfield_list(reference: int, values: List[int], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bitfields to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
length – the length of the value
- write_input_register_data(reference: int, data: ByteStruct | ByteType | Type[ByteStruct] | Type[ByteType]) None
Write data to input registers device memory.
- Parameters:
reference – the register reference.
data – the type or instance or the decoder for the data
- write_input_register_double21436587(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 21436587-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double21436587_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 21436587-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_double78563412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 78563412-endian double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_double78563412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 78563412-endian doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_flag(reference: int, value: bool) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a bit to input register memory.
- Parameters:
reference – the reference to write to
value – the bool value to be written
- write_input_register_flag_list(reference: int, values: List[bool]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of bits to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bool values to be written
- write_input_register_float2143(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 2143-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float2143_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 2143-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_float3412(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a 3412-endian float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_float3412_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of 3412-endian floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_ldouble(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a double to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_ldouble_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of doubles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_lfloat(reference: int, value: float) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a float to input register memory.
- Parameters:
reference – the reference to write to
value – the float value to be written
- write_input_register_lfloat_list(reference: int, values: List[float]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of floats to input register memory.
- Parameters:
reference – the reference to write to
values – a list of float values to be written
- write_input_register_nibble(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a nibble to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_nibble_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of nibbles to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sbint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sbint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_sint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_sint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_slint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a signed 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_slint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of signed 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_string(reference: int, value: bytes, length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a string to input register memory.
- Parameters:
reference – the reference to write to
value – the bytes value to be written
length – the length of the value
- write_input_register_string_list(reference: int, values: List[bytes], length: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of strings to input register memory.
- Parameters:
reference – the reference to write to
values – a list of bytes values to be written
length – the length of the value
- write_input_register_ubint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ubint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ubint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 2143-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 21436587-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint21436587_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 21436587-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint2143_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 2143-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint3412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 3412-endian 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint3412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 3412-endian 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_uint78563412(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 78563412-endian 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_uint78563412_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 78563412-endian 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint16(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 16-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint16_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 16-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint32(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 32-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint32_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 32-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint64(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 64-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint64_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 64-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_input_register_ulint8(reference: int, value: int) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write an unsigned 8-bit integer to input register memory.
- Parameters:
reference – the reference to write to
value – the int value to be written
- write_input_register_ulint8_list(reference: int, values: List[int]) SerialRTUModbusResponse | SerialASCIIModbusResponse | TCPModbusResponse
Write a list of unsigned 8-bit integers to input register memory.
- Parameters:
reference – the reference to write to
values – a list of int values to be written
- write_multiple_coils(reference: int, values: List[int]) None
Write multiple coils to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
- write_multiple_discrete_inputs(reference: int, values: List[int]) None
Write multiple discrete inputs to device memory.
- Parameters:
reference – the register reference.
values – the values to be written.
Create Device Simulators with Special Behaviour
You can add special behaviour to a device to use it in tests.
For example, to simulate a device that raises an illegal_data_address
when addresses greater than 1000
are
accessed, run the following code:
from htf.modbus import ModbusSerialRTUDevice
from htf.modbus.types import ModbusRequest, ModbusResponse, RequestPDU
class TestDevice(ModbusSerialRTUDevice):
def handle_request(self, adu: ModbusRequest) -> ModbusResponse:
if adu.pdu.data.starting_address.get() > 1000:
return self.create_exception_response(adu.pdu, exception_code="illegal_data_address")
else:
return super(TestDevice, self).handle_request(adu)
The following example disables the function code 3
(read multiple holding registers) completely, returning
an illegal function
exception:
from htf.modbus import ModbusSerialRTUDevice
from htf.modbus.types import ModbusRequest, ModbusResponse, RequestPDU
class TestDevice(ModbusSerialRTUDevice):
def handle_function_code_3(self, pdu: RequestPDU) -> ModbusResponse:
return self.create_exception_response(pdu, exception_code="illegal_function")
Exceptions
- class htf.modbus.ModbusException
A Modbus exception raised by clients.
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
Memory
Memory is used to realize devices’ memory.
Memory Base
Memory base-class.
- class htf.modbus.MemoryBase(memory: MemoryBase | bytearray | None = None)
MemoryBase is the Modbus memory base-class.
- Parameters:
memory – the memory to address or
None
for new bytearray
Bit Array
- class htf.modbus.BitArray(memory: MemoryBase | bytearray | None = None)
BitArray is a bit-aligned Modbus memory for coils and discrete inputs.
- Parameters:
memory – the memory to address or
None
for new bytearray
Register Array
- class htf.modbus.RegisterArray(memory: MemoryBase | bytearray | None = None)
RegisterArray is a 2 byte-aligned Modbus memory for input and holding registers.
- Parameters:
memory – the memory to address or
None
for new bytearray
Modbus Memory
- class htf.modbus.ModbusMemory(shared_memory: bool = False)
ModbusMemory represents the physical memory of a Modbus device. It supports reading and writing of: coils, discrete inputs, input and holding registers.
- Parameters:
shared_memory – If set to
True
a single shared memory is used.
- read_coil(reference: int) int
Read a coil.
- Parameters:
reference – reference index of the coil
- Returns:
value of the coil
- read_coils_as_int(reference: int, quantity: int) int
Read one or more coils as an int.
- Parameters:
reference – reference index of the first coil
quantity – number of bits to read
- Returns:
value of coils as integer
- read_discrete_input(reference: int) int
Read a discrete input bit.
- Parameters:
reference – reference index of the discrete input
- Returns:
value of the discrete input bit
- read_discrete_input_as_int(reference: int, quantity: int) int
Read one or more discrete inputs as an int.
- Parameters:
reference – reference index of the first discrete input
quantity – number of bits to read
- Returns:
value of discrete inputs as integer
- read_holding_register(reference: int) bytearray
Read a holding register.
- Parameters:
reference – reference index of the holding register
- Returns:
value of the holding register
- read_input_register(reference: int) bytearray
Read a input register.
- Parameters:
reference – reference index of the input register
- Returns:
value of the input register
- write_coil(reference: int, value: int) None
Write one coil.
- Parameters:
reference – reference index of the coil
value – value to set the coil to
- write_discrete_input(reference: int, value: int) None
Write one discrete input.
- Parameters:
reference – reference index of the discrete input
value – value to set the discrete input to
- write_holding_register(reference: int, value: bytearray) None
Write a holding register.
- Parameters:
reference – reference index of the holding register
value – value to set the holding register to
- write_input_register(reference: int, value: bytearray) None
Write a input register.
- Parameters:
reference – reference index of the input register
value – value to set the input register to
- write_multiple_coils(reference: int, quantity: int, values: List[int]) None
Write one or multiple coils.
- Parameters:
reference – reference index of the first coil
values – values to set the coils to
- write_multiple_discrete_inputs(reference: int, quantity: int, values: List[int]) None
Write one or multiple discrete inputs.
- Parameters:
reference – reference index of the first discrete input
values – values to set the discrete input to
Protocol
Requests and Responses
Requests and responses are used as Modbus communication messages for different transports.
Serial RTU Request
Serial RTU request.
- class htf.modbus.SerialRTUModbusRequest
Modbus Serial RTU request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Serial RTU Response
Serial RTU response.
- class htf.modbus.SerialRTUModbusResponse
Modbus Serial RTU response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Serial ASCII Request
Serial ASCII request.
- class htf.modbus.SerialASCIIModbusRequest
Modbus Serial ASCII request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Serial ASCII Response
Serial ASCII response.
- class htf.modbus.SerialASCIIModbusResponse
Modbus Serial ASCII response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
TCP Request
The TCP request object which is also used for TLS.
- class htf.modbus.TCPModbusRequest
Modbus TCP request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
TCP Response
The TCP response object which is also used for TLS.
- class htf.modbus.TCPModbusResponse
Modbus TCP response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Function Code
- class htf.modbus.FunctionCode(value: int = 0, format: str | None = None)
- Parameters:
value – the initial value.
format=None – Use “hex” to format values to hexadecimal. Use “bin” to format values to binary.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- get_byte_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- is_exception() bool
Check if the current function code is an exception (msb is set).
- Returns:
True
if the current function code is an exception. ElseFalse
.
- root() ByteStruct | BitStruct
return root element
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values – the values used for fuzzing.
- up() ByteStruct | BitStruct
Return the parent element.
PDU
- class htf.modbus.ModbusPDUBase
ModbusPDUBase is the Modbus PDU base-class.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Request PDU
- class htf.modbus.RequestPDU
RequestPDU is the request protocol data unit class.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- requests_generator() Generator[Tuple[int, ByteStruct | BitStruct | ByteType | BitType], None, None]
Yields function code, abstraction tuples.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Response PDU
- class htf.modbus.ResponsePDU
ResponsePDU is the response protocol data unit class.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- responses_generator() Generator[Tuple[int, ByteStruct | BitStruct | ByteType | BitType], None, None]
Yields function code, abstraction tuples.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Exception Response
htf.modbus.ExceptionResponse
is a base class for all Modbus responses.
In case of an exception the payload is truncated automatically. Thus no special handling is needed.
- class htf.modbus.ExceptionResponse
ExceptionResponse is the response class representing invalid requests or device failures. It’s the base-class of all responses.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Coils Request
- class htf.modbus.ReadCoilsRequest
Representation of a read coils request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Coils Response
- class htf.modbus.ReadCoilsResponse
Representation of a read coils response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Discrete Inputs Request
- class htf.modbus.ReadDiscreteInputsRequest
Representation of a read discrete inputs request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Discrete Inputs Response
- class htf.modbus.ReadDiscreteInputsResponse
Representation of a read discrete inputs response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Holding Registers Request
- class htf.modbus.ReadHoldingRegistersRequest
Representation of a read holding registers request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Holding Registers Response
- class htf.modbus.ReadHoldingRegistersResponse
Representation of a read holding registers response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Input Registers Request
- class htf.modbus.ReadInputRegistersRequest
Representation of a read input registers request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Input Registers Response
- class htf.modbus.ReadInputRegistersResponse
Representation of a read input registers response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Single Coils Request
- class htf.modbus.WriteSingleCoilRequest
Representation of a write single coil request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Single Coils Response
- class htf.modbus.WriteSingleCoilResponse
Representation of a write single coil response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Single Register Request
- class htf.modbus.WriteSingleRegisterRequest
Representation of a write single register request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Single Register Response
- class htf.modbus.WriteSingleRegisterResponse
Representation of a write single register response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Exception Status Request
- class htf.modbus.ReadExceptionStatusRequest
Representation of a read exception status request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Exception Status Response
- class htf.modbus.ReadExceptionStatusResponse
Representation of a read exception status response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Variable Length Data
- class htf.modbus.VariableLengthData(length: Callable | int | None = None, value: bytes | str = b'', padding: bytes | str = b'\x00')
VariableLengthData is a class that holds an arbitrary amount of data. Its length depends on the protocol it’s embedded in.
- Parameters:
length=None – states the string length. Can be a callable (e.g. lambda) or a scalar. If set to
None
the result is a null-terminated string. If set to an Integer the result is a fixed length string padded withpadding
. If set to acallable
(lambda or function) the result is a fixed or variable length string padded withpadding
.value="" – the initial string value.
padding="x00" – that padding pattern used for filling the encoded data if value is shorter than length.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values – the values used for fuzzing.
- set_length(length: Callable | int | None) None
Set the length.
- Parameters:
length=None – states the string length. Can be a callable (e.g. lambda) or a scalar. If set to
None
the result is a null-terminated string. If set to an Integer the result is a fixed length string padded withpadding
. If set to acallable
(lambda or function) the result is a fixed or variable length string padded withpadding
.
- up() ByteStruct | BitStruct
Return the parent element.
Diagnostics Request
- class htf.modbus.DiagnosticsRequest
Representation of a diagnostics request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Diagnostics Response
- class htf.modbus.DiagnosticsResponse
Representation of a diagnostics response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Get Communication Event Counter Request
- class htf.modbus.GetCommEventCounterRequest
Representation of a get communication event counter request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Get Communication Event Counter Response
- class htf.modbus.GetCommEventCounterResponse
Representation of a get communication event counter response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Get Communication Event Log Request
- class htf.modbus.GetCommEventLogRequest
Representation of a get communication event log request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Get Communication Event Log Response
- class htf.modbus.GetCommEventLogResponse
Representation of a get communication event log response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Multiple Coils Request
- class htf.modbus.WriteMultipleCoilsRequest
Representation of a write multiple coils request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Multiple Coils Response
- class htf.modbus.WriteMultipleCoilsResponse
Representation of a write multiple coils response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Multiple Registers Request
- class htf.modbus.WriteMultipleRegistersRequest
Representation of a write multiple registers request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Multiple Registers Response
- class htf.modbus.WriteMultipleRegistersResponse
Representation of a write multiple registers response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Report Server ID Request
- class htf.modbus.ReportServerIdRequest
Representation of a report server id request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Report Server ID Response
- class htf.modbus.ReportServerIdResponse
Representation of a report server id response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Extended Memory Record Sub Request
- class htf.modbus.ReadExtendedMemoryRecordSubRequest
Representation of a read extended memory record sub request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Extended Memory Record Request
- class htf.modbus.ReadExtendedMemoryRecordRequest
Representation of a read extended memory record request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Extended Memory Record Response
- class htf.modbus.ReadExtendedMemoryRecordResponse
Representation of a read extended memory record response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Extended Memory Record Sub Request
- class htf.modbus.WriteExtendedMemoryRecordSubRequest
Representation of a write extended memory record sub request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Extended Memory Record Request
- class htf.modbus.WriteExtendedMemoryRecordRequest
Representation of a write extended memory record request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Write Extended Memory Record Response
- class htf.modbus.WriteExtendedMemoryRecordResponse
Representation of a write extended memory record response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Mask Write Request
- class htf.modbus.MaskWriteRequest
Representation of a mask write request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Mask Write Response
- class htf.modbus.MaskWriteResponse
Representation of a mask write response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Write Multiple Registers Request
- class htf.modbus.ReadWriteMultipleRegistersRequest
Representation of a write multiple registers request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read Write Multiple Registers Response
- class htf.modbus.ReadWriteMultipleRegistersResponse
Representation of a write multiple registers response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read FIFO Queue Request
- class htf.modbus.ReadFifoQueueRequest
Representation of a read fifo queue request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Read FIFO Queue Response
- class htf.modbus.ReadFifoQueueResponse
Representation of a read fifo queue response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Encapsulated Interface Transport Request
- class htf.modbus.EncapsulatedInterfaceTransportRequest
Representation of an encapsulated interface transport request.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Encapsulated Interface Transport Response
- class htf.modbus.EncapsulatedInterfaceTransportResponse
Representation of an encapsulated interface transport response.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Device Identification Object
- class htf.modbus.ReadDeviceIdentificationObject
Representation of read device identification object.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
CRC
- class htf.modbus.ModbusCrc
Calculates a reversed IBM-CRC-16 (0x8005) -> 0xa001 to be used with Modbus
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- get_byte_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values – the values used for fuzzing.
- up() ByteStruct | BitStruct
Return the parent element.
LRC
- class htf.modbus.ModbusLRC
Compute the logitudinal redudancy check for Modbus.
- Parameters:
value – the initial value.
format=None – Use “hex” to format values to hexadecimal. Use “bin” to format values to binary.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- get_byte_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values – the values used for fuzzing.
- up() ByteStruct | BitStruct
Return the parent element.
Changelog
htf-modbus-3.1.9
add serial parameters to device simulators
add methods to break checksums in clients, servers and devices for testing purposes
fix bit order for function code 15
fix LRC calculation
htf-modbus-3.1.8
add support for Python 3.13
htf-modbus-3.1.7
fix handling of address
0xFFFF
inhtf.modbus.ModbusTCPDevice
andhtf.modbus.ModbusUDPDevice
htf-modbus-3.1.6
add requirements for validation purposes
htf-modbus-3.1.5
add build environment data for validation purposes
htf-modbus-3.1.4
htf-modbus
can now be used standalone
htf-modbus-3.1.3
add support for Python 3.12
htf-modbus-3.1.2
improve connection handling in
htf.modbus.ModbusTCPDevice
andhtf.modbus.ModbusUDPDevice
htf-modbus-3.1.1
fix not correctly closed TCP connections in
htf.modbus.ModbusTCPDevice
add timeout to
htf.modbus.ModbusTCPDevice
htf-modbus-3.1.0
add type-hints
use
hlm-3.1
use
oser-3.1
htf-modbus-3.0.2
add support for oser-3.1
htf-modbus-3.0.1
add support for Python 3.11
htf-modbus-3.0.0
extract
htf-modbus
fromhtf