zigbee-clusters 1.7.2 → 1.8.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
@@ -70,6 +70,10 @@ class MyDevice extends Homey.Device {
70
70
  // You should only use this flag if the device does not follow the
71
71
  // Zigbee specification and refuses to send a default response.
72
72
  waitForResponse: true,
73
+
74
+ // This is an optional property that allows for adjusting the response
75
+ // timeout (25000ms) before the command is considered rejected.
76
+ timeout: 10000,
73
77
  });
74
78
  });
75
79
  }
package/lib/Cluster.js CHANGED
@@ -956,7 +956,7 @@ class Cluster extends EventEmitter {
956
956
  return new Promise((resolve, reject) => {
957
957
  const t = setTimeout(() => {
958
958
  delete this._trxHandlers[trxSequenceNumber];
959
- reject(new Error('Timeout: Expected Default Response'));
959
+ reject(new Error('Timeout: Expected Response'));
960
960
  }, timeout);
961
961
  this._trxHandlers[trxSequenceNumber] = async frame => {
962
962
  delete this._trxHandlers[trxSequenceNumber];
@@ -1084,8 +1084,14 @@ class Cluster extends EventEmitter {
1084
1084
  return this.sendFrame(payload);
1085
1085
  }
1086
1086
 
1087
+ // Check if a valid timeout override is provided
1088
+ let responseTimeout;
1089
+ if (typeof opts.timeout === 'number') {
1090
+ responseTimeout = opts.timeout;
1091
+ }
1092
+
1087
1093
  const [response] = await Promise.all([
1088
- this._awaitPacket(payload.trxSequenceNumber),
1094
+ this._awaitPacket(payload.trxSequenceNumber, responseTimeout),
1089
1095
  this.sendFrame(payload),
1090
1096
  ]);
1091
1097
 
package/lib/Node.js CHANGED
@@ -73,7 +73,7 @@ class Node extends EventEmitter {
73
73
  */
74
74
  getLogId(endpointId, clusterId) {
75
75
  const cluster = Cluster.getCluster(clusterId);
76
- return getLogId(endpointId, cluster.NAME, clusterId);
76
+ return getLogId(endpointId, cluster ? cluster.NAME : 'unknown', clusterId);
77
77
  }
78
78
 
79
79
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-clusters",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "description": "Zigbee Cluster Library for Node.js",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",