The payload is appended immediately after this. The checksum at 0x20 is calculated *after* the payload is appended, and covers the entire packet (including the checksum at 0x34). Therefore:
4. Set the checksum initialisation value to 0xbeaf and calculate the checksum of the entire packet. Set 0x20-0x21 to this value.
Authorisation
-------------
You must obtain an authorisation key from the device before you can communicate. To do so, generate an 80 byte packet with the following contents:
|Offset|Contents|
|------|--------|
|0x00-0x03|00|
|0x04-0x12|A 15-digit value that represents this device. Broadlink's implementation uses the IMEI.|
|0x13|01|
|0x14-0x2c|00|
|0x2d|0x01|
|0x30-0x7f|NULL-terminated ASCII string containing the device name|
Send this payload with a command value of 0x0065. The response packet will contain an encrypted payload from byte 0x38 onwards. Decrypt this using the default key and IV. The format of the decrypted payload is:
|Offset|Contents|
|------|--------|
|0x00-0x03|Device ID|
|0x04-0x13|Device encryption key|
All further command packets must use this encryption key and device ID.
Entering learning mode
----------------------
Send the following 16 byte payload with a command value of 0x006a:
|Offset|Contents|
|------|--------|
|0x00|0x03|
|0x01-0x0f|0x00|
Reading back data from learning mode
------------------------------------
Send the following 16 byte payload with a command value of 0x006a:
|Offset|Contents|
|------|--------|
|0x00|0x04|
|0x01-0x0f|0x00|
Byte 0x22 of the response contains a little-endian 16 bit error code. If this is 0, a code has been obtained. Bytes 0x38 and onward of the response are encrypted. Decrypt them. Bytes 0x04 and onward of the decrypted payload contain the captured data.
Sending data
------------
Send the following payload with a command byte of 0x006a
Captures of IR codes from the device will always end with a constant OFF value of `0x00 0x0d 0x05` but the trailing silence can be anything on transmit. The likely reason for this value is a capped timeout value on detection. The value is about 102 milliseconds.