Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of AsyncModbusTcpClient in client docs page #2169

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/source/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ is done in a few simple steps, like the following synchronous example::

and a asynchronous example::

from pymodbus.client import ModbusAsyncTcpClient
from pymodbus.client import AsyncModbusTcpClient

client = ModbusAsyncTcpClient('MyDevice.lan') # Create client object
client = AsyncModbusTcpClient('MyDevice.lan') # Create client object
await client.connect() # connect to device, reconnect automatically
await client.write_coil(1, True, slave=1) # set information in device
result = await client.read_coils(2, 3, slave=1) # get information from device
print(result.bits[0]) # use information
client.close() # Disconnect device

The line :mod:`client = ModbusAsyncTcpClient('MyDevice.lan')` only creates the object it does not activate
The line :mod:`client = AsyncModbusTcpClient('MyDevice.lan')` only creates the object it does not activate
anything.

The line :mod:`await client.connect()` connects to the device (or comm port), if this cannot connect successfully within
Expand Down