@rentlydev/rently-tuya
v0.2.2
Published
rently-tuya
Downloads
702
Readme
@rentlydev/rently-tuya
A React Native module for integrating the Tuya Doorbell SDK, enabling applications to interact with Tuya-compatible smart doorbells. This library provides essential functionalities such as device pairing, live preview, and push notification registration, ensuring a seamless smart home experience.
Fully compatible with TypeScript.
Supported platforms
| Platform | Support | |---|---| | iOS | ✅ | | Android | ✅ | | Web | ❌ | | Windows | ❌ | | macOS | ❌ |
Installation
npm install @rentlydev/rently-tuyaor
yarn add @rentlydev/rently-tuyaConfiguration and Permissions
iOS
(Configuration details to be added)
Android
(Configuration details to be added)
Summary
Methods
initAirbrakegetCurrentWifigetDeviceDatasetTuyaHomegetTokenForQRCodeinitActivatorForQRCodeloginWithUidlogoutopenCameraLivePreviewregisterForPushNotificationrenameDeviceresetDevice
Listeners
Usage
initAirbrake
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.initAirbrake({ key: '', id: '' });Parameters:
key(String) - Airbrake Project Key.id(String) - Airbrake Project Id.
getCurrentWifi
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.getCurrentWifi();Response:
(String) - Current connected Wi-Fi name.
getDeviceData
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.getDeviceData({ devId: '' });Parameters:
devId(String) - Doorbell Device Id.
setTuyaHome
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.setTuyaHome({ homeId: '' })Parameters:
homeId(String) - Home Id associated with Doorbell.
getTokenForQRCode
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.getTokenForQRCode({ homeId: '' })Parameters:
homeId(String) - Home Id associated with Doorbell.
Response:
(String) - Token required for QR code activation.
initActivatorForQRCode
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.initActivatorForQRCode({
ssid: '',
paasword: '',
time: '',
token: ''
})Parameters:
ssid(String) - Wi-Fi name.password(String) - Wi-Fi Password.time(String) - Timeout for activation.token(String) - Token from getTokenForQRCode.
loginWithUid
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.loginWithUid({
uid: '',
paasword: '',
countryCode: ''
})Parameters:
uid(String) - Login Uid.password(String) - Login Password.countryCode(String) - Login Country code.
logout
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.logout()openCameraLivePreview
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.openCameraLivePreview({
id: '',
countryCode: '',
uid: '',
passwd: '',
devId: '',
homeId: '',
last_moveout_at: '',
resetRequired: true,
isResident: true,
display_remove_doorbell_button: true,
propertyCredentialUsername: '',
propertyCredentialPassword: '',
tuya_product_name: '',
device_uuid: '',
serial_no: '',
flavour: '',
doorbell_default_settings_updated: true,
motion_detection: true,
continuous_recording: true,
event_recording: true,
set_sensitivity_low: true
})Parameters:
id(String) - Unique identifier for the user.countryCode(String) - The country code associated with the user.uid(String) - Unique user identifier used for authentication.passwd(String) - Password for the user account.devId(String) - Unique identifier for the Tuya doorbell device.homeId(String) - Identifier for the home where the Tuya doorbell is registered.last_moveout_at(String) - Timestamp of the last move-out event for the asset.resetRequired(String) - Indicates whether a reset is required for the device.isResident(String) - Specifies if the user is a resident of the associated home.display_remove_doorbell_button(String) - Determines if the option to remove the doorbell should be shown.propertyCredentialUsername(String) - Username for property authentication.propertyCredentialPassword(String) - Password for property management system authentication.tuya_product_name(String) - Name of the Tuya doorbell product.device_uuid(String) - UUID of the device.serial_no(String) - Serial number of the doorbell device.flavour(String) - Theme for the UI.doorbell_default_settings_updated(String) - Specifies whether the default doorbell settings should be updated.motion_detection(String) - Indicates if motion detection should be enabled.continuous_recording(String) - Indicates if continuous recording should be enabled.event_recording(String) - Indicates if evet recording should be enabled.set_sensitivity_low(String) - Indicates if sensitivity should be set to low.
registerForPushNotification
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.registerForPushNotification({ token: '' })Parameters:
token(String) - FCM Token.
renameDevice
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.renameDevice({ deviceId: '', name: '' })Parameters:
deviceId(String) - Device Id.name(String) - New device name.
resetDevice
import RentlyTuya from '@rentlydev/rently-tuya';
const response = await RentlyTuya.resetDevice({
devId: '',
homeId: '',
username: '',
password: '',
countryCode: ''
})Parameters:
devId(String) - Doorbell Device Id.homeId(String) - Home Id associated with Doorbell.username(String) - User ID.password(String) - Password.countryCode(String) - Country Code.
Listeners
[!IMPORTANT] After processing, a success or failure event should be sent.
Android
import RentlyTuya from '@rentlydev/rently-tuya';
export class ExposedToJava {
removeCamera(devId: string) {}
navigateToAddDoorbell(devId: string) {}
resetDoorbellDefaultSettingsFlag(id: string) {}
}iOS
React.useEffect(() => {
const data = new NativeEventEmitter(NativeModules.KeylessListener);
data.addListener('REMOVE_CAMERA', (data: any) => {});
data.addListener('RESET_WIFI', (data: any) => {});
data.addListener('RESET_DEFAULT_SETTINGS_FLAG', (data: any) => {});
}, []);How To Run Example App ?
To run example app, follow the below steps
- Clone the repository
- Run
yarn install - Navigate to example/ios folder i.e
cd example/iosand dopod install, thencd .. - For android run
yarn example android - For ios run
yarn example ios
