Last Updated on : 2024-06-21 03:35:19download
This topic describes the implementation of Bluetooth lock functions. For example, you can pair the device, view unlocking records, view alerts, and manage passwords.
For first-time pairing or pairing again after a device is removed, you do not need to manually set the data points (DPs).
After successful pairing, power on the module to transmit data and wait for the server connection result returned from the module.
Protocol:
0x01
: Get microcontroller unit (MCU) information.0x02
: Request the working mode of the module.0x03
: Send the working status of the module.0x04
: Reset the module.Display the current battery level of a device.
DP 8: the remaining battery capacity.
DP 9: the battery level.
Note: Select either of these DPs. If both DPs are selected, the battery level is displayed. You can select a DP based on your device requirements.
0
to 100
.Protocol: 0x07
is used to report real-time status.
View the unlocking records on the app.
DP 12: unlock the door with fingerprints
DP 13: unlock the door with passwords
DP 14: unlock with dynamic passwords
DP 15: unlock the door with cards
DP 16: unlock the door with mechanical keys
DP 17: door opening and closing events
DP 18: unlock from the inside of the door
DP 19: Bluetooth-based unlocking records
DP 39: unlock with face recognition
DP 41: unlock with irises
DP 42: unlock with palm prints
DP 43: unlock with finger veins
DP 55: unlock with temporary passwords
Note: Contact the project manager to grant permissions and allow users to view the unlocking records on the app without the limit on the number of displayed records.
0
to 999
. The unlocking records are displayed on the app and show member information in each entry.0
to 999
. The unlocking records are displayed on the app and do not show member information in each entry.When the door is opened, the DP of the used unlocking method is reported. If the door is disconnected from the network, the time when an unlocking event occurs must be recorded. Therefore, we recommend that the records of actual status are reported. In this case, the module stores the records that failed to be reported and reports them along with other latest unlocking records after network recovery. The records use the local time of the device. The following table describes the DP values.
Unlocking method | DP to be reported | DP value |
---|---|---|
Unlock with fingerprints | Unlock with fingerprints | Indicate the actual DP status. |
Unlock with passwords | Unlock with passwords | Indicate the actual DP status. |
Unlock with dynamic passwords | Unlock with dynamic passwords | Any values are supported. |
Unlock with cards | Unlock with cards | Indicate the actual DP status. |
Unlock with mechanical keys | Unlock with mechanical keys | Any values are supported. |
Unlock from the inside of the door | Unlock from the inside of the door | 00/01 |
Unlock with Bluetooth connections | Unlock with Bluetooth connections | Indicate the actual DP status. |
Unlock with face recognition | Unlock with face recognition | Indicate the actual DP status. |
Unlock with irises | Unlock with irises | Indicate the actual DP status. |
Unlock with palm prints | Unlock with palm prints | Indicate the actual DP status. |
Unlock with finger veins | Unlock with finger veins | Indicate the actual DP status. |
Unlock with temporary passwords | Unlock with temporary passwords | Any values are supported. |
Protocol: 0xE0
is used to report status records.
If an alert is triggered, the app instantly shows the alert. Users can view the alerts on the app.
Note: Contact the project manager to grant permissions to allow users to view the unlocking records on the app without the limit on the number of displayed records.
Implementation logic
After an alert is triggered, the MCU reports the specified alert DP value.
Note: When status records are reported, the accurate local time of the device is included in the records. If the local time of the device lags behind the actual time, when the app receives an alert, the alert icon on the app does not blink. Users can tap the icon to view the alert. If the server time prevails, after the device is reconnected after network recovery, the record time does not reflect the actual event time.
Flowchart
Protocol: 0xE0
is used to report status records.
The user sets a temporary password on the app. A visitor can enter the temporary password within the validity period of the password to unlock the door. To enable this function, a real-time clock (RTC) must be integrated into the smart lock. We recommend that you get the temporary password and store it locally on the lock.
The user sets a dynamic password on the app. A visitor can enter the dynamic password within the validity period of the password to unlock the door.
DP 14: unlock with dynamic passwords
A dynamic password is generated on the app. When a visitor uses this dynamic password to unlock the door, the lock reports this event. The module returns the verification result. The lock controls the unlocking operation based on the verification result. The dynamic password can be used on an offline lock. The password is valid within five minutes after it is generated and must be generated again after the password expires.
Note: The dynamic password is generated on the app. Currently, administrator password comparison is not supported by the all-in-one Bluetooth lock panels but is supported on the embedded system and server.
Protocol: 0xE6
is used to get a one-time dynamic password.
DP 25: SMS notifications
This DP is optional. This function is a paid offer.
After you select this DP, go to the Functional Expansion tab on the value-added services (VAS) platform and subscribe to the Door Lock SMS Notification function.
Note: No protocol settings are required to enable this function.
Add, modify, or delete unlocking methods on the app. Then, the lock applies these settings and returns the setting results. These settings are associated with the home members of the lock.
The implementation process is complex. For more information, see DP Reference.
After the door is connected with the app over Bluetooth, users can tap a specific button on the app to unlock the door.
After the door is connected with the app over Bluetooth, users can tap a specific button on the app or talk to a smart speaker to unlock the door.
Manage permissions of different members on the app.
Role | Belong to the home served by the device | App account created | Manage administrators and common members (add, modify, query, and delete) | Manage cards, passwords, and fingerprints | Temporary passwords | Dynamic passwords and remote unlocking on the app | Validity period | View records and device status |
---|---|---|---|---|---|---|---|---|
Administrator | Yes | Yes | Yes | Yes | Yes | Yes | Permanent | Yes |
Home member | Yes | Yes | No | Optional, enabled by default, and can be disabled | No | Optional, enabled by default, and can be disabled | Permanent | Yes, only the unlocking records for the specified account available |
Sharing by common members | No | Yes | No | Optional, enabled by default, and can be disabled | No | Optional, enabled by default, and can be disabled | Optional | Yes, only the unlocking records for the specified account available |
Common members | No | No | No | Optional, enabled by default, and can be disabled | No | Optional, enabled by default, and can be disabled | Optional | Yes, only the unlocking records for the specified account available |
Use the 0x0E
command to implement the radio frequency (RF) test during a production test of the lock.
Test tool: Bluetooth beacon provided by Tuya. This tool is used to emit a broadcast signal named ty_mdev
.
Test steps: Put the beacon about 0.5 meters away from the module. Send the RF test command through the serial port. The module searches for the Bluetooth beacon and returns the signal strength value. If the signal strength is greater than -70 dB, the RF of the module works as expected.
To send push notifications to the app, configure this function on the Tuya Developer Platform. For more information, see Configure Push Notification.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback