Device Control SDK Usage

1. Overview

This document mainly introduces how to use the Device Control SDK for API calls.

2. Prerequisites

  1. Complete the preparation work
  2. Complete the environment setup
  3. Complete the Device Control SDK integration

3. Usage

3.1 Navigate to a Specified Device Page

LumiDeviceRouterManager.getInstance().startDevicePage(
    deviceModel,
    deviceId
)

Parameters

Field Type Description Source
deviceModel String Device model value Obtained from the cloud after the device is successfully paired
deviceId String Device ID Obtained from the cloud after the device is successfully paired

3.2 Event Listener

During user interactions, events such as button clicks or other conditions can trigger callbacks via event listeners. For example, clicking a button may navigate to a page in the host app or trigger custom third-party events.

3.2.1 Register & Unregister

// Register
LumiReactNativeManager.getInstance().registerRNMessageCallback(object :IRNMessageCallback{
    override fun onHandleMessage(jsonMessage: String, promise: Promise?) {
       //To Do Something
    }
})    

// Unregister
LumiReactNativeManager.getInstance().unregisterRNMessageCallback()

3.2.2 Common Event List

Event Type Description
action_access_success Notification Triggered when a device is successfully added. Third-party apps can perform custom business logic.
AddGatewway Notification Some door locks need to bind a gateway. If there is no gateway under the account, this event is triggered and the third-party app handles it itself.
OpenDeviceControlPage Notification Notification to open a specified device page. Third-party apps can perform custom business logic.

3.3 Device Plugin

3.3.1 Use Local Plugin Files

The SDK supports loading local plugin files by placing the corresponding files in the project directory.

Place plugin and configuration files under the assets/lumi/ directory.

When using local plugins, no cloud updates are performed. To update, developers need to place the new version of the RN plugin in the assets directory and repackage for release.

3.3.2 Use Remote Plugin Files

The SDK supports loading remote plugin files from a server and supports hot updates. This can be used together with local plugins.

This feature involves remote plugin file management and delivery and is not publicly available. Contact business support if needed.

lumi LogoCopyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2026-08-11 17:03:05

results matching ""

    No results matching ""