Skip to content

Commit

Permalink
Fix usage of AsyncModbusTcpClient in client docs page (#2169)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohrog authored and janiversen committed Jun 18, 2024
1 parent 170d92b commit 6657657
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 6657657

Please sign in to comment.