File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,11 @@ class AsyncioModbusClient:
26
26
def __init__ (self , address , timeout = 1 ):
27
27
"""Set up communication parameters."""
28
28
self .ip = address
29
- port = 5020 if address == '127.0.0.1' else 502 # pymodbus simulator is 127.0.0.1:5020
29
+ self . port = 5020 if address == '127.0.0.1' else 502 # pymodbus simulator is 127.0.0.1:5020
30
30
self .timeout = timeout
31
31
self ._detect_pymodbus_version ()
32
32
if self .pymodbus30plus :
33
- self .client = AsyncModbusTcpClient (address , timeout = timeout , port = port )
33
+ self .client = AsyncModbusTcpClient (address , timeout = timeout , port = self . port )
34
34
else : # 2.x
35
35
self .client = ReconnectingAsyncioModbusTcpClient ()
36
36
self .lock = asyncio .Lock ()
@@ -57,7 +57,7 @@ async def _connect(self) -> None:
57
57
if self .pymodbus30plus :
58
58
await asyncio .wait_for (self .client .connect (), timeout = self .timeout ) # 3.x
59
59
else : # 2.4.x - 2.5.x
60
- await self .client .start (self .ip ) # type: ignore
60
+ await self .client .start (host = self .ip , port = self . port ) # type: ignore
61
61
except Exception :
62
62
raise OSError (f"Could not connect to '{ self .ip } '." )
63
63
You can’t perform that action at this time.
0 commit comments