zigbee-clusters 2.2.2 → 2.4.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/index.d.ts +6 -0
- package/lib/Cluster.js +15 -0
- package/lib/clusters/pollControl.js +26 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -276,6 +276,12 @@ interface MeteringCluster extends ZCLNodeCluster {}
|
|
|
276
276
|
|
|
277
277
|
interface ElectricalMeasurementCluster extends ZCLNodeCluster {}
|
|
278
278
|
|
|
279
|
+
interface PollControlCluster extends ZCLNodeCluster {
|
|
280
|
+
fastPollStop(): Promise<void>;
|
|
281
|
+
setLongPollInterval(opts: { newLongPollInterval: number }): Promise<void>;
|
|
282
|
+
setShortPollInterval(opts: { newShortPollInterval: number }): Promise<void>;
|
|
283
|
+
}
|
|
284
|
+
|
|
279
285
|
type ZCLNodeEndpoint = {
|
|
280
286
|
clusters: {
|
|
281
287
|
onOff?: OnOffCluster;
|
package/lib/Cluster.js
CHANGED
|
@@ -1087,6 +1087,21 @@ class Cluster extends EventEmitter {
|
|
|
1087
1087
|
return this.sendFrame(payload);
|
|
1088
1088
|
}
|
|
1089
1089
|
|
|
1090
|
+
// This is a workaround for nodes that send a default response, even if they are sending
|
|
1091
|
+
// another response message (this is not allowed by zigbee cluster spec §2.5.12.2).
|
|
1092
|
+
// The option sets the 'Disable Default Response' flag in the ZCL header,
|
|
1093
|
+
// causing the node to only send a default response if an error occurred.
|
|
1094
|
+
// A normal response from the node is still required to resolve this cluster command.
|
|
1095
|
+
if (opts.disableDefaultResponse) {
|
|
1096
|
+
if (!Array.isArray(payload.frameControl)) {
|
|
1097
|
+
// Need to add the 'clusterSpecific' flag here,
|
|
1098
|
+
// because it is not added by 'sendFrame' if the frameControl flags are present.
|
|
1099
|
+
payload.frameControl = ['clusterSpecific', 'disableDefaultResponse'];
|
|
1100
|
+
} else if (!payload.frameControl.includes('disableDefaultResponse')) {
|
|
1101
|
+
payload.frameControl.push('disableDefaultResponse');
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1090
1105
|
if (opts.waitForResponse === false) {
|
|
1091
1106
|
return this.sendFrame(payload);
|
|
1092
1107
|
}
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { ZCLDataTypes } = require('../zclTypes');
|
|
3
4
|
const Cluster = require('../Cluster');
|
|
4
5
|
|
|
5
|
-
const ATTRIBUTES = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const ATTRIBUTES = {
|
|
7
|
+
checkInInterval: { id: 0, type: ZCLDataTypes.uint32 },
|
|
8
|
+
longPollInterval: { id: 1, type: ZCLDataTypes.uint32 },
|
|
9
|
+
shortPollInterval: { id: 2, type: ZCLDataTypes.uint16 },
|
|
10
|
+
fastPollTimeout: { id: 3, type: ZCLDataTypes.uint16 },
|
|
11
|
+
checkInIntervalMin: { id: 4, type: ZCLDataTypes.uint32 },
|
|
12
|
+
longPollIntervalMin: { id: 5, type: ZCLDataTypes.uint32 },
|
|
13
|
+
fastPollTimeoutMax: { id: 6, type: ZCLDataTypes.uint16 },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const COMMANDS = {
|
|
17
|
+
fastPollStop: { id: 1 },
|
|
18
|
+
setLongPollInterval: {
|
|
19
|
+
id: 2,
|
|
20
|
+
args: {
|
|
21
|
+
newLongPollInterval: ZCLDataTypes.uint32,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
setShortPollInterval: {
|
|
25
|
+
id: 3,
|
|
26
|
+
args: {
|
|
27
|
+
newShortPollInterval: ZCLDataTypes.uint16,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
8
31
|
|
|
9
32
|
class PollControlCluster extends Cluster {
|
|
10
33
|
|