npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rentlydev/rently-tuya

v0.3.9

Published

rently-tuya

Readme

@rentlydev/rently-tuya

A React Native module for integrating the Tuya Doorbell SDK into Rently applications. Provides device pairing, live camera preview, push notification registration, and real-time event bridging for Tuya-compatible smart doorbells.

Fully compatible with TypeScript. Requires React Native New Architecture (TurboModules).

Supported platforms

| Platform | Support | |----------|---------| | iOS | ✅ | | Android | ✅ | | Web | ❌ | | Windows | ❌ | | macOS | ❌ |

Installation

yarn add @rentlydev/rently-tuya

Configuration

iOS

  1. Add the Tuya pod sources to the top of your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/TuyaInc/TuyaPublicSpecs.git'
source 'https://github.com/tuya/tuya-pod-specs.git'
  1. Enable static frameworks and add the local Tuya cryption pod inside your target:
target 'YourApp' do
  use_frameworks! :linkage => :static

  pod 'ThingSmartCryption', :path => './ios_core_sdk'

  # ...
end
  1. Set the minimum deployment target to iOS 15.0 and enable New Architecture in the post_install block:
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "15.0"
    end
  end
  react_native_post_install(installer, config[:reactNativePath], :mac_catalyst_enabled => false)
end
  1. Enable New Architecture at the top of your Podfile:
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
  1. Run pod install from the ios/ directory.

Android

Add the Tuya Maven repositories to your root android/build.gradle:

allprojects {
  repositories {
    maven { url 'https://maven-other.tuya.com/repository/maven-releases/' }
    maven { url 'https://maven-other.tuya.com/repository/maven-commercial-releases/' }
    maven { url 'https://jitpack.io' }
    maven { url 'https://maven.aliyun.com/repository/public' }
  }
}

Enable New Architecture in android/gradle.properties:

newArchEnabled=true

Summary

Methods

Events


Usage

initAirbrake

Initialises Airbrake error reporting. Must be called before other methods.

import { initAirbrake } from '@rentlydev/rently-tuya';

const success = await initAirbrake({ key: 'YOUR_PROJECT_KEY', id: 'YOUR_PROJECT_ID' });

Parameters:

  • key (String) - Airbrake project key.
  • id (String) - Airbrake project ID.

Returns: Promise<boolean>


getCurrentWifi

Returns the SSID of the currently connected Wi-Fi network.

import { getCurrentWifi } from '@rentlydev/rently-tuya';

const ssid = await getCurrentWifi();

Returns: Promise<string> — the Wi-Fi SSID.


getDeviceData

Fetches data for a specific doorbell device.

import { getDeviceData } from '@rentlydev/rently-tuya';

const success = await getDeviceData({ devId: 'DEVICE_ID' });

Parameters:

  • devId (String) - Tuya device ID of the doorbell.

Returns: Promise<boolean>


setTuyaHome

Sets the active Tuya home context.

import { setTuyaHome } from '@rentlydev/rently-tuya';

const success = await setTuyaHome({ homeId: 'HOME_ID' });

Parameters:

  • homeId (String) - Home ID associated with the doorbell.

Returns: Promise<boolean>


getTokenForQRCode

Retrieves the pairing token used to generate the QR code for device activation.

import { getTokenForQRCode } from '@rentlydev/rently-tuya';

const token = await getTokenForQRCode({ homeId: 'HOME_ID' });

Parameters:

  • homeId (String) - Home ID associated with the doorbell.

Returns: Promise<string> — the pairing token.


initActivatorForQRCode

Starts the QR code pairing process. Call after displaying the QR code to the user.

import { initActivatorForQRCode } from '@rentlydev/rently-tuya';

const success = await initActivatorForQRCode({
  ssid: 'WIFI_NAME',
  password: 'WIFI_PASSWORD',
  time: 120,
  token: 'TOKEN_FROM_getTokenForQRCode',
});

Parameters:

  • ssid (String) - Wi-Fi network name (SSID).
  • password (String) - Wi-Fi password.
  • time (Number) - Activation timeout in seconds.
  • token (String) - Pairing token obtained from getTokenForQRCode.

Returns: Promise<boolean>


loginWithUid

Authenticates with the Tuya platform using a UID credential.

import { loginWithUid } from '@rentlydev/rently-tuya';

const success = await loginWithUid({
  uid: 'USER_UID',
  password: 'USER_PASSWORD',
  countryCode: '1',
});

Parameters:

  • uid (String) - Tuya user UID.
  • password (String) - Tuya user password.
  • countryCode (String) - Country calling code (e.g. '1' for US).

Returns: Promise<boolean>


logout

Logs out the current Tuya user session.

import { logout } from '@rentlydev/rently-tuya';

const success = await logout();

Returns: Promise<boolean>


openCameraLivePreview

Opens the native camera live preview screen for a doorbell device.

import { openCameraLivePreview } from '@rentlydev/rently-tuya';

await openCameraLivePreview({
  id: 'USER_ID',
  countryCode: '1',
  uid: 'USER_UID',
  passwd: 'USER_PASSWORD',
  devId: 'DEVICE_ID',
  homeId: 'HOME_ID',
  last_moveout_at: '2025-02-20T07:10:00Z',
  resetRequired: false,
  options: null,
  isResident: true,
  display_remove_doorbell_button: true,
  propertyCredentialUsername: 'PROPERTY_USERNAME',
  propertyCredentialPassword: 'PROPERTY_PASSWORD',
  tuya_product_name: 'PRODUCT_NAME',
  device_uuid: 'DEVICE_UUID',
  serial_no: 'SERIAL_NUMBER',
  flavour: 'keyless',
  doorbell_default_settings_updated: false,
  doorbell_calling_enabled: true,
  motion_detection: true,
  continuous_recording: false,
  event_recording: true,
  set_sensitivity_low: false,
  darkThemeEnabled: false,
  useSystemTheme: true,
  currentSystemColorScheme: 'light',
  doorbell_setting: false,
});

Parameters:

  • id (String) - Unique identifier for the user.
  • countryCode (String) - Country calling code associated with the user.
  • uid (String) - Tuya user UID used for authentication.
  • passwd (String) - Tuya user password.
  • devId (String) - Tuya device ID of the doorbell.
  • homeId (String) - Home ID where the doorbell is registered.
  • last_moveout_at (String) - ISO 8601 timestamp of the last move-out event for the unit.
  • resetRequired (Boolean) - Whether the device requires a reset before opening.
  • options (Any) - Additional options passed to the native layer.
  • isResident (Boolean) - Whether the user is a current resident of the property.
  • display_remove_doorbell_button (Boolean) - Whether to show the "Remove Doorbell" button in the UI.
  • propertyCredentialUsername (String) - Username for property management system authentication.
  • propertyCredentialPassword (String) - Password for property management system authentication.
  • tuya_product_name (String) - Tuya product name of the doorbell model.
  • device_uuid (String) - UUID of the device.
  • serial_no (String) - Serial number of the doorbell device.
  • flavour (String) - UI theme/flavour (e.g. 'keyless').
  • doorbell_default_settings_updated (Boolean) - Whether the doorbell's default settings have already been applied.
  • doorbell_calling_enabled (Boolean) - Whether doorbell call functionality is enabled.
  • motion_detection (Boolean) - Whether motion detection should be enabled.
  • continuous_recording (Boolean) - Whether continuous recording should be enabled.
  • event_recording (Boolean) - Whether event-triggered recording should be enabled.
  • set_sensitivity_low (Boolean) - Whether motion detection sensitivity should be set to low.
  • darkThemeEnabled (Boolean) - Whether dark theme is explicitly enabled.
  • useSystemTheme (Boolean) - Whether the UI should follow the device system theme.
  • currentSystemColorScheme (String) - Current system color scheme ('light' or 'dark').
  • doorbell_setting (Boolean) - Whether to open directly to the doorbell settings screen.

Returns: Promise<boolean>


registerForPushNotification

Registers an FCM token with the Tuya platform to enable push notifications for doorbell events.

import { registerForPushNotification } from '@rentlydev/rently-tuya';

const success = await registerForPushNotification({ token: 'FCM_TOKEN' });

Parameters:

  • token (String) - Firebase Cloud Messaging (FCM) device token.

Returns: Promise<boolean>


renameDevice

Renames a doorbell device.

import { renameDevice } from '@rentlydev/rently-tuya';

const success = await renameDevice({ devId: 'DEVICE_ID', name: 'Front Door' });

Parameters:

  • devId (String) - Tuya device ID of the doorbell.
  • name (String) - New display name for the device.

Returns: Promise<boolean>


resetDevice

Resets a doorbell device and removes it from the Tuya home.

import { resetDevice } from '@rentlydev/rently-tuya';

const success = await resetDevice({
  devId: 'DEVICE_ID',
  homeId: 'HOME_ID',
  username: 'USER_UID',
  password: 'USER_PASSWORD',
  countryCode: '1',
});

Parameters:

  • devId (String) - Tuya device ID of the doorbell.
  • homeId (String) - Home ID where the doorbell is registered.
  • username (String) - Tuya user UID.
  • password (String) - Tuya user password.
  • countryCode (String) - Country calling code.

Returns: Promise<boolean>


Events

The native layer emits events to React Native via the KeylessListener module. Subscribe to events early (e.g. in a top-level component) and keep subscriptions alive for the duration of the session.

[!IMPORTANT] After handling an event, you must call successCallback or failureCallback on the native module to resolve the native-side callback. Failing to do so will leave the native layer waiting indefinitely.

iOS Events

Set up listeners using NativeEventEmitter:

import { NativeEventEmitter, NativeModules } from 'react-native';

const { KeylessListener } = NativeModules;
const eventEmitter = new NativeEventEmitter(KeylessListener);

React.useEffect(() => {
  const removeCameraSubscription = eventEmitter.addListener(
    'REMOVE_CAMERA',
    (data: { device_id: string }) => {
      // Handle request to remove the doorbell from the UI
      console.log('Remove camera for device:', data.device_id);
      NativeModules.KeylessListener.successCallback('REMOVE_CAMERA');
    }
  );

  const resetWifiSubscription = eventEmitter.addListener(
    'RESET_WIFI',
    (data: { doorbellType: string }) => {
      // Handle request to reset Wi-Fi for the given doorbell model
      console.log('Reset Wi-Fi for doorbell type:', data.doorbellType);
      NativeModules.KeylessListener.successCallback('RESET_WIFI');
    }
  );

  const resetSettingsSubscription = eventEmitter.addListener(
    'RESET_DEFAULT_SETTINGS_FLAG',
    (data: { id: string }) => {
      // Handle request to clear the default settings flag for a unit
      console.log('Reset default settings flag for unit:', data.id);
      NativeModules.KeylessListener.successCallback('RESET_DEFAULT_SETTINGS_FLAG');
    }
  );

  const enableDoorbellCallSubscription = eventEmitter.addListener(
    'ENABLE_DOORBELL_CALL',
    (data: { id: string; doorbell_calling_enabled: boolean }) => {
      // Handle doorbell call enable/disable toggle
      console.log('Doorbell call enabled:', data.doorbell_calling_enabled, 'for unit:', data.id);
      NativeModules.KeylessListener.successCallback('ENABLE_DOORBELL_CALL');
    }
  );

  return () => {
    removeCameraSubscription.remove();
    resetWifiSubscription.remove();
    resetSettingsSubscription.remove();
    enableDoorbellCallSubscription.remove();
  };
}, []);

| Event | Payload | Description | |------------------------------|-------------------------------------------------------|----------------------------------------------------------| | REMOVE_CAMERA | { device_id: string } | Native requests removal of the doorbell from the app. | | RESET_WIFI | { doorbellType: string } | Native requests a Wi-Fi reset for the given doorbell model. | | RESET_DEFAULT_SETTINGS_FLAG| { id: string } | Native requests clearing of the default settings flag for a unit. | | ENABLE_DOORBELL_CALL | { id: string, doorbell_calling_enabled: boolean } | Native notifies a change to the doorbell call enable state. |

Android Events

On Android, the native layer calls back into JavaScript via an ExposedToJava bridge class. Implement the following interface in your app:

export class ExposedToJava {
  removeCamera(devId: string) {
    // Handle request to remove the doorbell
  }

  navigateToAddDoorbell(devId: string) {
    // Handle navigation to the add doorbell flow
  }

  resetDoorbellDefaultSettingsFlag(id: string) {
    // Handle clearing the default settings flag for a unit
  }
}

Running the Example App

  1. Clone the repository and install dependencies:

    git clone https://github.com/rently-com/rently-tuya.git
    cd rently-tuya
    yarn install
  2. Install iOS pods:

    cd example/ios && pod install && cd ..
  3. Run on Android:

    yarn example android
  4. Run on iOS:

    yarn example ios

Demo Video

Android & iOS