Skip to content

Commit 8ce8001

Browse files
authored
diag sub_function_code is 2 bytes. (#2750)
1 parent adc2019 commit 8ce8001

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pymodbus/pdu/decoders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def lookupPduClass(self, data: bytes) -> type[ModbusPDU] | None:
3333
sub_func_code = int(data[2])
3434
return self.sub_lookup[func_code].get(sub_func_code, None)
3535
if func_code == 0x08: # diag message, sub_function_code is 2 bytes
36-
sub_func_code = int(data[3])
36+
sub_func_code = int.from_bytes(data[2:4], "big")
3737
return self.sub_lookup[func_code].get(sub_func_code, None)
3838
return self.lookup.get(func_code, None)
3939

0 commit comments

Comments
 (0)