Local Control
Local Control commands Matter devices on the same LAN as the phone. The SDK uses the matter_local transport and calls your matterControlAdapter, which bridges to the native Matter stack (CHIP / MatterSupport).
This page is local only. Remote / off-LAN control is a separate path — see Remote Control. Both share getValue() / setValue(), but different interfaces and adapters.
Reference implementation: ESPMatterControlAdapter.ts in esp-rainmaker-home native-adaptors.
Dependencies (local path)
What you need for matter_local only. Remote Control pieces are listed so you do not mix them in.
Required
| Dependency | What it does | Reference |
|---|---|---|
| matterControlAdapter | TS bridge: SDK → native read / write / invoke | ESPMatterControlAdapter.ts |
| ESPMatterControlAdapterInterface | Contract that adapter implements | Interface below |
| Native Matter module | Platform CASE session (Android / iOS) | Home app ESPMatterModule / Matter control native code |
Recommended
| Dependency | What it does | Reference |
|---|---|---|
| clusterConfig | Builds UI params with cluster / attribute IDs | Cluster config |
| matterLocalDiscoveryAdapter | Marks peers reachable; enables matter_local on nodes | MatterDiscoverAdapter.ts |
Not used on this path
| Dependency | Why |
|---|---|
| matter_controller / RainMaker Controller | Remote hop only — see Remote Control |
Pass adapters through ESPRMMatterBase.configure(). Without matterControlAdapter, LAN getValue / setValue cannot run.
Interface: ESPMatterControlAdapterInterface
init?(config) // optional: fabric setup (fabric ID, group ID, CA/IPK)
read(matterNodeId, endpoint, clusterId, attributeId)
write(matterNodeId, endpoint, clusterId, attributeId, value)
invoke(matterNodeId, endpoint, clusterId, commandId, payload?)
shutdown?() // optional: tear down native controller
Implement read and write at minimum. Add invoke for command-based params (writeAsCommand / matterCommandId in cluster config). The Home app adapter already implements these.
Configure
import { ESPRMMatterBase } from "@espressif/rainmaker-matter-sdk";
import { matterControlAdapter } from "./native-adaptors/implementations/ESPMatterControlAdapter";
import { matterLocalDiscoveryAdapter } from "./native-adaptors/implementations/MatterDiscoverAdapter";
ESPRMMatterBase.configure({
// ... base + commissioning config
matterControlAdapter,
matterLocalDiscoveryAdapter, // recommended so matter_local is available on peers
clusterConfig: matterClusterConfig,
});
Call init from your app when the user opens a fabric or home screen, if the native layer needs fabric credentials before the first read or write.
Full adapter catalog: Matter Adapters.
Control from your app
Load a Matter node and use device parameters — the SDK maps each param to endpoint, cluster, and attribute IDs using your cluster config.
import { ESPRMMatterNode } from "@espressif/rainmaker-matter-sdk";
const nodes = await fabric.getNodesWithDetails();
const matterNode = nodes.find((n) => n instanceof ESPRMMatterNode) as ESPRMMatterNode;
const device = matterNode.devices?.[0];
const powerParam = device?.params?.find((p) => p.name === "Power");
if (powerParam) {
await powerParam.getValue();
console.log("Power:", powerParam.value);
await powerParam.setValue(true);
}
Cloud node details do not include live Matter attribute values. Call getValue() when you need the current state from the device on the LAN.
If matter_controller is also registered, the transport manager may fall back to remote after a local failure — that is Remote Control, not this adapter.
Read vs write vs invoke
- Attributes —
getValue()→ adapterread;setValue()→ adapterwritewhen the param has a Matter attribute ID. - Commands —
setValue()→ adapterinvokewhen the param useswriteAsCommandormatterCommandId.
You normally call only getValue() / setValue(); the SDK chooses read, write, or invoke from param metadata.
When to use local control
- User toggles a light, dimmer, or plug while the phone is on the same network as the device
- You want control without a cloud round-trip
- Native Matter can reach commissioned nodes on the fabric
For off-LAN control, use Remote Control. For continuous UI sync, add Matter Subscription (separate adapter: matterSubscriptionAdapter).
Related
- Controlling — overall control model and path comparison
- Remote Control —
matter_controllerpath - Matter Adapters — adapter contracts and Home app links
- Matter Nodes — nodes and params
- Matter Subscription — live attribute reports