pymodbus-dev / pymodbus

A full modbus protocol written in python
Other
2.16k stars 891 forks source link

Message_Parser example not working on latest pymodbus release #2078

Closed CapraTheBest closed 4 months ago

CapraTheBest commented 4 months ago

Versions

Pymodbus Specific

Description

When trying to decode any modbus message using the example called "message_parser.py" I get nothing, even if the message is valid and/or generated manually. I've tried running it with an old version (2.5.3) and there it worked flawlessly.

Code and Logs

Intended behaviour:

PS > python .\message_parser.py --framer socket -m 0812000000170104148000800080008000800080008000800080002004
================================================================================
Decoding Message b'0812000000170104148000800080008000800080008000800080002004'
================================================================================
ServerDecoder
--------------------------------------------------------------------------------
Unable to parse message - b'\x08\x12\x00\x00\x00\x17\x01\x04\x14\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00 \x04' with <pymodbus.framer.socket_framer.ModbusSocketFramer object at 0x038F6928>
ClientDecoder
--------------------------------------------------------------------------------
name            = ReadInputRegistersResponse
transaction_id  = 0x812
protocol_id     = 0x0
slave_id        = 0x1
skip_encode     = 0x0
check           = 0x0
bits            =
                . []
registers       =
                . [32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768,
                . 32768, 8196]
documentation   = Read/write input registers.

    This function code is used to read from 1 to approx. 125 contiguous
    input registers in a remote device. The Request PDU specifies the
    starting register address and the number of registers. In the PDU
    Registers are addressed starting at zero. Therefore input registers
    numbered 1-16 are addressed as 0-15.

    The requested registers can be found in the .registers list.

Actual behaviour:

PS > python .\message_parser.py --framer socket -m 0812000000170104148000800080008000800080008000800080002004
================================================================================
Decoding Message b'0812000000170104148000800080008000800080008000800080002004'
================================================================================
ServerDecoder
--------------------------------------------------------------------------------
Unable to parse message - b'\x08\x12\x00\x00\x00\x17\x01\x04\x14\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00 \x04' with <pymodbus.framer.socket_framer.ModbusSocketFramer object at 0x034858F8>
ClientDecoder
--------------------------------------------------------------------------------
Unable to parse message - b'\x08\x12\x00\x00\x00\x17\x01\x04\x14\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00\x80\x00 \x04' with <pymodbus.framer.socket_framer.ModbusSocketFramer object at 0x03485910>
janiversen commented 4 months ago

Solved #2079.