Last Updated on : 2024-06-26 09:21:29download
This topic describes the procedure and APIs for smart lock development. The smart lock cloud development allows you to implement lock services on your on-premises servers through cloud-to-cloud integration and private cloud integration. This development is compatible with all your own clients, such as WeChat mini program, web system, H5 page, and branded app.
Method | Link |
---|---|
Cloud-to-cloud integration | Backed by your own servers and on top of the cloud-to-cloud integration, business data is forwarded from the Tuya IoT cloud to your own server. Path of data transmission: Device -> Tuya IoT cloud -> Your cloud server -> Your own client. |
Private cloud integration | In the private cloud mode, Tuya makes the IoT PaaS fully packaged and deployed to your private server at one time. Path of data transmission: Device -> Your cloud server -> Your own client. This mode is currently in the verification stage, characterized by a relatively high cost of private deployment. |
The following figure shows how to implement cloud development of smart locks through cloud-to-cloud integration.
Moreover, smart lock products are mainly developed based on the smart home PaaS development method. You can connect devices with Tuya’s Smart Life app, OEM apps, SDK-based apps, and WeChat mini program. Also, you can build a smart home management platform for homes and rooms.
For example, if a hardware manufacturer produces ‘Powered by Tuya’ devices and uses an OEM app, the manufacturer can easily link the OEM app with smart home projects. This way, the manufacturer can get device and user data through Tuya’s OpenAPI operations, and further create a big data management platform.
Currently, a wide array of door lock APIs applies to most types of door locks, including:
Currently, a wide array of door lock APIs applies to most features of door locks, including:
Lock feature | Available API |
---|---|
Remote unlocking | Support the remote unlocking feature. |
Unlocking over Bluetooth | Support short-range Bluetooth unlocking and remote unlocking by Bluetooth gateways. |
Password management | Support temporary passwords (valid period and expiration time), dynamic passwords (valid for five minutes), and offline passwords. |
Unlocking history | Show the unlocking history and alert history of all unlocking methods. |
Member management | On the app, bind a member with the specified unlocking method ID. |
Image | Provide an image for a remote unlocking dialog box and an unlocking record. |
Video | Support video talk and two-way talk features (mainly for smart video locks). To enable this feature, the app must integrate with the IPC SDK. Cloud-to-cloud forwarding of streaming media is also provided as a paid service. |
Lock settings | The app sends a standard instruction set to the door lock to set the volume, voice, and other settings. |
Lock status | The lock sends a standard status set to report its status to the cloud, for example, the battery status and double locking status. |
You can query API call logs for the most recent seven days preceding the current time. You can provide API request parameters by submitting a service ticket on the Tuya Developer Platform. Tuya staff will deal with and reply to your ticket within two hours. For urgent issues, you can contact project managers.
The following table lists the APIs that support smart lock services.
Request method | API name | Description |
---|---|---|
POST | /v1.0/devices/{device_id}/door-lock/password-ticket | Get a temporary key used for password encryption. |
POST | /v1.0/devices/{device_id}/door-lock/temp-password | Create a temporary password. A periodic password is supported. |
POST | /v2.0/devices/{device_id}/door-lock/temp-password | Create an unnamed temporary password. A periodic password is supported. |
POST | /v1.0/devices/{device_id}/door-lock/issue-password | Synchronize passwords. |
GET | /v1.0/devices/{device_id}/door-lock/temp-password/{password_id} | Get information about a temporary password. |
GET | /v1.0/devices/{device_id}/door-lock/temp-passwords | Get a list of temporary passwords. |
GET | /v1.0/smart-lock/devices/{device_id}/stand-by-lock-temp-passwords | Get a list of keepalive temporary passwords. |
PUT | /v1.0/devices/{device_id}/door-lock/temp-passwords/ {password_id}/modify-password |
Modify a temporary password. |
PUT | /v1.0/devices/{device_id}/door-lock/temp-passwords/ {password_id}/freeze-password |
Freeze a temporary password. |
PUT | /v1.0/devices/{device_id}/door-lock/temp-passwords/ {password_id}/unfreeze-password |
Unfreeze a temporary password. |
DELETE | /v1.0/devices/{device_id}/door-lock/temp-passwords/{password_id} | Delete a temporary password. |
POST | /v1.0/devices/{device_id}/door-lock/offline-temp-password | Get an offline password. |
POST | /v1.1/devices/{device_id}/door-lock/offline-temp-password | Get an offline password v1.1. |
PUT | /v1.0/devices/{device_id}/door-lock/offline-temp-password /{password_id} |
Update the name of an offline password. |
GET | /v1.0/devices/{device_id}/door-lock/dynamic-password | Get a dynamic password. |
POST | /v1.0/devices/{device_id}/user | Delete a device user (not a home user). |
PUT | /v1.0/devices/{device_id}/users/{user_id} | Modify a device user (not a home user). |
PUT | /v1.0/smart-lock/devices/{device_id}/users/{user_id}/actions/role | Update the role of a device user. |
DELETE | /v1.0/devices/{device_id}/users/{user_id} | Delete a device user (not a home user). |
GET | /v1.0/devices/{device_id}/users/{user_id} | Query information about a device user (not a home user). |
GET | /v1.1/devices/{device_id}/users/{user_id} | Query information about a device user (v1.1), including the current user. |
GET | /v1.0/devices/{device_id}/users | Query a list of users by device ID (not a home user). |
GET | /v1.1/devices/{device_id}/users | Query a list of users (not home users) by device ID (v1.1). |
POST | /v1.0/devices/{device_id}/device-lock/users/{user_id}/allocate | Assign a password to a device user (not a home user). |
POST | /v1.0/devices/{device_id}/door-lock/opmodes/actions/allocate | Assign unlocking methods to users. |
GET | /v1.0/smart-lock/users/{uid}/devices | Get devices linked with a user account. |
GET | /v1.0/devices/{device_id}/door-lock/user-types/{user_type}/users/{user_id}/assigned-keys | Get a list of unlocking methods linked with a specified home user. |
GET | /v1.0/devices/{device_id}/door-lock/unassigned-keys | Get a list of unlocking methods that are not linked with home users. |
POST | /v1.0/smart-lock/devices/{device_id}/opmodes/actions/sync | Sync unlocking methods by the cloud. |
PUT | /v1.0/devices/{device_id}/door-lock/actions/entry | Enroll unlocking methods used by home users. |
DELETE | /v1.0/devices/{device_id}/door-lock/user-types/{user_type}/users/{user_id}/unlock-types/{unlock_type}/keys/{unlock_no} | Delete unlocking methods used by home users. |
PUT | /v1.0/devices/{device_id}/door-lock/unlock-types/{unlock_type}/actions/cancel | Cancel enrollment of unlocking methods used by home users. |
PUT | /v1.0/devices/{device_id}/door-lock/opmodes/{unlock_sn} | Update the name of an unlocking method. |
PUT | /v1.0/devices/{device_id}/door-lock/unlock-types/{unlock_type}/keys/{unlock_no}/hijack | Set an unlocking method used by home users to trigger a duress alarm. |
GET | /v1.0/devices/{device_id}/door-lock/open-logs | Query the unlocking history. |
*GET | /v1.1/devices/{device_id}/door-lock/open-logs | Query the unlocking history. |
GET | /v1.0/devices/{device_id}/door-lock/alarm-logs | Get the alert history. |
*GET | /v1.1/devices/{device_id}/door-lock/alarm-logs | Get the alert history. |
GET | /v1.0/devices/{device_id}/door-lock/records | Get the alert history and unlocking history. |
POST | /v1.0/devices/{device_id}/door-lock/records/ {record_id}/actions/allocate |
Link a specified history with a user. |
POST | /v1.0/devices/{device_id}/door-lock/temp-passwords/rest-password | Clear temporary passwords. |
GET | /v1.0/devices/{device_id}/door-lock/remote-unlocks | Get the remote unlocking methods supported by a lock. |
POST | /v1.0/devices/{device_id}/door-lock/remote-unlock/config | Set a switch for a remote unlocking method. |
POST | /v1.0/devices/{device_id}/door-lock/open-door | Unlock with a password. |
POST | /v1.0/devices/{device_id}/door-lock/password-free/open-door | Unlock without password. |
POST | /v1.1/devices/{device_id}/door-lock/password-free/open-door | Unlock a door without a password (v1.1). A certain channel can be specified for unlocking. |
PUT | /v1.0/devices/{device_id}/door-lock/password-free/open-door/cancel | Revoke a password-free unlocking. |
GET | /v1.0/devices/{device_id}/door-lock/latest/media/url | Get a cover image of the last remote unlocking or alert. |
POST | /v1.0/devices/{device_id}/door-lock/advanced-password | Set an advanced password. |
GET | /v1.0/devices/{device_id}/door-lock/advanced-password | Query an advanced password. |
GET | /v1.0/devices/{device_id} | Get information about a specified device. You can get the local key to encrypt and decrypt a password. |
GET | /v1.0/smart-lock/devices/{device_id}/users | Get a list of home users and unlocking methods. |
PUT | /v1.0/smart-lock/devices/{device_id}/users/{user_id}/schedule | Update the validity period of a home user. |
GET | /v1.0/smart-lock/devices/{device_id}/albums-media | Get a list of albums. |
GET | /v1.0/devices/{device_id}/door-lock/absent-users | Get a list of removed users. |
POST | /v1.0/smart-lock/devices/{device_id}/users/{user_ids}/ actions/delete-users-issue |
Delete information about users. |
GET | /v1.0/smart-lock/devices/{device_id}/opmodes/{user_id} | Get a list of unlocking methods applicable to a specified user. |
DELETE | /v1.0/smart-lock/devices/{device_id}/unlock-types/{unlock_type}/keys/{unlock_sn}/hijack | Delete the duress alarms of unlocking methods. |
POST | /v1.0/smart-lock/devices/{device_id}/password-ticket | Get a temporary key used for password encryption. |
POST | /v1.0/smart-lock/devices/{device_id}/password-free/door-operate | Implement remote locking and unlocking without password. |
GET | /v1.0/smart-lock/devices/{device_id}/media-view-times | Query the number of times the videos generated by the current lock have been viewed. |
POST | /v1.0/smart-lock/devices/{device_id}/media-view-times | Increase the number of video views by one each time a video generated by the current lock is viewed. |
POST | /v1.0/smart-lock/devices/{device_id}/opmodes/{opmode_id} /attribute/{attribute}/opmode-attr |
Add an attribute to an unlocking method to specify whether to enable image capturing. |
The APIs with an asterisk (*) only apply to legacy versions.
For more information, see the following documentation.
Documentation | Applicable feature |
---|---|
Standard Instruction Set for Smart Locks | Lock settings, such as volume and language. |
Device Control | Get the standard instruction set of locks. |
Global Error Codes | A list of error codes that might be returned during your development. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback