Last Updated on : 2025-12-25 08:38:41download
The generic Bluetooth Low Energy (LE) module can integrate with Tuya’s door lock technology to support features for standard locks.
Applies to products using Tuya’s standard door lock technology solution.
The following table lists the commands used in the generic Bluetooth LE module.
| Command | Description |
|---|---|
| 0xA7 | Verify dynamic passwords |
| 0xA2 | Verify offline passwords |
| 0xA6 | Configure lock features |
| 0xA8 | Configure automatic unlocking in standard lock solutions |
The MCU sends the following data.
| No. | Bytes | Field | Description |
|---|---|---|---|
| 0 1 |
2 | Header | 0x55 0xAA |
| 2 | 1 | Version number | 0x00 |
| 3 | 1 | Command (CMD) | 0xA7 |
| 4 5 |
2 | Data length (Len) | Upper 8 bits Lower 8 bits |
| 6 to 6+Len-1 | Len | Data | See the following table |
| 6+Len | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
| 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | N byte(s) |
|---|---|---|---|---|---|---|---|---|
| TimeSource | 2000+Year | Mon | Day | Hour | Min | Sec | Code_len | Code |
TimeSource: Set it to 0x00.
0x00: Use the time data Year, Mon, Day, Hour, Min, and Sec uploaded by the MCU.
0x01: Use the internal time of the module. The Year, Mon, Day, Hour, Min, and Sec uploaded by the MCU are not parsed.
The MCU uploads the date and time in GMT. For example, 12:00:00 on June 20, 2020 is represented by 0x14 0x06 0x14 0x04 0x00 0x00 in GMT.
Code_len: The length of the password.
Code: The password. The command 0xE6 requires that the password be transferred in ASCII, while with this command 0xA7, the MCU can send the digit directly. For example, 1 is 0x01, and 9 is 0x09. See the following example.
Example
55 AA 00 A7 00 10 00 14 0A 09 0D 33 2C 08 01 08 05 08 06 04 04 05 7A
The module returns the following data.
| No. | Bytes | Field | Description |
|---|---|---|---|
| 0 1 |
2 | Header | 0x55 0xAA |
| 2 | 1 | Version number | 0x00 |
| 3 | 1 | Command (CMD) | 0xA7 |
| 4 5 |
2 | Data length (Len) | Upper 8 bits Lower 8 bits |
| 6 to 6+Len-1 | Len | State | Return value |
| 6+Len | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Return value of state:
0x00: Password verification succeeded.0x01: Password verification failed.Example
55 AA 00 A7 00 01 01 A8, indicating password verification failed.55 AA 00 A7 00 01 00 A7, indicating password verified.If your MCU is connected to an external clock, we recommend you choose 0x00 for the clock source to use the time data from the MCU. If you use the internal clock of the module as the clock source, consult the R&D for a test program to measure the clock error.
The MCU sends the following data.
| No. | Bytes | Field | Description |
|---|---|---|---|
| 0 1 |
2 | Header | 0x55 0xAA |
| 2 | 1 | Version number | 0x00 |
| 3 | 1 | Command (CMD) | 0xA2 |
| 4 5 |
2 | Data length (Len) | Upper 8 bits Lower 8 bits |
| 6 to 6+Len-1 | Len | Data | See the following table |
| 6+Len | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
| 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | N byte(s) |
|---|---|---|---|---|---|---|---|---|
| TimeSource | 2000+Year | Mon | Day | Hour | Min | Sec | Code_len | Code |
TimeSource: Set it to 0x00.
0x00: Use the time data Year, Mon, Day, Hour, Min, and Sec uploaded by the MCU.
0x01: Use the internal time of the module. The Year, Mon, Day, Hour, Min, and Sec uploaded by the MCU are not parsed.
The MCU uploads the date and time in GMT. For example, 12:00:00 on June 20, 2020 is represented by 0x14 0x06 0x14 0x04 0x00 0x00 in GMT.
Code_len: The length of the password.
Code: The password. The dynamic password is transferred in ASCII, while for the offline password, the MCU can send the digit directly. For example, 1 is 0x01, and 9 is 0x09. See the following example.
The module returns the following data.
| No. | Bytes | Field | Description |
|---|---|---|---|
| 0 1 |
2 | Header | 0x55 0xAA |
| 2 | 1 | Version number | 0x00 |
| 3 | 1 | Command (CMD) | 0xA2 |
| 4 5 |
2 | Data length (Len) | Upper 8 bits Lower 8 bits |
| 6 to 6+Len-1 | Len | Data | See the following table |
| 6+Len | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
| 1 byte | 1 byte | 1 byte | N byte(s) |
|---|---|---|---|
| Result | Type | Decode_len | Decode |
Result:
0x00: Correct.Type:
0x00: The password is verified.0x01: A single password is cleared.0x02: All passwords are cleared.Code_len: The length of the encrypted data.
code: The encrypted clear code and unlocking password.
Type and code are used to report DP status. The DPs related to the offline password feature are DP ID 65, 66, and 67.
For example, use the internal time of the module plus password (2279084005)
55 AA 00 A2 00 12 01 00 00 00 00 00 00 0A 02 02 07 09 00 08 04 00 00 05 E355 AA 00 A2 00 13 00 00 10 F3 50 3C 8F FF 03 F5 E9 0D 54 99 2A 62 A1 DE 42 F9The MCU sends the following data.
| No. | Bytes | Field | Description |
|---|---|---|---|
| 0 1 |
2 | Header | 0x55 0xAA |
| 2 | 1 | Version number | 0x00 |
| 3 | 1 | Command (CMD) | 0xA6 |
| 4 5 |
2 | Data length | 0x00 0x04 |
| 6 to 9 | 4 | DATA | See the following table |
| 10 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
CFG format:
| Configuration item 0 | Configuration item 1 | Configuration item 2 | Configuration item 3 |
|---|---|---|---|
| 1 | 2 | 3 | 4 |
| FLAG | PWD_NUM | PWD_BEGIN_NUM | Disconnect duration in case of accessory pre-connection timeout (BK3633 only) |
FLAG:
Bit 0: Enable the lock accessory. 0 is for disabling, and 1 is for enabling. This feature is disabled by default, but enabled for BK3633 by default.
Bit 1: Enable accessory-triggered locking and unlocking. 0 is for disabling, and 1 is for enabling. This feature is disabled by default.
Bit 0 and bit 1 are mutually exclusive. When you enable either of them, the other is disabled automatically.
Bit 2 to bit 7: Reserved.
PWD_NUM: The number of digits on the keypad, defaulting to 10 (that is, 0 to 9). If a keypad only has 4 to 9 consecutive digits, the MCU can use this field to configure the keypad. PWD_BEGIN_NUM is used to set the starting digit, which can be 0 or 1.
The valid values of PWD_NUM range from 4 to 10. Invalid values will apply the default setting of 10 digits.
PWD_BEGIN_NUM: The starting digit, which can be 0 or 1. If the keypad starts from 0, set it to 0x00. If the keypad starts from 1, set it to 0x01.
The valid values of PWD_BEGIN_NUM are 0x00 and 0x01. Invalid values will apply the default 0x00.
Accessory connection timeout: When an accessory initiates a pre-connection to a door lock, if no further lock/unlock command is received after successfully connecting to the lock, the accessory will proactively disconnect the Bluetooth connection with the door lock.
Example
55 AA 00 A6 00 04 01 00 00 00 AA: Can be used as a door lock that can be locked/unlocked by accessories.55 AA 00 A6 00 04 02 00 00 00 AB: Can be used as an accessory that can control door locks.55 AA 00 A6 00 04 01 0A 00 00 B4: The number of password digits is 10, and the digits range from 0 to 9.The module returns the following data.
| No. | Bytes | Field | Description |
|---|---|---|---|
| 0 1 |
2 | Header | 0x55 0xAA |
| 2 | 1 | Version number | 0x00 |
| 3 | 1 | Command (CMD) | 0xA6 |
| 4 5 |
2 | Data length | 0x00 0x01 |
| 6 | 1 | State | Return value |
| 7 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Return value of state:
0x00: SuccessThe MCU sends the following data.
| No. | Length (byte) | Field | Description |
|---|---|---|---|
| 0 1 |
2 | Header | 0x55 0xAA |
| 2 | 1 | Version number | 0x00 |
| 3 | 1 | Command (CMD) | 0xA8 |
| 4 5 |
2 | Data length | 0x00 0x06 |
| 6 to 11 | 6 | CFG | See the following table |
| 12 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
CFG format:
| 1 byte | 1 byte | 2 bytes | 2 bytes |
|---|---|---|---|
| 1 | 2 | 3 to 4 | 4 to 5 |
| operation | config_type | ibeacon_interval | timeout |
operation:
0x00: Turn off anti-lost iBeacon.0x01: Turn on anti-lost iBeacon.0x02: Turn off auto-unlocking iBeacon.0x03: Turn on auto-unlocking iBeacon.config_type:
0x00: Use the default configuration. Set ibeacon_interval and timeout to 0x00.0x01: Use the custom configuration. See the fieldibeacon_interval and timeout.ibeacon_interval: The iBeacon advertising interval in low power mode in the unit of 100 ms, ranging from 100 ms to 2,000 ms. The actual advertising interval is ibeacon_interval × 100 ms. It is fixed to 100 ms in standard power mode.
With iBeacon turned on, the advertising interval is as follows:
0xE2. With iBeacon turned on, the device advertises with the ibeacon_interval in low power mode.ibeacon_interval.ibeacon_interval. The interval for switching between advertising contents is one second, which is not configurable. Make sure ibeacon_interval is less than one second.timeout: iBeacon timeout in the unit of 5s. That is, iBeacon times out in 5 × timeout seconds. The valid values range from 5s to 2 min. The auto-unlocking feature has no timeout and needs to be configured to be turned off.
Example
55 AA 00 A8 00 06 01 00 00 00 00 00 AE55 AA 00 A8 00 06 03 00 00 00 00 00 B0The module returns the following data.
| No. | Length (byte) | Field | Description |
|---|---|---|---|
| 0 1 |
2 | Header | 0x55 0xAA |
| 2 | 1 | Version number | 0x00 |
| 3 | 1 | Command (CMD) | 0xA8 |
| 4 5 |
2 | Data length | 0x00 0x01 |
| 6 | 1 | State | Return value |
| 7 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Return value of state:
0x00: SuccessThis interface is used to configure the DP-specific features. It applies to three features:
If the module is intended to function as a door lock, configuration is not necessary as door lock functionality is the default. If the module needs to function as an accessory, the MCU should send the configuration to the module after the UART initialization. The configuration is stored in the nonvolatile memory.
PWD_NUM: The number of digits on the keypad, defaulting to 10 (0 to 9). If a keypad only has 4 to 9 consecutive digits, the MCU can use this field to configure the keypad. PWD_BEGIN_NUM is used to set the starting digit, which can be 0 or 1.
The valid values of PWD_NUM range from 0x04 to 0x09. Invalid values will apply the default setting of 10 digits.
PWD_BEGIN_NUM: The starting digit, which can be 0 or 1. If the keypad starts from 0, set it to 0x00. If the keypad starts from 1, set it to 0x01.
The valid values of PWD_BEGIN_NUM are 0x00 and 0x01. Invalid values will apply the default 0x00.
Example
Example 1: If the keypad has digits 1 through 6, set the PWD_NUM to 6 and PWD_BEGIN_NUM to 1.
Example 2: If the keypad has digits 0 through 8, set the PWD_NUM to 9 and PWD_BEGIN_NUM to 0.
DPs in Accessory DP Reference and command 0xA6 together implement the lock accessory feature. You do not need to take care of the Bluetooth pairing and reconnection, which has been implemented in the generic firmware.
Double identity verification in the service layer is implemented to ensure the security of the lock.
The cloud assigns the central (app or accessory) a unique code that consists of the central ID and a central random number to identify the central device.
The cloud assigns the peripheral (lock) a unique code that consists of the peripheral ID and a peripheral random number to identify the peripheral device.
After the cloud sends the app’s unique code and the lock’s peripheral ID to the lock, the lock is considered to be paired with the app.
After the cloud sends the unique code of the accessory to the lock and sends the unique code of the accessory and the peripheral ID of the lock to the accessory, the lock is considered to be paired with the accessory.
The smart lock stores the following information:
An accessory stores the following information:
So far, the accessory can unlock the door. Before unlocking, it tells the lock the unique code of itself and the peripheral ID of the lock for verification.
The module will transmit the obtained raw data to the MCU for processing.
The MCU enables the lock accessory feature through the command 0xA6.
After the module receives the unlock/lock command from the MCU, it will retrieve the accessory information according to the peripheral ID. If the accessory has been added, it can unlock or lock the door. Then, the module will initiate a connection request and forward the unlock/lock DP to the lock for command execution.
| Description | Data transmission |
dp_id (1 byte) |
dp_type (1 byte) |
dp_data _len (1 byte) |
dp_data_value | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Unlock and lock |
Send | 71 | Raw | len | Central ID (2 bytes) |
Peripheral ID (2 bytes) |
Random number (8 bytes) |
Operation (1 byte) |
Lock/unlock timestamp (4 bytes) |
Lock/unlock method (1 byte) |
Lock/unlock info (len-12 bytes) |
|||
| 0 to 10000 | 0 to 10000 | Random number for central device | 0x00: Lock 0x01: Unlock 0xFF: Pre-connection (BK3633 only) |
Description | Description | Description | ||||||||
| Report | 71 | Raw | len | Peripheral ID (2 bytes) |
Central ID (2 bytes) |
Random number (8 bytes) |
Operation (1 byte) |
Lock/unlock timestamp (4 bytes) |
Lock/unlock method (1 byte) |
Return value (1 byte) |
||||
| 0 to 10000 | 0 to 10000 | Same as above | Same as above | Same as above | Same as above | Value range | ||||||||
Central ID and random number: When the accessory’s MCU reports the unlock DP 71 to the accessory, the corresponding fields should be padded with zeros. The module does not process this. Based on the connected peripheral ID, the module will automatically fill in the central ID and random number.
Peripheral ID: The MCU must populate this field. If it is set to 0xFFFF, the module will connect to the door lock that has already been bound. If multiple door locks are bound, it will only control the one it successfully connects to during that instance. The MCU can also specify a peripheral ID. When the app adds an unlocking method, it will send the peripheral ID corresponding to that unlocking method to be added.
Operation type: 0xFF is only supported in module-based solutions. It is used to trigger the accessory to establish a Bluetooth connection with the door lock in advance. This facilitates faster lock/unlock control after the accessory completes permission verification. If no subsequent lock/unlock command is received within the pre-connection timeout period, the Bluetooth connection will be disconnected.
The position of the central ID and the peripheral ID is exchanged.
DP ID 73 is processed the same way.
After the MCU receives data of DP ID 71, it stores the central ID, peripheral ID, and random number that will be used when the MCU reports the locking or unlocking record.
| Description | Data transmission |
dp_id (1 byte) |
dp_type (1 byte) |
dp_data _len (1 byte) |
dp_data_value | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Lock &unlock record |
Report | 72 | Raw | len | Peripheral ID (2 bytes) |
Central ID (2 bytes) |
Random number (8 bytes) |
Operation (1 byte) |
Lock/unlock timestamp (4 bytes) |
Lock/unlock method (1 byte) |
Lock/unlock info (len-12 bytes) |
|||
| 0 to 10000 | 0 to 10000 | Random number for central device | 0x00: Lock 0x01: Unlock |
Description | Description | Description | ||||||||
The accessory’s MCU should store:
Peripheral ID (the lock ID): The lock ID will be sent to the MCU when an unlocking method is added. For more information, see the DP protocol specification.
For data from other DPs, the module will not process it, but directly send the raw data to the MCU, except for the offline password T0 parameter and the single/multi-unlock settings. The MCU must reply with the corresponding DP command (including offline password T0 and single/multi-unlock settings).
During door lock and accessory pairing, the door lock information sent via the pass-through channel will be directly handled by the module, requiring no operation from the MCU.
After the connection is established, the accessory will forward the lock/unlock DP reported by the MCU to the lock and a 30s timer is started. If the lock does not respond with the result within 30s, the Bluetooth connection will be disconnected. If the MCU returns a result, the module also disconnects from the Bluetooth accessory.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback