跳到主要内容

Commission Adaptor

The Commission Adaptor connects the RainMaker Matter SDK to your app’s native Matter stack. Pairing, BLE/Wi-Fi sessions, and secure key storage stay on the native side; the SDK handles RainMaker cloud calls when the adaptor reports commissioning events.

信息

Required for fabric.startCommissioning() and fabric.issueUserNoC().

Reference implementation: ESPMatterAdapter.ts in esp-rainmaker-home native-adaptors.


What the adaptor does

ResponsibilityWho owns it
Scan QR / run Matter pairing sessionNative (via adaptor)
Store keys and generate CSRsNative (via adaptor)
Issue node NoC and confirm commissioningSDK (cloud APIs)
Send results back to nativeSDK → adaptor postMessage

The Home app adaptor is a thin bridge: start commissioning from native, normalize events for the SDK, and pass SDK responses back to native. Prefer that implementation over writing a new bridge.


Required methods

ESPMatterCommissioningAdaptorInterface requires three methods (already implemented in ESPMatterAdapter.ts):

generateCSR(fabricInfo)

Create a certificate signing request in secure storage (KeyStore / Keychain) for fabric or user certificates.

startEcosystemCommissioning(onboardingPayload, fabric, onEvent)

Start native commissioning with the QR code or onboarding payload. When native reaches key steps, call onEvent with:

  • NODE_NOC_REQUEST — device CSR and device ID; the SDK calls issueNodeNoC and replies via postMessage
  • Commissioning confirmation — RainMaker/Matter node IDs and challenge data; the SDK calls confirmMatterNodeCommissioning and replies via postMessage

Return a cleanup function so the app can remove listeners when the commissioning screen closes.

postMessage(payload)

Send SDK responses to native (for example NoC issued, confirmation success or failure). Native uses this to finish the Matter session on the device.


Configure the adaptor

import { ESPRMMatterBase } from "@espressif/rainmaker-matter-sdk";
import { matterCommissioningAdaptor } from "./native-adaptors/implementations/ESPMatterAdapter";

ESPRMMatterBase.configure({
baseUrl: "https://api.rainmaker.espressif.com",
version: "v1",
matterCommissioningAdaptor,
matterVendorId: "0x131B",
// ... base SDK adapters (storage, etc.)
});

How the SDK uses it

When the user starts commissioning:

const cleanup = await fabric.startCommissioning(
"<QR_CODE_OR_ONBOARDING_PAYLOAD>",
(progress) => {
console.log(progress.status, progress.description);
}
);
  1. SDK calls startEcosystemCommissioning on the adaptor.
  2. Native runs pairing; adaptor fires onEvent for NoC and confirm steps.
  3. SDK calls RainMaker APIs and uses postMessage so native can complete commissioning.
  4. App receives progress via the callback (ON_PROGRESS, SUCCESS, FAILED).

For step-by-step app integration (React Native, Android, iOS), see Device commissioning and Native Bridge.


Event shapes

Normalize native payloads before calling onEvent:

  • NoC request — include requestData.csr, requestData.deviceId, groupId, fabricId
  • Confirm request — include matterNodeId, rainmakerNodeId (for RainMaker Matter devices), and challenge response fields as required by your platform

See Matter Adapters for the full Home app reference table.

On this page