zigbee-clusters 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -207,7 +207,7 @@ zclNode.endpoints[1].bind(CLUSTER.LEVEL_CONTROL.NAME, new LevelControlBoundClust
207
207
  ```
208
208
 
209
209
  ### Implementing a custom cluster
210
- There are cases where it is required to implement a custom cluster, for example to handle manufacturer specific cluster implementations. Often these manufacturer specific cluster implementations are extensions of existing clusters. An example is the `IkeaSpecificSceneCluster` ([complete implementation](https://github.com/athombv/com.ikea.tradfri/tree/master/lib/IkeaSpecificSceneCluster.js)):
210
+ There are cases where it is required to implement a custom cluster, for example to handle manufacturer specific cluster implementations. Often these manufacturer specific cluster implementations are extensions of existing clusters. An example is the `IkeaSpecificSceneCluster` ([complete implementation](https://github.com/athombv/com.ikea.tradfri-example/tree/master/lib/IkeaSpecificSceneCluster.js)):
211
211
 
212
212
  `lib/IkeaSpecificSceneCluster.js`
213
213
  ```js
@@ -267,7 +267,7 @@ zclNode.endpoints[1].clusters['scenes'].ikeaSceneMove({mode: 0, transitionTime:
267
267
 
268
268
  ```
269
269
 
270
- This also works for `BoundClusters`, if a node sends commands to Homey using a custom cluster it is necessary to implement a custom `BoundCluster` and bind it to the `ZCLNode` instance. For an example check the implementation in the `com.ikea.tradfri` driver [remote_control](https://github.com/athombv/com.ikea.tradfri/tree/master/drivers/remote_control/device.js).
270
+ This also works for `BoundClusters`, if a node sends commands to Homey using a custom cluster it is necessary to implement a custom `BoundCluster` and bind it to the `ZCLNode` instance. For an example check the implementation in the `com.ikea.tradfri` driver [remote_control](https://github.com/athombv/com.ikea.tradfri-example/tree/master/drivers/remote_control/device.js).
271
271
 
272
272
  ## Contributing
273
273
  Great if you'd like to contribute to this project, a few things to take note of before submitting a PR:
package/lib/Node.js CHANGED
@@ -56,9 +56,12 @@ class Node extends EventEmitter {
56
56
  };
57
57
 
58
58
  this.endpoints = {};
59
- node.endpointDescriptors.forEach(ep => {
60
- this.endpoints[ep.endpointId] = new Endpoint(this, ep);
61
- });
59
+
60
+ if (Array.isArray(node.endpointDescriptors)) {
61
+ node.endpointDescriptors.forEach(ep => {
62
+ this.endpoints[ep.endpointId] = new Endpoint(this, ep);
63
+ });
64
+ }
62
65
  }
63
66
 
64
67
  /**
@@ -1,10 +1,43 @@
1
1
  'use strict';
2
2
 
3
3
  const Cluster = require('../Cluster');
4
+ const { ZCLDataTypes } = require('../zclTypes');
4
5
 
5
- const ATTRIBUTES = {};
6
+ const ATTRIBUTES = {
7
+ identifyTime: { id: 0, type: ZCLDataTypes.uint16 },
8
+ };
6
9
 
7
- const COMMANDS = {};
10
+ const COMMANDS = {
11
+ identify: {
12
+ id: 0,
13
+ args: {
14
+ identifyTime: ZCLDataTypes.uint16,
15
+ },
16
+ },
17
+ identifyQuery: {
18
+ id: 1,
19
+ response: {
20
+ id: 0,
21
+ args: {
22
+ timeout: ZCLDataTypes.uint16,
23
+ },
24
+ },
25
+ },
26
+ triggerEffect: {
27
+ id: 64,
28
+ args: {
29
+ effectIdentifier: ZCLDataTypes.enum8({
30
+ blink: 0,
31
+ breathe: 1,
32
+ okay: 2,
33
+ channelChange: 11,
34
+ finish: 254,
35
+ stop: 255,
36
+ }),
37
+ effectVariant: ZCLDataTypes.uint16,
38
+ },
39
+ },
40
+ };
8
41
 
9
42
  class IdentifyCluster extends Cluster {
10
43
 
@@ -24,6 +24,42 @@ const ATTRIBUTES = {
24
24
  batteryQuantity: { id: 51, type: ZCLDataTypes.uint8 },
25
25
  batteryRatedVoltage: { id: 52, type: ZCLDataTypes.uint8 },
26
26
  batteryVoltageMinThreshold: { id: 54, type: ZCLDataTypes.uint8 },
27
+ batteryAlarmState: {
28
+ id: 62,
29
+ type: ZCLDataTypes.map32(
30
+ 'batteryThresholdBatterySource1',
31
+ 'batteryThreshold1BatterySource1',
32
+ 'batteryThreshold2BatterySource1',
33
+ 'batteryThreshold3BatterySource1',
34
+ 'reserved4',
35
+ 'reserved5',
36
+ 'reserved6',
37
+ 'reserved7',
38
+ 'reserved8',
39
+ 'reserved9',
40
+ 'batteryThresholdBatterySource2',
41
+ 'batteryThreshold1BatterySource2',
42
+ 'batteryThreshold2BatterySource2',
43
+ 'batteryThreshold3BatterySource2',
44
+ 'reserved14',
45
+ 'reserved15',
46
+ 'reserved16',
47
+ 'reserved17',
48
+ 'reserved18',
49
+ 'reserved19',
50
+ 'batteryThresholdBatterySource3',
51
+ 'batteryThreshold1BatterySource3',
52
+ 'batteryThreshold2BatterySource3',
53
+ 'batteryThreshold3BatterySource3',
54
+ 'reserved24',
55
+ 'reserved25',
56
+ 'reserved26',
57
+ 'reserved27',
58
+ 'reserved28',
59
+ 'reserved29',
60
+ 'mainsPowerSupplyLostUnavailable',
61
+ ),
62
+ },
27
63
  };
28
64
 
29
65
  const COMMANDS = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-clusters",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Zigbee Cluster Library for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,15 +30,15 @@
30
30
  },
31
31
  "homepage": "https://github.com/athombv/node-zigbee-clusters#readme",
32
32
  "devDependencies": {
33
- "homey-jsdoc-template": "github:athombv/homey-jsdoc-template#1.0.5",
34
33
  "concurrently": "^5.2.0",
35
34
  "eslint": "^6.8.0",
36
35
  "eslint-config-athom": "^2.1.0",
36
+ "homey-jsdoc-template": "github:athombv/homey-jsdoc-template#1.4",
37
37
  "jsdoc": "^3.6.7",
38
38
  "jsdoc-ts-utils": "^2.0.0",
39
- "watch": "^1.0.2",
40
39
  "mocha": "^7.2.0",
41
- "serve": "^11.3.1"
40
+ "serve": "^11.3.1",
41
+ "watch": "^1.0.2"
42
42
  },
43
43
  "dependencies": {
44
44
  "@athombv/data-types": "^1.0.4",