zigbee-clusters 1.7.3 → 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 +4 -0
- package/lib/Cluster.js +8 -2
- package/package.json +1 -1
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
|
|
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
|
|