Last Updated on : 2024-06-18 08:09:18download
Smart locks use different protocols, such as Bluetooth, Wi-Fi, Wi-Fi with camera, and Zigbee. The Smart Lock SDK is built on top of the Smart Life App SDK. This tutorial walks you through a few steps to develop a mobile app with the SDK in an hour. You will learn how to implement the following features:
You can go to GitHub and download the sample code. This tutorial is broken down into sections based on features, making it easy for you to quickly locate the code.
App SDK Development GitHub Sample
With this tutorial and some knowledge of panel development, you will be able to create an iOS app like this.
Before starting, ensure you have the following prepared.
Create a Tuya Developer Platform account and an app, with the AppKey
and AppSecret
ready. For more information, see Preparation.
The Smart Lock SDK depends on the Smart Life App SDK. Implement creating an account and adding a home before incorporating lock-specific features. For more information, see Quick Start with Smart Life App SDK.
Prepare a Tuya-enabled lock. This tutorial demonstrates the process using a lock. Visit TuyaGo to explore Tuya-enabled products.
Integrate the Smart Life App SDK and Smart Lock SDK into your project using CocoaPods. For more information, see SDK Integration.
Tuya-enabled smart locks support all pairing modes available in the Smart Life App SDK, including Wi-Fi access point (AP) mode and Bluetooth pairing. For more information, see Device Pairing.
Before connecting, unlocking, or locking the Bluetooth lock, check the lock’s Bluetooth connection status.
Query Bluetooth connection status
- (BOOL)isBLEConnected;
- (BOOL)isOnline;
Connect to a Bluetooth lock
- (void)autoConnect;
Unlock a Bluetooth lock
- (void)bleUnlock:(NSString *)lockUserId
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Lock a Bluetooth lock
- (void)bleManualLock:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Unlock a Wi-Fi lock remotely
- (void)replyRemoteUnlock:(BOOL)open
success:(nullable ThingSuccessHandler)success
failure:(nullable ThingFailureError)failure;
Review the lock SDK documentation to explore more features.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback