Matter Vertical Category SDK Usage
1. Overview
This document mainly introduces how to use the Matter Vertical Category SDK to configure the Aqara Matter hub and Matter sub-devices.
PS: Currently, Matter sub-devices cannot be directly configured and connected through the SDK. They must first be connected via an Aqara Matter hub (using Aqara’s private Magic Pair protocol) before device configuration and control can be performed.
2. Prerequisites
- Complete the preparation work
- Complete the environment setup
- Complete the integration of the Matter Vertical Category SDK
3. Usage
The network configuration and device control of Matter sub-devices depend on the Aqara Matter hub. Therefore, a Matter hub must be added to the network before configuring or controlling Matter sub-devices.
3.1 Aqara Matter Hub Network Configuration
LumiAccessSDKManager.getInstance().gotoAccessConfigModule(
this,
"deviceModel",
object : LumiResultCallBack {
override fun fail(errorCode: Int?, errorMessage: String?) {
Log.e(TAG, "fail: errorCode=$errorCode,errorMessage=$errorMessage")
}
override fun success(activity: WeakReference<Activity>, message: String?) {
Log.e(TAG, "success: message=$message")
}
}
)
Parameters
| Field | Type | Description | Source |
|---|---|---|---|
| deviceModel | String | Device model value | See Appendix Supported Aqara Matter Hub Device List |
3.2 Aqara Matter Hub Device Control
LumiReactNativeManager.getInstance().startRNPage("deviceModel", "deviceId")
Parameters
| Field | Type | Description | Source |
|---|---|---|---|
| deviceModel | String | Device model value | See Appendix Supported Aqara Matter Hub Device List |
| deviceId | String | Device ID | Generated after the device is successfully added |
3.3 Matter Sub-Device Network Configuration
LumiAccessSDKManager.getInstance().gotoAccessPageByMatter(
object : LumiResultCallBack {
override fun fail(errorCode: Int?, errorMessage: String?) {
Log.e(TAG, "fail: errorCode=$errorCode,errorMessage=$errorMessage")
}
override fun success(activity: WeakReference<Activity>, message: String?) {
Log.e(TAG, "success: message=$message")
}
}
)
Parameters
| Field | Type | Description | Source |
|---|---|---|---|
| matterDeviceModel | String | Device model value | See Appendix Supported Matter Sub-Device List |
| targetGatwayDeviceId | String | Device ID | The Matter hub’s device ID to which the sub-device is bound. Can be empty; if empty, the current gateway list will be automatically queried for selection. |
3.4 Matter Sub-Device Control
LumiReactNativeManager.getInstance().startRNPage("deviceModel" "deviceId")
Note: Third-party Matter sub-devices uniformly use aqara.matter.devices as the DeviceModel parameter. For Aqara Matter sub-devices, you can pass the Aqara model value to enable some private feature displays and a more friendly interaction experience.
Parameters
| Field | Type | Description | Source |
|---|---|---|---|
| deviceModel | String | Device model value. For third-party Matter sub-devices, always use aqara.matter.devices |
See Appendix Supported Matter Sub-Device List |
| deviceId | String | Device ID | Generated after the device is successfully added |
3.5 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.5.1 Register & Unregister
// Register
LumiReactNativeSDK.getInstance().registerRNMessageCallback(object :IRNMessageCallback{
override fun onHandleMessage(jsonMessage: String, promise: Promise?) {
//To Do Something
}
})
// Unregister
LumiReactNativeSDK.getInstance().unregisterRNMessageCallback()
3.5.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 | Triggered when binding a gateway if there is none under the account. Third-party apps handle it themselves. |
| OpenDeviceControlPage | Notification | Notification to open a specified device page. Third-party apps can perform custom business logic. |
3.6 Device Plugin
3.6.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.6.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.