Node Metadata and Tags
Label and annotate nodes with custom tags and metadata for organization and filtering in your app.
What This Module Does ?
Attach tags (labels for filtering) and metadata (structured key-value fields) to nodes without changing firmware config.
Use this for device-list categories, room/installation info, and app-specific organization. Get the node from Node Management first.
Expected outcome: Tags and metadata persist on the node; read via node.tags and node.metadata.
Common Workflows
Add tags and metadata
const { nodes } = await userInstance.getUserNodes();
const node = nodes[0];
await node.attachTags(["living-room", "smart-lighting"]);
await node.updateMetadata({
location: "Living Room",
installationDate: "2024-01-15",
});
console.log(node.tags, node.metadata);
Tag for UI filtering
await node.attachTags(["bedroom", "lighting"]);
Update structured metadata
await node.updateMetadata({
room: "Bedroom",
deviceType: "Smart Light",
floor: 2,
});
Remove tags and metadata
await node.removeTags();
await node.deleteMetadata();
Error Handling
try {
await node.attachTags(["smart-home"]);
await node.updateMetadata({ room: "Kitchen" });
} catch (error) {
console.error("Failed to update node metadata:", error);
}
Advanced Concepts
Tags vs metadata
Tags — short filterable labels. Metadata — richer structured fields for display or logic.
Best Practices
- Tags for categories, metadata for details
- Use consistent tag naming (e.g., kebab-case)
- Read back after writes to confirm
Related Resource
- API Reference: