pymodbus icon indicating copy to clipboard operation
pymodbus copied to clipboard

ReconnectingAsyncioModbusTcpClient.start yields an invalid client when the first connection does not succeed

Open lovasoa opened this issue 5 years ago • 0 comments

Description

ReconnectingAsyncioModbusTcpClient.start does start a client that tries to reconnect, but when the first connection attempt fails, the client is returned immediately instead of waiting for the next attempt.

Code and Logs

from pymodbus.client.asynchronous.asyncio import ReconnectingAsyncioModbusTcpClient
client = ReconnectingAsyncioModbusTcpClient()
await client.start(host=host, port=port)
print(client.protocol)

When the connection fails in client.start, one could expect that the client will retry the connection and yield a value only when the connection is established, or at least that it will raise an error. Instead, the connection silently fails, and the client is left in a state where client.protocol is None.

lovasoa avatar Jan 23 '20 17:01 lovasoa