pymodbus.client.async.asyncio package

Asynchronous framework adapter for asyncio.

class pymodbus.client.async.asyncio.AsyncioModbusSerialClient(port, protocol_class=None, framer=None, loop=None, baudrate=9600, bytesize=8, parity='N', stopbits=1)

Bases: object

Client to connect to modbus device over serial.

connect()

Connect Async client :return:

framer = None
protocol_lost_connection(protocol)

Protocol notification of lost connection.

protocol_made_connection(protocol)

Protocol notification of successful connection.

stop()

Stops connection :return:

transport = None
class pymodbus.client.async.asyncio.AsyncioModbusTcpClient(host=None, port=502, protocol_class=None, loop=None)

Bases: object

Client to connect to modbus device over TCP/IP.

connect()

Connect and start Async client :return:

protocol_lost_connection(protocol)

Protocol notification of lost connection.

protocol_made_connection(protocol)

Protocol notification of successful connection.

stop()

Stops the client :return:

class pymodbus.client.async.asyncio.AsyncioModbusUdpClient(host=None, port=502, protocol_class=None, loop=None)

Bases: object

Client to connect to modbus device over UDP.

connect()
protocol_lost_connection(protocol)

Protocol notification of lost connection.

protocol_made_connection(protocol)

Protocol notification of successful connection.

stop()

Stops connection :return:

class pymodbus.client.async.asyncio.BaseModbusAsyncClientProtocol(host='127.0.0.1', port=502, framer=None, source_address=None, timeout=None, **kwargs)

Bases: pymodbus.client.async.mixins.AsyncModbusClientMixin

Asyncio specific implementation of asynchronous modbus client protocol.

close()
connected

Return connection status.

connection_lost(reason)

Called when the connection is lost or closed.

The argument is either an exception object or None :param reason: :return:

connection_made(transport)

Called when a connection is made.

The transport argument is the transport representing the connection. :param transport: :return:

create_future()

Helper function to create asyncio Future object :return:

data_received(data)

Called when some data is received. data is a non-empty bytes object containing the incoming data. :param data: :return:

execute(request, **kwargs)

Starts the producer to send the next request to consumer.write(Frame(request))

factory = None
raise_future(f, exc)

Sets exception of a future if not done :param f: :param exc: :return:

resolve_future(f, result)

Resolves the completed future and sets the result :param f: :param result: :return:

transport = None
class pymodbus.client.async.asyncio.ModbusClientProtocol(host='127.0.0.1', port=502, framer=None, source_address=None, timeout=None, **kwargs)

Bases: pymodbus.client.async.asyncio.BaseModbusAsyncClientProtocol, asyncio.protocols.Protocol

Asyncio specific implementation of asynchronous modbus client protocol.

data_received(data)

Called when some data is received. data is a non-empty bytes object containing the incoming data. :param data: :return:

factory = None
transport = None
class pymodbus.client.async.asyncio.ModbusUdpClientProtocol(host=None, port=0, **kwargs)

Bases: pymodbus.client.async.asyncio.BaseModbusAsyncClientProtocol, asyncio.protocols.DatagramProtocol

Asyncio specific implementation of asynchronous modbus udp client protocol.

datagram_received(data, addr)
factory = None
class pymodbus.client.async.asyncio.ReconnectingAsyncioModbusTcpClient(protocol_class=None, loop=None)

Bases: object

Client to connect to modbus device repeatedly over TCP/IP.”

DELAY_MAX_MS = 300000
DELAY_MIN_MS = 100
protocol_lost_connection(protocol)

Protocol notification of lost connection.

protocol_made_connection(protocol)

Protocol notification of successful connection.

reset_delay()

Resets wait before next reconnect to minimal period.

start(host, port=502)

Initiates connection to start client :param host: :param port: :return:

stop()

Stops client :return:

class pymodbus.client.async.asyncio.ReconnectingAsyncioModbusUdpClient(protocol_class=None, loop=None)

Bases: object

Client to connect to modbus device repeatedly over UDP.

DELAY_MAX_MS = 300000
delay_ms = 0
protocol_lost_connection(protocol)

Protocol notification of lost connection.

protocol_made_connection(protocol)

Protocol notification of successful connection.

reset_delay()

Resets wait before next reconnect to minimal period.

start(host, port=502)

Start reconnecting async udp client :param host: Host IP to connect :param port: Host port to connect :return:

stop()

Stops connection and prevents reconnect :return:

pymodbus.client.async.asyncio.init_tcp_client(proto_cls, loop, host, port, **kwargs)

Helper function to initialize tcp client :param proto_cls: :param loop: :param host: :param port: :param kwargs: :return:

pymodbus.client.async.asyncio.init_udp_client(proto_cls, loop, host, port, **kwargs)

Helper function to initialize UDP client :param proto_cls: :param loop: :param host: :param port: :param kwargs: :return: