# Need help finding groups in hex buffer

I have a hex buffer that contains information about my oven. I may be reinventing the wheel a bit here as some of this has been done in python.
I would like to be able to sort out any of these oven codes from the buffer.
There are more than this...
# Oven codes
ACTIVE_F_CODE_STATUS = "0x5005"
CONVECTION_CONVERSION = "0x5003"
ELAPSED_ON_TIME = "0x5004"
END_TONE = "0x5001"
HOUR_12_SHUTOFF_ENABLED = "0x5000"
KEY_PRESSED = "0x5006"
UPPER_OVEN_AVAILABLE_COOK_MODES = "0x510b"
UPPER_OVEN_COOK_MODE = "0x5100"
UPPER_OVEN_COOK_TIME_REMAINING = "0x5104"
UPPER_OVEN_CURRENT_STATE = "0x5101"
UPPER_OVEN_DELAY_TIME_REMAINING = "0x5102"
UPPER_OVEN_DISPLAY_TEMPERATURE = "0x5109"
UPPER_OVEN_ELAPSED_COOK_TIME = "0x5108"
UPPER_OVEN_KITCHEN_TIMER = "0x5105"
UPPER_OVEN_PROBE_DISPLAY_TEMP = "0x5103"
UPPER_OVEN_PROBE_PRESENT = "0x5107"
UPPER_OVEN_REMOTE_ENABLED = "0x510a"

Example hex buffer is:
e2 bf 25 80 f5 04 50 06 01 17 51 00 0d 01 01 5e 00 00 00 00 00 00 00 00 00 00 51 01 01 01 51 0a 01 01 3b ef e3

The third hex contains the total length, in this case 25
The sixth hex contains the number of groups of data, in this case 4
Second and third last hex are CRC and last hex always end in e3.
The groups are 5006, 5100, 5101 and 510a.
Is there a logical way to dynamically sort this? The groups of data changes and therefore the length and quantity of data changes as well.
Desired outcome would be:

50 06 01 17
51 00 0d 01 01 5e 00 00 00 00 00 00 00 00 00 00
51 01 01 01
51 0a 01 01

Another buffer for reference:
e2 bf 2a 80 f5 05 50 06 01 03 51 00 0d 00 01 5e 00 00 00 00 00 00 00 00 00 00 51 01 01 00 51 08 02 ff ff 51 0a 01 00 8e 7f e3

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.