File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ Usage: pymodbus.console tcp [OPTIONS]
4141Options:
4242 --host TEXT Modbus TCP IP
4343 --port INTEGER Modbus TCP port
44+ --framer TEXT Override the default packet framer tcp|rtu
4445 --help Show this message and exit.
4546
4647
Original file line number Diff line number Diff line change @@ -250,9 +250,19 @@ def main(ctx, verbose):
250250 type = int ,
251251 help = "Modbus TCP port" ,
252252)
253- def tcp (ctx , host , port ):
253+ @click .option (
254+ "--framer" ,
255+ default = 'tcp' ,
256+ type = str ,
257+ help = "Override the default packet framer tcp|rtu" ,
258+ )
259+ def tcp (ctx , host , port , framer ):
254260 from pymodbus .repl .client import ModbusTcpClient
255- client = ModbusTcpClient (host = host , port = port )
261+ kwargs = dict (host = host , port = port )
262+ if framer == 'rtu' :
263+ from pymodbus .framer .rtu_framer import ModbusRtuFramer
264+ kwargs ['framer' ] = ModbusRtuFramer
265+ client = ModbusTcpClient (** kwargs )
256266 cli (client )
257267
258268
You can’t perform that action at this time.
0 commit comments