_encodePre34(options) {
    // Construct payload
    let payload = options.data;

    // Protocol 3.3 and 3.2 is always encrypted
    if (this.version === '3.3' || this.version === '3.2') {
      // Encrypt data
      payload = this.cipher.encrypt({
        data: payload,
        base64: false
      });

      // Check if we need an extended header, only for certain CommandTypes
      if (options.commandByte !== CommandType.DP_QUERY &&
          options.commandByte !== CommandType.DP_REFRESH) {
        // Add 3.3 header
        const buffer = Buffer.alloc(payload.length + 15);
        Buffer.from('3.3').copy(buffer, 0);
        payload.copy(buffer, 15);
        payload = buffer;
      }
    } else if (options.encrypted) {
      // Protocol 3.1 and below, only encrypt data if necessary
      payload = this.cipher.encrypt({
        data: payload
      });

      // Create MD5 signature
      const md5 = this.cipher.md5('data=' + payload +
          '||lpv=' + this.version +
          '||' + this.key);

      // Create byte buffer from hex data
      payload = Buffer.from(this.version + md5 + payload);
    }

    // Allocate buffer with room for payload + 24 bytes for
    // prefix, sequence, command, length, crc, and suffix
    const buffer = Buffer.alloc(payload.length + 24);

    // Add prefix, command, and length
    buffer.writeUInt32BE(0x000055AA, 0);
    buffer.writeUInt32BE(options.commandByte, 8);
    buffer.writeUInt32BE(payload.length + 8, 12);

    if (options.sequenceN) {
      buffer.writeUInt32BE(options.sequenceN, 4);
    }

    // Add payload, crc, and suffix
    payload.copy(buffer, 16);
    const calculatedCrc = crc(buffer.slice(0, payload.length + 16)) & 0xFFFFFFFF;

    buffer.writeInt32BE(calculatedCrc, payload.length + 16);
    buffer.writeUInt32BE(0x0000AA55, payload.length + 20);

    return buffer;
  }
Encodes a payload into a Tuya-protocol-compliant packet for protocol version 3.3 and below.
@param {Object} options Options for encoding
@param {Buffer|String|Object} options.data data to encode
@param {Boolean} options.encrypted whether or not to encrypt the data
@param {Number} options.commandByte
command byte of packet (use CommandType definitions)
@param {Number} [options.sequenceN] optional, sequence number
@returns {Buffer} Encoded Buffer