You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a heat pump that manages to confuse pymodbus when asked to identify itself through RTU. When asked for the mandatory information, the response is as follows:
The pump indicate that the MEI response contain only one object, while three are sent, which calculateRtuFrameSize() in mei_message.py doesn't like at all.
I propose this method of verifying the MEI response structure:
@classmethoddefcalculateRtuFrameSize(cls, buffer):
''' Calculates the size of the message :param buffer: A buffer containing the data that have been received. :returns: The number of bytes in the response. '''size=8# skip the header informationwhilesize+2<len(buffer):
_, object_size=struct.unpack('>BB', buffer[size:size+2])
size+=object_size+2returnsize+2
Instead of trying to read the specified number of objects, this read objects until the input buffer is exhausted, returning a valid length for a certain class of malformed MEI responses. The same method of parsing the response is used in ReadDeviceInformationResponse.decode().
The text was updated successfully, but these errors were encountered:
We have a heat pump that manages to confuse pymodbus when asked to identify itself through RTU. When asked for the mandatory information, the response is as follows:
0x01 00x2b 0x0e 0x01 0x01 0x00 0x00 0x01 0x00 0x04 NIBE 0x01 0x08 F1345-60 0x02 0x04 4150 0xab 0x9a
The pump indicate that the MEI response contain only one object, while three are sent, which calculateRtuFrameSize() in mei_message.py doesn't like at all.
I propose this method of verifying the MEI response structure:
Instead of trying to read the specified number of objects, this read objects until the input buffer is exhausted, returning a valid length for a certain class of malformed MEI responses. The same method of parsing the response is used in ReadDeviceInformationResponse.decode().
The text was updated successfully, but these errors were encountered: