Vendor Model Pass-Through Specification

Last Updated on : 2024-11-20 08:51:41download

This topic specifies the format in the vendor model protocol to implement raw data pass-through, which enables the control logic or data transmission that cannot be implemented in the Bluetooth mesh model.

Overview

Tuya’s Bluetooth Low Energy (LE) mesh supports product categories including lights, electrical products, sensors, and remote controls. Most Bluetooth LE mesh product categories are based on the Bluetooth mesh model specification. For example, the Generic OnOff models make it possible to switch a lighting device on or off.

However, the Bluetooth mesh model has its limits on implementing complex functions. In this case, the vendor model is used alternatively. For example, the vendor model is used to implement scene configuration and switching for Bluetooth LE mesh lights.

Vendor model

Vendor model ID

  • Server: 0x07D00004
  • Client: 0x07D00005

Vendor model command

Commands Op_code Client: 0x07D00005 Server: 0x07D00004
WRITE 0xC9D007 Write data request. -
WRITE_UNACK 0xCAD007 Write data request without acknowledgment. -
READ 0xCCD007 Read status request. -
STATUS 0xCBD007 - Reserved
DATA 0xCDD007 - Respond to commands and report status

Frame format

Field Bytes Description
Command 1 Data type:
0x01: Data point (DP) data
0x02: Timestamp synchronization
Data length 1 This field can be ignored for DP data.
Data N -

The DP data is compressed into one packet for transmission efficiency, so the data length field is ignored.

Basic protocol

The DP is used to represent device functions defined on the Tuya Developer Platform. When the Bluetooth mesh model is used to implement functions, the app or gateway executes the following operations:

  1. Query the mapping table for the standard DP and Bluetooth mesh model, convert the DP into a mesh command, and send it to the Bluetooth mesh network.
  2. Convert a mesh command to DP, and report it to the cloud.

Data point (DP)

When the vendor model is used to implement DP data transmission, the app or gateway passes through DP data according to the format convention. The pass-through convention is as follows:

Data segment Bytes Description
dpid 1 The identifier of a DP (DP ID).
type 1 It indicates the specific data type of a DP defined on the Tuya Developer Platform, which is represented by the following value.
Types Value Length (byte) Description
Raw 0x00 N Represents a DP of raw data type.
Boolean 0x01 1 Represents a DP of Boolean data type. Valid values include 0x00 and 0x01.
Value 0x02 4 Represents a DP of value data type, in big-endian format.
String 0x03 N Represents a DP of string data type.
Enum 0x04 1 Represents a DP of enum data type, ranging from 0 to 0xFF.
Bitmap 0x05 4 Data greater than one byte is transmitted in big-endian format.
len 1 The length of data. This field is required for data types of raw, string, and bitmap.
data 1/4/N Represented in hexadecimal format. Data greater than one byte is transmitted in big-endian format.

Send commands

  • op_code: 0xC9D007 WRITE

    When the app or gateway sends the WRITE command to the device, the device responds with DATA (0xCDD007).

  • op_code: 0xCAD007 WRITE_UNACK

    When the app or gateway sends the WRITE_UNACK command, the device does not respond to this command.

    The app or gateway sends the following data:

    Field Bytes Description
    Command 1 0x01 (DP data)
    Data N DP group

Query device status

op_code: 0xCCD007 READ

The app or gateway sends DP status queries to the Bluetooth device. If the received DPID is 0, the device reports all DP status through the DATA channel.

The app or gateway sends the following data:

Field Bytes Description
Command 1 0x01 (DP data)
Data length 1 N
Data N * DP_ID (N * 1 byte) Group of DP IDs

Respond and report

op_code: 0xCDD007 DATA

The sub-device responds to the WRITE and READ commands.

The device sends:

Field Bytes Description
Command 1 0x01 (DP data)
Data N DP group