Node Management
List, inspect, and manage the provisioned devices (nodes) in a user's RainMaker account.
The userInstance refers to ESPRMUser from User Sign in.
What This Module Does ?
In RainMaker, every provisioned device is a node (ESPRMNode). Use node management to list what the user owns, inspect configuration, check connectivity, and remove devices from the account.
Use this when you need a device list UI, node details, online status, batch updates on one node, or account removal.
Use Device Control for individual parameters. Use Batch Operations for updates across multiple nodes.
Expected outcome: You receive ESPRMNode instances and can load config, connectivity, and param updates—or remove the node from the account.
Common Workflows
List all nodes
const response = await userInstance.getUserNodes();
console.log(`User has ${response.nodes.length} nodes`);
response.nodes.forEach((node) => {
console.log(node.id, node.name);
});
List nodes with pagination
let response = await userInstance.getUserNodes(10);
while (response.hasNext) {
response = await response.fetchNext();
}
Get details for a specific node
const node = await userInstance.getNodeDetails("node_id_123");
const config = node.nodeConfig ?? (await node.getNodeConfig());
console.log("Devices:", config.devices.length);
console.log("Services:", config.services.length);
Filter nodes
const filtered = await userInstance.getUserNodesWith({
result_count: 20,
page_num: 1,
});
Check if a node is online
const status = await node.getConnectivityStatus();
console.log("Online:", status.isConnected);
Update multiple parameters on one node
await node.setMultipleParams({
Light: [{ Power: true }, { Brightness: 80 }],
});
Remove a node from the account
await node.delete();
Deleting a node removes it from the user's account. This cannot be undone.
Error Handling
try {
const node = await userInstance.getNodeDetails(nodeId);
const status = await node.getConnectivityStatus();
if (!status.isConnected) {
console.warn("Node is offline — updates may be delayed");
}
await node.setMultipleParams(payload);
} catch (error) {
console.error("Node operation failed:", error);
}
Advanced Concepts
Node hierarchy
A node is a container for devices (controllable things) and services (system capabilities), each with parameters.
Single-node vs multi-node updates
node.setMultipleParams()— one node, many parametersuserInstance.setMultipleNodesParams()— many nodes — see Batch Operations
Best Practices
- Paginate large node lists
- Cache node config after fetching
- Check connectivity before OTA or time-sensitive operations
- Use batch param updates when changing several values on the same node
- Refresh after provisioning — call
getUserNodes()when onboarding completes
Related Resource
- API Reference: