Create composed device types
mainCertain device types are considered 'composed devices'. Instead of being a single unit, they require you to create the main device and then explicitly add sub-components (like cabinets, surfaces, or parts) using specific methods.
Oven
Create an Oven and use .addCabinet(name, tags[]) to add cabinets.
Cooktop
Create a Cooktop and use .addSurface(name, tags[]) to add surfaces.
Refrigerator
Create a Refrigerator and use .addCabinet(name, tags[]) to add cabinets.
Note: When adding components, you must provide an array of objects containing mfgCode, namespaceId, tag, and label.
// Oven Example
const oven = new Oven('Oven', 'OV1234567890');
oven.addCabinet('Upper Cabinet', [{ mfgCode: null, namespaceId: PositionTag.Top.namespaceId, tag: PositionTag.Top.tag, label: PositionTag.Top.label }]);
// Cooktop Example
const cooktop = new Cooktop('Cooktop', 'CT1234567890');
cooktop.addSurface('Surface Top Left', [
{ mfgCode: null, namespaceId: PositionTag.Top.namespaceId, tag: PositionTag.Top.tag, label: PositionTag.Top.label },
{ mfgCode: null, namespaceId: PositionTag.Left.namespaceId, tag: PositionTag.Left.tag, label: PositionTag.Left.label },
]);
// Refrigerator Example
const refrigerator = new Refrigerator('Refrigerator', 'RE1234567890');
refrigerator.addCabinet('Refrigerator Top', [
{ mfgCode: null, namespaceId: PositionTag.Top.namespaceId, tag: PositionTag.Top.tag, label: 'Refrigerator Top' },
{ mfgCode: null, namespaceId: RefrigeratorTag.Refrigerator.namespaceId, tag: RefrigeratorTag.Refrigerator.tag, label: RefrigeratorTag.Refrigerator.label },
]);