1111"""
1212import asyncio
1313
14- from pymodbus import pymodbus_apply_logging_config
15-
16- # --------------------------------------------------------------------------- #
17- # import the various client implementations
18- # --------------------------------------------------------------------------- #
14+ from pymodbus import Framer , pymodbus_apply_logging_config
1915from pymodbus .client import (
2016 AsyncModbusSerialClient ,
2117 AsyncModbusTcpClient ,
2420)
2521from pymodbus .exceptions import ModbusException
2622from pymodbus .pdu import ExceptionResponse
27- from pymodbus .transaction import (
28- # ModbusAsciiFramer,
29- # ModbusBinaryFramer,
30- ModbusRtuFramer ,
31- ModbusSocketFramer ,
32- ModbusTlsFramer ,
33- )
3423
3524
36- async def run_async_simple_client (comm , host , port , framer = ModbusSocketFramer ):
25+ async def run_async_simple_client (comm , host , port , framer = Framer . SOCKET ):
3726 """Run async client."""
3827
3928 # activate debugging
@@ -56,7 +45,7 @@ async def run_async_simple_client(comm, host, port, framer=ModbusSocketFramer):
5645 client = AsyncModbusUdpClient (
5746 host ,
5847 port = port ,
59- framer = ModbusSocketFramer ,
48+ framer = framer ,
6049 # timeout=10,
6150 # retries=3,
6251 # retry_on_empty=False,
@@ -67,7 +56,7 @@ async def run_async_simple_client(comm, host, port, framer=ModbusSocketFramer):
6756 elif comm == "serial" :
6857 client = AsyncModbusSerialClient (
6958 port ,
70- framer = ModbusRtuFramer ,
59+ framer = framer ,
7160 # timeout=10,
7261 # retries=3,
7362 # retry_on_empty=False,
@@ -83,7 +72,7 @@ async def run_async_simple_client(comm, host, port, framer=ModbusSocketFramer):
8372 client = AsyncModbusTlsClient (
8473 host ,
8574 port = port ,
86- framer = ModbusTlsFramer ,
75+ framer = Framer . TLS ,
8776 # timeout=10,
8877 # retries=3,
8978 # retry_on_empty=False,
0 commit comments