From 6657657f438ad537f171e85b38ae32d78a3876f7 Mon Sep 17 00:00:00 2001 From: Yohrog <69543220+Yohrog@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:36:59 +0200 Subject: [PATCH] Fix usage of AsyncModbusTcpClient in client docs page (#2169) --- doc/source/client.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/client.rst b/doc/source/client.rst index 1e6e89c21..826d14dcb 100644 --- a/doc/source/client.rst +++ b/doc/source/client.rst @@ -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