Skip to content
jack edited this page Jul 26, 2018 · 6 revisions

1. Overview

zcl-id is a dictionary of identifiers defined by ZigBee Cluster Library Specification.


2. Installation

$ npm install zcl-id --save


3. Usage

zcl-id provides you with APIs to get the key-value pairs of ZCL identifiers, i.e. profile, cluster, foundation and functional command, attribute and attribute data type. Each method returns an item with properties of 'key' and 'value' to show you the identifier in string and in number, respectively.

Here are some quick examples:

var zclId = require('zcl-id')

// Profile Id
zclId.profile(260).key;                 // 'HA'
zclId.profile('HA').value;              // 260
zclId.profile('no_such_profile');       // undefined

// Cluster Id
zclId.cluster(0).key;                   // 'genBasic'
zclId.cluster('genBasic').value;        // 0
zclId.cluster('no_such_cluster');       // undefined

// Device Id
zclId.device(260, 10).key;              // 'doorLock'
zclId.device('HA', 'doorLock').value;   // 10
zclId.device('HA', 'no_such_device');   // undefined

// Foundation Cmd Id
zclId.foundation(2).key;                // 'write'
zclId.foundation('write').value;        // 2
zclId.foundation('invalid_command');    // undefined

// Functional Cmd Id
zclId.functional(3, 0).key;                         // 'identify'
zclId.functional('genIdentify', 'identify').value;  // 0
zclId.functional('genIdentify', 'invalid_command'); // 0

// Functional CmdRsp Id
zclId.getCmdRsp(9, 0).key;                          // 'alarm'
zclId.getCmdRsp('genAlarms', 'alarm').value;        // 0
zclId.getCmdRsp('genAlarms', 'invalid_command');    // undefined

// Attribute Id
zclId.attr(0, 3).key;                               // 'hwVersion'
zclId.attr('genBasic', 'hwVersion').value;          // 3
zclId.attr('genBasic', 'no_such_attr');             // undefined

// Attribute DataType Id
zclId.attrType(0, 1).key;                           // 'uint8'
zclId.attrType('genBasic', 'appVersion').value;     // 32
zclId.attrType('genBasic', 'no_such_attr');         // undefined

// DataType Id
zclId.dataType(33).key;                             // 'uint16'
zclId.dataType('uint16').value;                     // 33
zclId.dataType('no_such_datatype');                 // undefined

// Status Id
zclId.dataType(133).key;                            // 'invalidField'
zclId.dataType('invalidField').value;               // 133
zclId.dataType('no_such_status');                   // undefined


4. APIs


.profile(profId)

Returns the profile identifier.

Arguments:

  1. profId (String | Number): Profile id, which can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.profile('HA');                // { key: 'HA', value: 260 }
zclId.profile('260');               // { key: 'HA', value: 260 }
zclId.profile(260);                 // { key: 'HA', value: 260 }
zclId.profile('no_such_profile');   // undefined



.cluster(cId)

Returns the cluster identifier.

Arguments:

  1. cId (String | Number): Cluster id, which can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.cluster('genAlarms');         // { key: 'genAlarms', value: 9 }
zclId.cluster('9');                 // { key: 'genAlarms', value: 9 }
zclId.cluster(9);                   // { key: 'genAlarms', value: 9 }
zclId.cluster('no_such_cluster');   // undefined



.device(profId, devId)

Returns the device identifier under the specified profile.

Arguments:

  1. profId (String | Number): Profile id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.
  2. devId (String | Number): Device id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.device('HA', 'simpleSensor');    // { key: 'simpleSensor', value: 12 }
zclId.device('260', '12');             // { key: 'simpleSensor', value: 12 }
zclId.device(260, 12);                 // { key: 'simpleSensor', value: 12 }
zclId.device('no_such_profile', 12);   // undefined
zclId.device('HA', 'no_such_device');  // undefined



.foundation(cmdId)

Returns the foundation command identifier.

Arguments:

  1. cmdId (String | Number): Command id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.foundation('write');          // { key: 'write', value: 2 }
zclId.foundation('2');              // { key: 'write', value: 2 }
zclId.foundation(2);                // { key: 'write', value: 2 }
zclId.foundation('invalid_cmd');    // undefined



.functional(cId, cmdId)

Returns the functional command identifier under the specified cluster.

Arguments:

  1. cId (String | Number): Cluster id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.
  2. cmdId (String | Number): Command id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.functional('genBasic', 'resetFactDefault');           // { key: 'resetFactDefault', value: 0 }
zclId.functional('0', '0');                                 // { key: 'resetFactDefault', value: 0 }
zclId.functional(0, 0);                                     // { key: 'resetFactDefault', value: 0 }
zclId.functional('no_such_cluster', 'resetFactDefault');    // undefined
zclId.functional('genBasic', 'invalid_cmd');                // undefined



.getCmdRsp(cId, rspId)

Returns the identifier of functional command response under the specified cluster.

Arguments:

  1. cId (String | Number): Cluster id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.
  2. rspId (String | Number): Response id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.getCmdRsp('genAlarms', 'alarm');          // { key: 'alarm', value: 0 }
zclId.getCmdRsp('9', '0');                      // { key: 'alarm', value: 0 }
zclId.getCmdRsp(9, 0);                          // { key: 'alarm', value: 0 }
zclId.getCmdRsp('no_such_cluster', 'alarm');    // undefined
zclId.getCmdRsp('genAlarms', 'invalid_cmd');    // undefined



.attr(cId, attrId)

Returns the attribute identifier under the specified cluster.

Arguments:

  1. cId (String | Number): Cluster id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.
  2. attrId (String | Number): Attribute id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.attr('genBasic', 'hwVersion');        // { key: 'hwVersion', value: 3 }
zclId.attr('0', '3');                       // { key: 'hwVersion', value: 3 }
zclId.attr(0, 3);                           // { key: 'hwVersion', value: 3 }
zclId.attr('no_such_cluster', 'hwVersion'); // undefined
zclId.attr('genBasic', 'no_such_attr');     // undefined



.attrType(cId, attrId)

Returns the attribute data type identifier under the specified cluster.

Arguments:

  1. cId (String | Number): Cluster id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.
  2. attrId (String | Number): Attribute id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.attrType('genBasic', 'appVersion');           // { key: 'uint8', value: 32 }
zclId.attrType('0', '1');                           // { key: 'uint8', value: 32 }
zclId.attrType(0, 1);                               // { key: 'uint8', value: 32 }
zclId.attrType('no_such_cluster', 'appVersion');    // undefined
zclId.attrType('genBasic', 'no_such_attr');         // undefined



.dataType(type)

Returns the data type identifier.

Arguments:

  1. type (String | Number): Data type, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.dataType('uint16');               // { key: 'uint16', value: 33 }
zclId.dataType('33');                   // { key: 'uint16', value: 33 }
zclId.dataType(33);                     // { key: 'uint16', value: 33 }
zclId.dataType('invalid_data_type');    // undefined



.status(status)

Returns the status identifier.

Arguments:

  1. status (String | Number): Cluster id, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Object | Undefined): Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Examples:

zclId.status('invalidField');           // { key: 'invalidField', value: 133 }
zclId.status('133');                    // { key: 'invalidField', value: 133 }
zclId.status(133);                      // { key: 'invalidField', value: 133 }
zclId.status('invalid_status');         // undefined



.attrList(cId)

Returns all possible attributes within a cluster.

Arguments:

  1. cId (String | Number): Status, which can be given with a string or a number. A numbered string like '128' will be recognized as a number 128.

Returns:

  • (Array | Undefined): Returns an array with each element in the shape of { attrId: 2, dataType: 41 }, otherwise returns undefined if not found.

Examples:

zclId.attrList('genDeviceTempCfg');
/*
[ { attrId: 0, dataType: 41 },
  { attrId: 1, dataType: 41 },
  { attrId: 2, dataType: 41 },
  { attrId: 3, dataType: 33 },
  { attrId: 16, dataType: 24 },
  { attrId: 17, dataType: 41 },
  { attrId: 18, dataType: 41 },
  { attrId: 19, dataType: 34 },
  { attrId: 20, dataType: 34 } ]
*/

zclId.attrList(2);
/*
[ { attrId: 0, dataType: 41 },
  { attrId: 1, dataType: 41 },
  { attrId: 2, dataType: 41 },
  { attrId: 3, dataType: 33 },
  { attrId: 16, dataType: 24 },
  { attrId: 17, dataType: 41 },
  { attrId: 18, dataType: 41 },
  { attrId: 19, dataType: 34 },
  { attrId: 20, dataType: 34 } ]
*/

zclId.attrList('invalid_cluster');  // undefined



5. Table of Identifiers

  • Profile
{
    "HA": 260,   // ZigBee Home Automation
    "BA": 261,   // ZigBee Building Automation
    "TS": 263,   // ZigBee Telecom Services
    "HC": 264,   // ZigBee Health Care
    "SE": 265,   // ZigBee Smart Energy
    "RS": 266,   // ZigBee Retail Services
    "LL": 49246  // ZigBee Light Link
}
  • HA Device ID
{
    "onOffSwitch": 0,
    "levelControlSwitch": 1,
    "onOffOutput": 2,
    "levelControllableOutput": 3,
    "sceneSelector": 4,
    "configurationTool": 5,
    "remoteControl": 6,
    "combinedInterface": 7,
    "rangeExtender": 8,
    "mainsPowerOutlet": 9,
    "doorLock": 10,
    "doorLockController": 11,
    "simpleSensor": 12,
    "consumptionAwarenessDevice": 13,
    "homeGateway": 80,
    "smartPlug": 81,
    "whiteGoods": 82,
    "meterInterface": 83,
    "testDevice": 255,
    "onOffLight": 256,
    "dimmableLight": 257,
    "coloredDimmableLight": 258,
    "onOffLightSwitch": 259,
    "dimmerSwitch": 260,
    "colorDimmerSwitch": 261,
    "lightSensor": 262,
    "occupancySensor": 263,
    "shade": 512,
    "shadeController": 513,
    "windowCoveringDevice": 514,
    "windowCoveringController": 515,
    "heatingCoolingUnit": 768,
    "thermostat": 769,
    "temperatureSensor": 770,
    "pump": 771,
    "pumpController": 772,
    "pressureSensor": 773,
    "flowSensor": 774,
    "miniSplitAc": 775,
    "iasControlIndicatingEquipment": 1024,
    "iasAncillaryControlEquipment": 1025,
    "iasZone": 1026,
    "iasWarningDevice": 1027
}
  • Cluster
{
    "genBasic": 0,
    "genPowerCfg": 1,
    "genDeviceTempCfg": 2,
    "genIdentify": 3,
    "genGroups": 4,
    "genScenes": 5,
    "genOnOff": 6,
    "genOnOffSwitchCfg": 7,
    "genLevelCtrl": 8,
    "genAlarms": 9,
    "genTime": 10,
    "genRssiLocation": 11,
    "genAnalogInput": 12,
    "genAnalogOutput": 13,
    "genAnalogValue": 14,
    "genBinaryInput": 15,
    "genBinaryOutput": 16,
    "genBinaryValue": 17,
    "genMultistateInput": 18,
    "genMultistateOutput": 19,
    "genMultistateValue": 20,
    "genCommissioning": 21,
    "genPartition": 22,
    "genOta": 25,
    "genPowerProfile": 26,
    "genApplianceCtrl": 27,
    "genPollCtrl": 32,
    "genGreenPowerProxy": 33,
    "mobileDeviceCfg": 34,
    "neighborCleaning": 35,
    "nearestGateway": 36,
    "closuresShadeCfg": 256,
    "closuresDoorLock": 257,
    "closuresWindowCovering": 258,
    "hvacPumpCfgCtrl": 512,
    "hvacThermostat": 513,
    "hvacFanCtrl": 514,
    "hvacDehumidificationCtrl": 515,
    "hvacUserInterfaceCfg": 516,
    "lightingColorCtrl": 768,
    "lightingBallastCfg": 769,
    "msIlluminanceMeasurement": 1024,
    "msIlluminanceLevelSensing": 1025,
    "msTemperatureMeasurement": 1026,
    "msPressureMeasurement": 1027,
    "msFlowMeasurement": 1028,
    "msRelativeHumidity": 1029,
    "msOccupancySensing": 1030,
    "ssIasZone": 1280,
    "ssIasAce": 1281,
    "ssIasWd": 1282,
    "piGenericTunnel": 1536,
    "piBacnetProtocolTunnel": 1537,
    "piAnalogInputReg": 1538,
    "piAnalogInputExt": 1539,
    "piAnalogOutputReg": 1540,
    "piAnalogOutputExt": 1541,
    "piAnalogValueReg": 1542,
    "piAnalogValueExt": 1543,
    "piBinaryInputReg": 1544,
    "piBinaryInputExt": 1545,
    "piBinaryOutputReg": 1546,
    "piBinaryOutputExt": 1547,
    "piBinaryValueReg": 1548,
    "piBinaryValueExt": 1549,
    "piMultistateInputReg": 1550,
    "piMultistateInputExt": 1551,
    "piMultistateOutputReg": 1552,
    "piMultistateOutputExt": 1553,
    "piMultistateValueReg": 1554,
    "piMultistateValueExt": 1555,
    "pi11073ProtocolTunnel": 1556,
    "piIso7818ProtocolTunnel": 1557,
    "piRetailTunnel": 1559,
    "sePrice": 1792,
    "seDrlc": 1793,
    "seMetering": 1794,
    "seMessaging": 1795,
    "seTunneling": 1796,
    "sePrepayment": 1797,
    "seEnergyMgmt": 1798,
    "seCalendar": 1799,
    "seDeviceMgmt": 1800,
    "seEvents": 1801,
    "seMduPairing": 1802,
    "seKeyEstablishment": 2048,
    "telecommunicationsInformation": 2304,
    "telecommunicationsVoiceOverZigbee": 2308,
    "telecommunicationsChatting": 2309,
    "haApplianceIdentification": 2816,
    "haMeterIdentification": 2817,
    "haApplianceEventsAlerts": 2818,
    "haApplianceStatistics": 2819,
    "haElectricalMeasurement": 2820,
    "haDiagnostic": 2821,
    "lightLink": 4096,
    "manuSpecificCluster": 65535
}
  • DataType
{
    "noData": 0,
    "data8": 8,
    "data16": 9,
    "data24": 10,
    "data32": 11,
    "data40": 12,
    "data48": 13,
    "data56": 14,
    "data64": 15,
    "boolean": 16,
    "bitmap8": 24,
    "bitmap16": 25,
    "bitmap24": 26,
    "bitmap32": 27,
    "bitmap40": 28,
    "bitmap48": 29,
    "bitmap56": 30,
    "bitmap64": 31,
    "uint8": 32,
    "uint16": 33,
    "uint24": 34,
    "uint32": 35,
    "uint40": 36,
    "uint48": 37,
    "uint56": 38,
    "uint64": 39,
    "int8": 40,
    "int16": 41,
    "int24": 42,
    "int32": 43,
    "int40": 44,
    "int48": 45,
    "int56": 46,
    "int64": 47,
    "enum8": 48,
    "enum16": 49,
    "semiPrec": 56,
    "singlePrec": 57,
    "doublePrec": 58,
    "octetStr": 65,
    "charStr": 66,
    "longOctetStr": 67,
    "longCharStr": 68,
    "array": 72,
    "struct": 76,
    "set": 80,
    "bag": 81,
    "tod": 224,
    "date": 225,
    "utc": 226,
    "clusterId": 232,
    "attrId": 233,
    "bacOid": 234,
    "ieeeAddr": 240,
    "secKey": 241,
    "unknown": 255
}
  • Status
{
    "success": 0,
    "failure": 1,
    "notAuthorized": 126,
    "malformedCmd": 128,
    "unsupClusterCmd": 129,
    "unsupGeneralCmd": 130,
    "unsupManuClusterCmd": 131,
    "unsupManuGeneralCmd": 132,
    "invalidField": 133,
    "unsupAttribute": 134,
    "invalidValue": 135,
    "readOnly": 136,
    "insufficientSpace": 137,
    "duplicateExists": 138,
    "notFound": 139,
    "unreportableAttribute": 140,
    "invalidDataType": 141,
    "invalidSelector": 142,
    "writeOnly": 143,
    "inconsistentStartupState": 144,
    "definedOutOfBand": 145,
    "inconsistent": 146,
    "actionDenied": 147,
    "timeout": 148,
    "abort": 149,
    "invalidImage": 150,
    "waitForData": 151,
    "noImageAvailable": 152,
    "requireMoreImage": 153,
    "notificationPending": 154,
    "hardwareFailure": 192,
    "softwareFailure": 193,
    "calibrationError": 194,
    "unsupportedCluster": 195
}


6. Contributors