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 Initialize Network Configuration Info
LumiAccessSDKManager.getInstance().setAccessInfo(
positionId,
coapServer,
false,
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 |
|---|---|---|---|
| positionId | String | Room location | Obtained via API, see Aqara Developer Platform |
| coapServer | String | Device access server | Obtained via API, see Aqara Developer Platform |
3.2 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.3 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.4 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 |
| targetGatewayDeviceId | 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. |
3.5 Matter Sub-Device Control
LumiReactNativeManager.getInstance().startRNPage("aqara.matter.devices", "deviceId")
Note: Matter sub-devices uniformly use "aqara.matter.devices" as the DeviceModel parameter.
Parameters
| Field | Type | Description | Source |
|---|---|---|---|
| deviceId | String | Device ID | Generated after the device is successfully added |
3.6 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.6.1 Register & Unregister
// Register
LumiReactNativeSDK.getInstance().registerRNMessageCallback(object : IRNMessageCallback {
override fun onHandleMessage(jsonMessage: String, promise: Promise?) {
// To Do Something
}
})
// Unregister
LumiReactNativeSDK.getInstance().unregisterRNMessageCallback()
3.6.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. |
| AddGateway | Notification | Triggered when binding a gateway if there is none under the account. Third-party apps handle it themselves. |
3.7 RN Plugin
3.7.1 Use Local Plugin Files
The Matter SDK supports loading local plugin files by placing the corresponding files in the project directory.
Place plugin files under assets/lumiRNPrefab/bundle.
When using local plugins, no cloud updates are performed. To update, developers need to replace the RN plugin version in the assets directory and repackage.
3.7.2 Use Remote Plugin Files
The Matter SDK also 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.