@willieee802/zigbee-herdsman 0.49.3 → 0.50.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/.github/dependabot.yml +0 -3
- package/.github/workflows/ci.yml +1 -2
- package/.github/workflows/release-please.yml +1 -1
- package/.github/workflows/typedoc.yaml +3 -3
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +143 -0
- package/biome.json +1 -1
- package/dist/adapter/adapter.d.ts +14 -1
- package/dist/adapter/adapter.d.ts.map +1 -1
- package/dist/adapter/adapter.js +17 -0
- package/dist/adapter/adapter.js.map +1 -1
- package/dist/adapter/adapterDiscovery.d.ts.map +1 -1
- package/dist/adapter/adapterDiscovery.js.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts +1 -3
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.js +14 -29
- package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
- package/dist/adapter/deconz/driver/constants.d.ts +1 -1
- package/dist/adapter/deconz/driver/constants.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.d.ts +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.js +19 -10
- package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
- package/dist/adapter/ember/adapter/oneWaitress.d.ts +2 -0
- package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/oneWaitress.js +13 -5
- package/dist/adapter/ember/adapter/oneWaitress.js.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts +1 -3
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.js +17 -30
- package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
- package/dist/adapter/ezsp/driver/index.d.ts +1 -1
- package/dist/adapter/ezsp/driver/index.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/index.js +1 -1
- package/dist/adapter/ezsp/driver/index.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/index.d.ts +1 -1
- package/dist/adapter/ezsp/driver/types/index.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/types/index.js +3 -3
- package/dist/adapter/ezsp/driver/types/index.js.map +1 -1
- package/dist/adapter/serialPort.d.ts.map +1 -1
- package/dist/adapter/serialPort.js +7 -0
- package/dist/adapter/serialPort.js.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.js +1 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.js.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.js +1 -1
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.js.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.js +12 -2
- package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
- package/dist/adapter/z-stack/adapter/tstype.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +1 -3
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.js +20 -34
- package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
- package/dist/adapter/z-stack/constants/index.d.ts +1 -1
- package/dist/adapter/z-stack/constants/index.d.ts.map +1 -1
- package/dist/adapter/z-stack/constants/index.js +1 -1
- package/dist/adapter/z-stack/constants/index.js.map +1 -1
- package/dist/adapter/z-stack/unpi/constants.d.ts +1 -1
- package/dist/adapter/z-stack/unpi/constants.d.ts.map +1 -1
- package/dist/adapter/z-stack/unpi/constants.js +1 -1
- package/dist/adapter/z-stack/unpi/constants.js.map +1 -1
- package/dist/adapter/zboss/adapter/zbossAdapter.d.ts +7 -8
- package/dist/adapter/zboss/adapter/zbossAdapter.d.ts.map +1 -1
- package/dist/adapter/zboss/adapter/zbossAdapter.js +12 -30
- package/dist/adapter/zboss/adapter/zbossAdapter.js.map +1 -1
- package/dist/adapter/zboss/driver.d.ts.map +1 -1
- package/dist/adapter/zboss/driver.js +8 -1
- package/dist/adapter/zboss/driver.js.map +1 -1
- package/dist/adapter/zboss/uart.d.ts.map +1 -1
- package/dist/adapter/zboss/uart.js +14 -2
- package/dist/adapter/zboss/uart.js.map +1 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts +1 -3
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts.map +1 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.js +8 -29
- package/dist/adapter/zigate/adapter/zigateAdapter.js.map +1 -1
- package/dist/adapter/zoh/adapter/zohAdapter.d.ts +1 -3
- package/dist/adapter/zoh/adapter/zohAdapter.d.ts.map +1 -1
- package/dist/adapter/zoh/adapter/zohAdapter.js +18 -33
- package/dist/adapter/zoh/adapter/zohAdapter.js.map +1 -1
- package/dist/controller/controller.d.ts.map +1 -1
- package/dist/controller/controller.js +10 -2
- package/dist/controller/controller.js.map +1 -1
- package/dist/controller/greenPower.d.ts.map +1 -1
- package/dist/controller/greenPower.js +15 -9
- package/dist/controller/greenPower.js.map +1 -1
- package/dist/controller/helpers/ota.d.ts +4 -4
- package/dist/controller/helpers/ota.d.ts.map +1 -1
- package/dist/controller/helpers/ota.js +28 -9
- package/dist/controller/helpers/ota.js.map +1 -1
- package/dist/controller/helpers/zclFrameConverter.d.ts.map +1 -1
- package/dist/controller/helpers/zclFrameConverter.js +17 -16
- package/dist/controller/helpers/zclFrameConverter.js.map +1 -1
- package/dist/controller/model/device.d.ts +14 -4
- package/dist/controller/model/device.d.ts.map +1 -1
- package/dist/controller/model/device.js +167 -85
- package/dist/controller/model/device.js.map +1 -1
- package/dist/controller/model/endpoint.d.ts +7 -3
- package/dist/controller/model/endpoint.d.ts.map +1 -1
- package/dist/controller/model/endpoint.js +34 -21
- package/dist/controller/model/endpoint.js.map +1 -1
- package/dist/controller/model/group.d.ts +0 -1
- package/dist/controller/model/group.d.ts.map +1 -1
- package/dist/controller/model/group.js +14 -19
- package/dist/controller/model/group.js.map +1 -1
- package/dist/controller/touchlink.js +3 -3
- package/dist/controller/touchlink.js.map +1 -1
- package/dist/utils/timeService.js +2 -2
- package/dist/utils/timeService.js.map +1 -1
- package/dist/zspec/zcl/buffaloZcl.d.ts +3 -3
- package/dist/zspec/zcl/buffaloZcl.d.ts.map +1 -1
- package/dist/zspec/zcl/buffaloZcl.js +198 -96
- package/dist/zspec/zcl/buffaloZcl.js.map +1 -1
- package/dist/zspec/zcl/definition/cluster.d.ts +2 -2
- package/dist/zspec/zcl/definition/cluster.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/cluster.js +2699 -2808
- package/dist/zspec/zcl/definition/cluster.js.map +1 -1
- package/dist/zspec/zcl/definition/clusters-types.d.ts +63 -1109
- package/dist/zspec/zcl/definition/clusters-types.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/enums.d.ts +0 -1
- package/dist/zspec/zcl/definition/enums.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/enums.js +0 -1
- package/dist/zspec/zcl/definition/enums.js.map +1 -1
- package/dist/zspec/zcl/definition/foundation.d.ts +306 -7
- package/dist/zspec/zcl/definition/foundation.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/foundation.js +552 -207
- package/dist/zspec/zcl/definition/foundation.js.map +1 -1
- package/dist/zspec/zcl/definition/status.d.ts +21 -10
- package/dist/zspec/zcl/definition/status.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/status.js +11 -0
- package/dist/zspec/zcl/definition/status.js.map +1 -1
- package/dist/zspec/zcl/definition/tstype.d.ts +57 -48
- package/dist/zspec/zcl/definition/tstype.d.ts.map +1 -1
- package/dist/zspec/zcl/utils.d.ts +7 -4
- package/dist/zspec/zcl/utils.d.ts.map +1 -1
- package/dist/zspec/zcl/utils.js +133 -240
- package/dist/zspec/zcl/utils.js.map +1 -1
- package/dist/zspec/zcl/zclFrame.d.ts +4 -4
- package/dist/zspec/zcl/zclFrame.d.ts.map +1 -1
- package/dist/zspec/zcl/zclFrame.js +19 -103
- package/dist/zspec/zcl/zclFrame.js.map +1 -1
- package/dist/zspec/zcl/zclStatusError.d.ts +1 -1
- package/dist/zspec/zcl/zclStatusError.d.ts.map +1 -1
- package/dist/zspec/zcl/zclStatusError.js +2 -2
- package/dist/zspec/zcl/zclStatusError.js.map +1 -1
- package/package.json +1 -1
- package/scripts/clusters-typegen.ts +44 -139
- package/src/adapter/adapter.ts +38 -3
- package/src/adapter/adapterDiscovery.ts +2 -1
- package/src/adapter/deconz/adapter/deconzAdapter.ts +24 -51
- package/src/adapter/deconz/driver/constants.ts +1 -1
- package/src/adapter/ember/adapter/emberAdapter.ts +23 -10
- package/src/adapter/ember/adapter/oneWaitress.ts +16 -6
- package/src/adapter/ezsp/adapter/ezspAdapter.ts +27 -48
- package/src/adapter/ezsp/driver/index.ts +1 -1
- package/src/adapter/ezsp/driver/types/index.ts +99 -99
- package/src/adapter/serialPort.ts +9 -0
- package/src/adapter/z-stack/adapter/adapter-backup.ts +1 -1
- package/src/adapter/z-stack/adapter/adapter-nv-memory.ts +1 -1
- package/src/adapter/z-stack/adapter/manager.ts +16 -2
- package/src/adapter/z-stack/adapter/tstype.ts +1 -0
- package/src/adapter/z-stack/adapter/zStackAdapter.ts +34 -81
- package/src/adapter/z-stack/constants/index.ts +1 -1
- package/src/adapter/z-stack/unpi/constants.ts +1 -1
- package/src/adapter/zboss/adapter/zbossAdapter.ts +23 -54
- package/src/adapter/zboss/driver.ts +8 -1
- package/src/adapter/zboss/uart.ts +14 -1
- package/src/adapter/zigate/adapter/zigateAdapter.ts +17 -48
- package/src/adapter/zoh/adapter/zohAdapter.ts +27 -50
- package/src/controller/controller.ts +12 -2
- package/src/controller/greenPower.ts +16 -9
- package/src/controller/helpers/ota.ts +37 -11
- package/src/controller/helpers/zclFrameConverter.ts +20 -17
- package/src/controller/model/device.ts +204 -97
- package/src/controller/model/endpoint.ts +36 -24
- package/src/controller/model/group.ts +14 -20
- package/src/controller/touchlink.ts +3 -3
- package/src/utils/timeService.ts +2 -2
- package/src/zspec/zcl/buffaloZcl.ts +226 -100
- package/src/zspec/zcl/definition/cluster.ts +2713 -2822
- package/src/zspec/zcl/definition/clusters-types.ts +80 -1135
- package/src/zspec/zcl/definition/enums.ts +0 -1
- package/src/zspec/zcl/definition/foundation.ts +703 -216
- package/src/zspec/zcl/definition/status.ts +22 -11
- package/src/zspec/zcl/definition/tstype.ts +59 -58
- package/src/zspec/zcl/utils.ts +137 -264
- package/src/zspec/zcl/zclFrame.ts +25 -130
- package/src/zspec/zcl/zclStatusError.ts +2 -2
- package/test/adapter/ember/emberAdapter.test.ts +191 -4
- package/test/adapter/ezsp/uart.test.ts +10 -10
- package/test/adapter/z-stack/adapter.test.ts +88 -32
- package/test/adapter/zoh/zohAdapter.test.ts +4 -4
- package/test/controller.test.ts +822 -248
- package/test/device-ota.test.ts +141 -16
- package/test/device.test.ts +731 -0
- package/test/requests.bench.ts +2 -0
- package/test/zcl.test.ts +70 -95
- package/test/zspec/zcl/buffalo.test.ts +251 -11
- package/test/zspec/zcl/foundation.test.ts +990 -0
- package/test/zspec/zcl/frame.test.ts +84 -69
- package/test/zspec/zcl/utils.test.ts +105 -81
- package/tsconfig.json +0 -1
- package/scripts/check-clusters-changes.ts +0 -328
- package/scripts/clusters-changes.log +0 -584
- package/scripts/utils.ts +0 -88
- package/scripts/zap-update-clusters-report.json +0 -303
- package/scripts/zap-update-clusters.ts +0 -1520
- package/scripts/zap-update-types.ts +0 -707
- package/scripts/zap-xml-clusters-overrides-data.ts +0 -52
- package/scripts/zap-xml-clusters-overrides.ts +0 -400
- package/scripts/zap-xml-types.ts +0 -146
package/test/requests.bench.ts
CHANGED
|
@@ -275,6 +275,7 @@ describe("Requests", () => {
|
|
|
275
275
|
},
|
|
276
276
|
BASIC_REQ_FRAME,
|
|
277
277
|
endpoint,
|
|
278
|
+
Zcl.Status.SUCCESS,
|
|
278
279
|
);
|
|
279
280
|
},
|
|
280
281
|
{
|
|
@@ -307,6 +308,7 @@ describe("Requests", () => {
|
|
|
307
308
|
},
|
|
308
309
|
TIME_REQ_FRAME,
|
|
309
310
|
endpoint,
|
|
311
|
+
Zcl.Status.SUCCESS,
|
|
310
312
|
);
|
|
311
313
|
},
|
|
312
314
|
{
|
package/test/zcl.test.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {BuffaloZclDataType, DataType, Direction, FrameType, StructuredIndicatorT
|
|
|
5
5
|
|
|
6
6
|
const MANU_SPE_CUSTOM_CLUSTERS = {
|
|
7
7
|
manuSpecificAssaDoorLock: {
|
|
8
|
+
name: "manuSpecificAssaDoorLock",
|
|
8
9
|
ID: 0xfc00,
|
|
9
10
|
attributes: {},
|
|
10
11
|
commands: {},
|
|
@@ -12,6 +13,18 @@ const MANU_SPE_CUSTOM_CLUSTERS = {
|
|
|
12
13
|
},
|
|
13
14
|
};
|
|
14
15
|
|
|
16
|
+
const MIBOXER_GROUPS_CUSTOM_CLUSTER = {
|
|
17
|
+
genGroups: {
|
|
18
|
+
name: "genGroups",
|
|
19
|
+
ID: Zcl.Clusters.genGroups.ID,
|
|
20
|
+
attributes: {},
|
|
21
|
+
commands: {
|
|
22
|
+
miboxerSetZones: {name: "miboxerSetZones", ID: 0xf0, parameters: [{name: "zones", type: BuffaloZclDataType.LIST_MIBOXER_ZONES}]},
|
|
23
|
+
},
|
|
24
|
+
commandsResponse: {},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
15
28
|
describe("Zcl", () => {
|
|
16
29
|
it("Get cluster by name", () => {
|
|
17
30
|
const cluster = Zcl.Utils.getCluster("genIdentify", undefined, {});
|
|
@@ -25,41 +38,29 @@ describe("Zcl", () => {
|
|
|
25
38
|
|
|
26
39
|
it("Get cluster by ID", () => {
|
|
27
40
|
const cluster1 = Zcl.Utils.getCluster(0, undefined, {});
|
|
28
|
-
// @ts-expect-error testing
|
|
29
|
-
delete cluster1.getAttribute;
|
|
30
|
-
// @ts-expect-error testing
|
|
31
|
-
delete cluster1.getCommand;
|
|
32
|
-
// @ts-expect-error testing
|
|
33
|
-
delete cluster1.getCommandResponse;
|
|
34
41
|
const cluster2 = Zcl.Utils.getCluster("genBasic", undefined, {});
|
|
35
|
-
// @ts-expect-error testing
|
|
36
|
-
delete cluster2.getAttribute;
|
|
37
|
-
// @ts-expect-error testing
|
|
38
|
-
delete cluster2.getCommand;
|
|
39
|
-
// @ts-expect-error testing
|
|
40
|
-
delete cluster2.getCommandResponse;
|
|
41
42
|
expect(cluster1).toStrictEqual(cluster2);
|
|
42
43
|
});
|
|
43
44
|
|
|
44
45
|
it("Get cluster attribute by ID", () => {
|
|
45
46
|
const cluster = Zcl.Utils.getCluster(0, undefined, {});
|
|
46
|
-
const attribute =
|
|
47
|
+
const attribute = Zcl.Utils.getClusterAttribute(cluster, 1, undefined);
|
|
47
48
|
expect(attribute).toStrictEqual({ID: 1, type: DataType.UINT8, name: "appVersion", default: 0, max: 255});
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
it("Cluster has attribute", () => {
|
|
51
52
|
const cluster = Zcl.Utils.getCluster(0, undefined, {});
|
|
52
|
-
expect(
|
|
53
|
-
expect(
|
|
54
|
-
expect(
|
|
55
|
-
expect(
|
|
53
|
+
expect(Zcl.Utils.getClusterAttribute(cluster, "zclVersion", undefined)).not.toBeUndefined();
|
|
54
|
+
expect(Zcl.Utils.getClusterAttribute(cluster, "NOTEXISTING", undefined)).toBeUndefined();
|
|
55
|
+
expect(Zcl.Utils.getClusterAttribute(cluster, 0, undefined)).not.toBeUndefined();
|
|
56
|
+
expect(Zcl.Utils.getClusterAttribute(cluster, 910293, undefined)).toBeUndefined();
|
|
56
57
|
});
|
|
57
58
|
|
|
58
59
|
it("Get specific command by name", () => {
|
|
59
60
|
const cluster = Zcl.Utils.getCluster("genIdentify", undefined, {});
|
|
60
|
-
const command =
|
|
61
|
-
expect(command.ID).toBe(
|
|
62
|
-
expect(command.name).toBe("
|
|
61
|
+
const command = Zcl.Utils.getClusterCommand(cluster, "identify");
|
|
62
|
+
expect(command.ID).toBe(0);
|
|
63
|
+
expect(command.name).toBe("identify");
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
it("Get global command by name", () => {
|
|
@@ -71,13 +72,13 @@ describe("Zcl", () => {
|
|
|
71
72
|
it("Get global command non existing", () => {
|
|
72
73
|
expect(() => {
|
|
73
74
|
Zcl.Utils.getGlobalCommand("nonexisting");
|
|
74
|
-
}).toThrow("
|
|
75
|
+
}).toThrow("Status 'UNSUP_COMMAND' foundation:nonexisting");
|
|
75
76
|
});
|
|
76
77
|
|
|
77
78
|
it("Get cluster by name non-existing", () => {
|
|
78
79
|
expect(() => {
|
|
79
80
|
Zcl.Utils.getCluster("notExisting", undefined, {});
|
|
80
|
-
}).toThrow("
|
|
81
|
+
}).toThrow("Status 'UNSUPPORTED_CLUSTER' notExisting");
|
|
81
82
|
});
|
|
82
83
|
|
|
83
84
|
it("Get cluster by id non-existing", () => {
|
|
@@ -92,13 +93,13 @@ describe("Zcl", () => {
|
|
|
92
93
|
|
|
93
94
|
it("Get specific command by ID", () => {
|
|
94
95
|
const cluster = Zcl.Utils.getCluster("genIdentify", undefined, {});
|
|
95
|
-
const command =
|
|
96
|
-
expect(command).toStrictEqual(
|
|
96
|
+
const command = Zcl.Utils.getClusterCommand(cluster, 0);
|
|
97
|
+
expect(command).toStrictEqual(Zcl.Utils.getClusterCommand(cluster, "identify"));
|
|
97
98
|
});
|
|
98
99
|
|
|
99
100
|
it("Get specific command by name server to client", () => {
|
|
100
101
|
const cluster = Zcl.Utils.getCluster("genIdentify", undefined, {});
|
|
101
|
-
const command =
|
|
102
|
+
const command = Zcl.Utils.getClusterCommandResponse(cluster, 0);
|
|
102
103
|
expect(command.ID).toBe(0);
|
|
103
104
|
expect(command.name).toBe("identifyQueryRsp");
|
|
104
105
|
});
|
|
@@ -106,15 +107,8 @@ describe("Zcl", () => {
|
|
|
106
107
|
it("Get specific command by name non existing", () => {
|
|
107
108
|
expect(() => {
|
|
108
109
|
const cluster = Zcl.Utils.getCluster("genIdentify", undefined, {});
|
|
109
|
-
|
|
110
|
-
}).toThrow("
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("Get discrete or analog of unkown type", () => {
|
|
114
|
-
expect(() => {
|
|
115
|
-
// @ts-expect-error invalid on purpose
|
|
116
|
-
Zcl.Utils.getDataTypeClass(99999);
|
|
117
|
-
}).toThrow("Don't know value type for 'undefined'");
|
|
110
|
+
Zcl.Utils.getClusterCommandResponse(cluster, "nonexisting");
|
|
111
|
+
}).toThrow("Status 'UNSUP_COMMAND' response genIdentify:nonexisting");
|
|
118
112
|
});
|
|
119
113
|
|
|
120
114
|
it("ZclFrame from buffer parse payload with unknown frame type", () => {
|
|
@@ -156,30 +150,6 @@ describe("Zcl", () => {
|
|
|
156
150
|
expect(frame.isCommand("report")).toBe(true);
|
|
157
151
|
});
|
|
158
152
|
|
|
159
|
-
it("ZclFrame from buffer tradfriArrowSingle", () => {
|
|
160
|
-
const buffer = Buffer.from([0x05, 0x7c, 0x11, 0x1d, 0x07, 0x00, 0x01, 0x0d, 0x00]);
|
|
161
|
-
const frame = Zcl.Frame.fromBuffer(Zcl.Clusters.genScenes.ID, Zcl.Header.fromBuffer(buffer)!, buffer, {});
|
|
162
|
-
const header = new Zcl.Header(
|
|
163
|
-
{
|
|
164
|
-
reservedBits: 0,
|
|
165
|
-
direction: 0,
|
|
166
|
-
disableDefaultResponse: false,
|
|
167
|
-
frameType: 1,
|
|
168
|
-
manufacturerSpecific: true,
|
|
169
|
-
},
|
|
170
|
-
4476,
|
|
171
|
-
29,
|
|
172
|
-
7,
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
const payload = {value: 256, value2: 13};
|
|
176
|
-
|
|
177
|
-
expect(frame.header).toStrictEqual(header);
|
|
178
|
-
expect(frame.payload).toStrictEqual(payload);
|
|
179
|
-
expect(frame.command.ID).toStrictEqual(7);
|
|
180
|
-
expect(frame.command.name).toStrictEqual("tradfriArrowSingle");
|
|
181
|
-
});
|
|
182
|
-
|
|
183
153
|
it("ZclFrame from buffer genGroups getMembership", () => {
|
|
184
154
|
const buffer = Buffer.from([0x11, 0x7c, 0x02, 2, 10, 0, 20, 0]);
|
|
185
155
|
const frame = Zcl.Frame.fromBuffer(Zcl.Clusters.genGroups.ID, Zcl.Header.fromBuffer(buffer)!, buffer, {});
|
|
@@ -269,7 +239,7 @@ describe("Zcl", () => {
|
|
|
269
239
|
});
|
|
270
240
|
|
|
271
241
|
it("ZclFrame from buffer configReportRsp - long", () => {
|
|
272
|
-
const buffer = Buffer.from([0x08, 0x01, 0x07,
|
|
242
|
+
const buffer = Buffer.from([0x08, 0x01, 0x07, 0x02, 0x01, 0x34, 0x12, 0x01, 0x01, 0x35, 0x12]);
|
|
273
243
|
const frame = Zcl.Frame.fromBuffer(Zcl.Clusters.genPowerCfg.ID, Zcl.Header.fromBuffer(buffer)!, buffer, {});
|
|
274
244
|
const header = new Zcl.Header(
|
|
275
245
|
{
|
|
@@ -285,7 +255,7 @@ describe("Zcl", () => {
|
|
|
285
255
|
);
|
|
286
256
|
|
|
287
257
|
const payload = [
|
|
288
|
-
{status:
|
|
258
|
+
{status: 2, direction: 1, attrId: 0x1234},
|
|
289
259
|
{status: 1, direction: 1, attrId: 0x1235},
|
|
290
260
|
];
|
|
291
261
|
|
|
@@ -294,7 +264,7 @@ describe("Zcl", () => {
|
|
|
294
264
|
});
|
|
295
265
|
|
|
296
266
|
it("ZclFrame from buffer configReportRsp (hvacThermostat)", () => {
|
|
297
|
-
const buffer = Buffer.from([0x18, 0x03, 0x07, 0x00
|
|
267
|
+
const buffer = Buffer.from([0x18, 0x03, 0x07, 0x00]);
|
|
298
268
|
const frame = Zcl.Frame.fromBuffer(Zcl.Clusters.hvacThermostat.ID, Zcl.Header.fromBuffer(buffer)!, buffer, {});
|
|
299
269
|
const header = new Zcl.Header(
|
|
300
270
|
{
|
|
@@ -309,7 +279,7 @@ describe("Zcl", () => {
|
|
|
309
279
|
7,
|
|
310
280
|
);
|
|
311
281
|
|
|
312
|
-
const payload = [{status: 0
|
|
282
|
+
const payload = [{status: 0}];
|
|
313
283
|
|
|
314
284
|
expect(frame.payload).toStrictEqual(payload);
|
|
315
285
|
expect(frame.header).toStrictEqual(header);
|
|
@@ -571,15 +541,6 @@ describe("Zcl", () => {
|
|
|
571
541
|
{
|
|
572
542
|
attrId: 65282,
|
|
573
543
|
dataType: 76,
|
|
574
|
-
numElms: 6,
|
|
575
|
-
structElms: [
|
|
576
|
-
{elmType: 16, elmVal: 1},
|
|
577
|
-
{elmType: 33, elmVal: 3022},
|
|
578
|
-
{elmType: 33, elmVal: 17320},
|
|
579
|
-
{elmType: 36, elmVal: 1},
|
|
580
|
-
{elmType: 33, elmVal: 560},
|
|
581
|
-
{elmType: 32, elmVal: 86},
|
|
582
|
-
],
|
|
583
544
|
attrData: [
|
|
584
545
|
{elmType: 16, elmVal: 1},
|
|
585
546
|
{elmType: 33, elmVal: 3022},
|
|
@@ -1536,15 +1497,6 @@ describe("Zcl", () => {
|
|
|
1536
1497
|
expect(frame.toBuffer()).toStrictEqual(expected);
|
|
1537
1498
|
});
|
|
1538
1499
|
|
|
1539
|
-
it("ZclFrame to buffer tradfriArrowSingle", () => {
|
|
1540
|
-
const expected = Buffer.from([0x05, 0x7c, 0x11, 0x1d, 0x07, 0x00, 0x01, 0x0d, 0x00]);
|
|
1541
|
-
const payload = {value: 256, value2: 13};
|
|
1542
|
-
|
|
1543
|
-
const frame = Zcl.Frame.create(FrameType.SPECIFIC, Direction.CLIENT_TO_SERVER, false, 4476, 29, 7, 5, payload, {});
|
|
1544
|
-
|
|
1545
|
-
expect(frame.toBuffer()).toStrictEqual(expected);
|
|
1546
|
-
});
|
|
1547
|
-
|
|
1548
1500
|
it("ZclFrame to buffer readRsp failed", () => {
|
|
1549
1501
|
const expected = Buffer.from([8, 1, 1, 1, 0, 2]);
|
|
1550
1502
|
const payload = [{status: 2, attrId: 1}];
|
|
@@ -1945,13 +1897,13 @@ describe("Zcl", () => {
|
|
|
1945
1897
|
});
|
|
1946
1898
|
|
|
1947
1899
|
it("Zcl utils get cluster with manufacturerCode", () => {
|
|
1948
|
-
const cluster = Zcl.Utils.getCluster(
|
|
1949
|
-
expect(cluster.ID).toBe(
|
|
1950
|
-
expect(cluster.name).toBe("
|
|
1900
|
+
const cluster = Zcl.Utils.getCluster(0xfc57, 0x1217, MANU_SPE_CUSTOM_CLUSTERS);
|
|
1901
|
+
expect(cluster.ID).toBe(0xfc57);
|
|
1902
|
+
expect(cluster.name).toBe("manuSpecificAmazonWWAH");
|
|
1951
1903
|
});
|
|
1952
1904
|
|
|
1953
1905
|
it("Zcl utils get cluster manufacturerCode", () => {
|
|
1954
|
-
const cluster = Zcl.Utils.getCluster(0xfc00,
|
|
1906
|
+
const cluster = Zcl.Utils.getCluster(0xfc00, Zcl.ManufacturerCode.UBISYS_TECHNOLOGIES_GMBH, MANU_SPE_CUSTOM_CLUSTERS);
|
|
1955
1907
|
expect(cluster.ID).toBe(0xfc00);
|
|
1956
1908
|
expect(cluster.name).toBe("manuSpecificAssaDoorLock");
|
|
1957
1909
|
});
|
|
@@ -1963,38 +1915,55 @@ describe("Zcl", () => {
|
|
|
1963
1915
|
});
|
|
1964
1916
|
|
|
1965
1917
|
it("Zcl utils get cluster attributes manufacturerCode", () => {
|
|
1966
|
-
const cluster = Zcl.Utils.getCluster("closuresWindowCovering", 0x1021, {
|
|
1967
|
-
|
|
1918
|
+
const cluster = Zcl.Utils.getCluster("closuresWindowCovering", 0x1021, {
|
|
1919
|
+
closuresWindowCovering: {
|
|
1920
|
+
ID: Zcl.Clusters.closuresWindowCovering.ID,
|
|
1921
|
+
name: "closuresWindowCovering",
|
|
1922
|
+
attributes: {
|
|
1923
|
+
stepPositionTilt: {
|
|
1924
|
+
name: "stepPositionTilt",
|
|
1925
|
+
ID: 0xf004,
|
|
1926
|
+
type: DataType.ENUM8,
|
|
1927
|
+
manufacturerCode: Zcl.ManufacturerCode.LEGRAND_GROUP,
|
|
1928
|
+
write: true,
|
|
1929
|
+
max: 0xff,
|
|
1930
|
+
},
|
|
1931
|
+
},
|
|
1932
|
+
commands: {},
|
|
1933
|
+
commandsResponse: {},
|
|
1934
|
+
},
|
|
1935
|
+
});
|
|
1936
|
+
const attribute = Zcl.Utils.getClusterAttribute(cluster, 0xf004, 0x1021);
|
|
1968
1937
|
expect(attribute).toStrictEqual(expect.objectContaining({ID: 0xf004, manufacturerCode: 0x1021, name: "stepPositionTilt", type: 48}));
|
|
1969
1938
|
});
|
|
1970
1939
|
|
|
1971
1940
|
it("Zcl utils get cluster attributes manufacturerCode wrong", () => {
|
|
1972
1941
|
const cluster = Zcl.Utils.getCluster("closuresWindowCovering", 123, {});
|
|
1973
|
-
expect(
|
|
1942
|
+
expect(Zcl.Utils.getClusterAttribute(cluster, 0x1000, 123)).toBeUndefined();
|
|
1974
1943
|
});
|
|
1975
1944
|
|
|
1976
1945
|
it("Zcl utils get command", () => {
|
|
1977
1946
|
const cluster = Zcl.Utils.getCluster("genOnOff", undefined, {});
|
|
1978
|
-
const command =
|
|
1947
|
+
const command = Zcl.Utils.getClusterCommand(cluster, 0);
|
|
1979
1948
|
expect(command.name).toStrictEqual("off");
|
|
1980
|
-
expect(
|
|
1949
|
+
expect(Zcl.Utils.getClusterCommand(cluster, "off")).toStrictEqual(command);
|
|
1981
1950
|
});
|
|
1982
1951
|
|
|
1983
1952
|
it("Zcl utils get attribute", () => {
|
|
1984
1953
|
const cluster = Zcl.Utils.getCluster("genOnOff", undefined, {});
|
|
1985
|
-
const attribute =
|
|
1954
|
+
const attribute = Zcl.Utils.getClusterAttribute(cluster, 16385, undefined);
|
|
1986
1955
|
expect(attribute?.name).toStrictEqual("onTime");
|
|
1987
|
-
expect(
|
|
1956
|
+
expect(Zcl.Utils.getClusterAttribute(cluster, "onTime", undefined)).toStrictEqual(attribute);
|
|
1988
1957
|
});
|
|
1989
1958
|
|
|
1990
1959
|
it("Zcl utils get attribute non-existing", () => {
|
|
1991
1960
|
const cluster = Zcl.Utils.getCluster("genOnOff", undefined, {});
|
|
1992
|
-
expect(
|
|
1961
|
+
expect(Zcl.Utils.getClusterAttribute(cluster, "notExisting", undefined)).toBeUndefined();
|
|
1993
1962
|
});
|
|
1994
1963
|
|
|
1995
1964
|
it("Zcl utils get command non-existing", () => {
|
|
1996
1965
|
const cluster = Zcl.Utils.getCluster("genOnOff", undefined, {});
|
|
1997
|
-
expect(() =>
|
|
1966
|
+
expect(() => Zcl.Utils.getClusterCommand(cluster, "notExisting")).toThrow("Status 'UNSUP_COMMAND' genOnOff:notExisting");
|
|
1998
1967
|
});
|
|
1999
1968
|
|
|
2000
1969
|
it("Zcl green power readGpd commissioning", () => {
|
|
@@ -2159,6 +2128,7 @@ describe("Zcl", () => {
|
|
|
2159
2128
|
).toStrictEqual({
|
|
2160
2129
|
manufacturerCode: 13330,
|
|
2161
2130
|
clusterID: 65535,
|
|
2131
|
+
clusterName: "65535",
|
|
2162
2132
|
attributes: {
|
|
2163
2133
|
"0": 50462976,
|
|
2164
2134
|
"1": "ZIGBEE",
|
|
@@ -2321,7 +2291,12 @@ describe("Zcl", () => {
|
|
|
2321
2291
|
0x11, 0x01, 0xf0, 0x08, 0x84, 0x2b, 0x01, 0x98, 0x2b, 0x02, 0xac, 0x2b, 0x03, 0xc0, 0x2b, 0x04, 0xd4, 0x2b, 0x05, 0xe8, 0x2b, 0x06, 0xfc,
|
|
2322
2292
|
0x2b, 0x07, 0x10, 0x2c, 0x08,
|
|
2323
2293
|
]);
|
|
2324
|
-
const zoneConfigFrame = Zcl.Frame.fromBuffer(
|
|
2294
|
+
const zoneConfigFrame = Zcl.Frame.fromBuffer(
|
|
2295
|
+
Zcl.Clusters.genGroups.ID,
|
|
2296
|
+
Zcl.Header.fromBuffer(zoneConfigPayload)!,
|
|
2297
|
+
zoneConfigPayload,
|
|
2298
|
+
MIBOXER_GROUPS_CUSTOM_CLUSTER,
|
|
2299
|
+
);
|
|
2325
2300
|
expect(zoneConfigFrame.payload.zones).toStrictEqual([
|
|
2326
2301
|
{zoneNum: 1, groupId: 0x2b84},
|
|
2327
2302
|
{zoneNum: 2, groupId: 0x2b98},
|
|
@@ -2353,7 +2328,7 @@ describe("Zcl", () => {
|
|
|
2353
2328
|
"miboxerSetZones",
|
|
2354
2329
|
Zcl.Clusters.genGroups.ID,
|
|
2355
2330
|
{zones: testZones},
|
|
2356
|
-
|
|
2331
|
+
MIBOXER_GROUPS_CUSTOM_CLUSTER,
|
|
2357
2332
|
);
|
|
2358
2333
|
expect(zoneConfigFrame.toBuffer()).toStrictEqual(
|
|
2359
2334
|
Buffer.from([
|
|
@@ -134,11 +134,34 @@ describe("ZCL Buffalo", () => {
|
|
|
134
134
|
{value: 4294967290, types: [Zcl.DataType.DATA32, Zcl.DataType.BITMAP32, Zcl.DataType.UINT32, Zcl.DataType.UTC, Zcl.DataType.BAC_OID]},
|
|
135
135
|
{position: 4, write: "writeUInt32", read: "readUInt32"},
|
|
136
136
|
],
|
|
137
|
+
[
|
|
138
|
+
"uint40-like",
|
|
139
|
+
{value: 1099511627770, types: [Zcl.DataType.DATA40, Zcl.DataType.BITMAP40, Zcl.DataType.UINT40]},
|
|
140
|
+
{position: 5, write: "writeUInt40", read: "readUInt40"},
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
"uint48-like",
|
|
144
|
+
{value: 281474976710650, types: [Zcl.DataType.DATA48, Zcl.DataType.BITMAP48, Zcl.DataType.UINT48]},
|
|
145
|
+
{position: 6, write: "writeUInt48", read: "readUInt48"},
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
"uint56-like",
|
|
149
|
+
{value: 72057594037927935n, types: [Zcl.DataType.DATA56, Zcl.DataType.BITMAP56, Zcl.DataType.UINT56]},
|
|
150
|
+
{position: 7, write: "writeUInt56", read: "readUInt56"},
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
"uint64-like",
|
|
154
|
+
{value: 18446744073709551610n, types: [Zcl.DataType.DATA64, Zcl.DataType.BITMAP64, Zcl.DataType.UINT64]},
|
|
155
|
+
{position: 8, write: "writeUInt64", read: "readUInt64"},
|
|
156
|
+
],
|
|
137
157
|
["int8-like", {value: -120, types: [Zcl.DataType.INT8]}, {position: 1, write: "writeInt8", read: "readInt8"}],
|
|
138
158
|
["int16-like", {value: -32760, types: [Zcl.DataType.INT16]}, {position: 2, write: "writeInt16", read: "readInt16"}],
|
|
139
159
|
["int24-like", {value: -8388600, types: [Zcl.DataType.INT24]}, {position: 3, write: "writeInt24", read: "readInt24"}],
|
|
140
160
|
["int32-like", {value: -2147483640, types: [Zcl.DataType.INT32]}, {position: 4, write: "writeInt32", read: "readInt32"}],
|
|
161
|
+
["int40-like", {value: -549755813887, types: [Zcl.DataType.INT40]}, {position: 5, write: "writeInt40", read: "readInt40"}],
|
|
141
162
|
["int48-like", {value: -140737488355320, types: [Zcl.DataType.INT48]}, {position: 6, write: "writeInt48", read: "readInt48"}],
|
|
163
|
+
["int56-like", {value: -36028797018963960n, types: [Zcl.DataType.INT56]}, {position: 7, write: "writeInt56", read: "readInt56"}],
|
|
164
|
+
["int64-like", {value: -9223372036854775800n, types: [Zcl.DataType.INT64]}, {position: 8, write: "writeInt64", read: "readInt64"}],
|
|
142
165
|
["float-like", {value: 1.539989614439558e-36, types: [Zcl.DataType.SINGLE_PREC]}, {position: 4, write: "writeFloatLE", read: "readFloatLE"}],
|
|
143
166
|
[
|
|
144
167
|
"double-like",
|
|
@@ -1109,19 +1132,48 @@ describe("ZCL Buffalo", () => {
|
|
|
1109
1132
|
|
|
1110
1133
|
it("Reads attribute report", () => {
|
|
1111
1134
|
const value = [
|
|
1112
|
-
0x12,
|
|
1113
|
-
0x34, // Manufacturer ID
|
|
1114
|
-
0xff,
|
|
1115
|
-
0xff, // Cluster ID
|
|
1116
1135
|
0x00,
|
|
1136
|
+
0x00, // Cluster ID
|
|
1137
|
+
0x01,
|
|
1117
1138
|
0x00, // Attribute ID
|
|
1118
|
-
Zcl.DataType.
|
|
1119
|
-
|
|
1139
|
+
Zcl.DataType.UINT8, // Attribute Type
|
|
1140
|
+
0xff,
|
|
1120
1141
|
0x01,
|
|
1142
|
+
0x10,
|
|
1143
|
+
Zcl.DataType.CHAR_STR,
|
|
1144
|
+
0x06,
|
|
1145
|
+
0x5a,
|
|
1146
|
+
0x49,
|
|
1147
|
+
0x47,
|
|
1148
|
+
0x42,
|
|
1149
|
+
0x45,
|
|
1150
|
+
0x45,
|
|
1121
1151
|
0x02,
|
|
1122
|
-
|
|
1152
|
+
0x10,
|
|
1153
|
+
Zcl.DataType.BOOLEAN,
|
|
1123
1154
|
0x01,
|
|
1155
|
+
];
|
|
1156
|
+
const buffalo = new BuffaloZcl(Buffer.from(value));
|
|
1157
|
+
|
|
1158
|
+
expect(buffalo.read(Zcl.BuffaloZclDataType.GPD_FRAME, {payload: {commandID: 0xa0, payloadSize: value.length}})).toStrictEqual({
|
|
1159
|
+
clusterID: 0x0000,
|
|
1160
|
+
clusterName: "genBasic",
|
|
1161
|
+
attributes: {appVersion: 0xff, 4097: "ZIGBEE", 4098: 1},
|
|
1162
|
+
});
|
|
1163
|
+
});
|
|
1164
|
+
|
|
1165
|
+
it("Reads manufacturer-specific attribute report", () => {
|
|
1166
|
+
const value = [
|
|
1167
|
+
0x12,
|
|
1168
|
+
0x34, // Manufacturer ID
|
|
1124
1169
|
0x00,
|
|
1170
|
+
0x00, // Cluster ID
|
|
1171
|
+
0x00,
|
|
1172
|
+
0x00, // Attribute ID
|
|
1173
|
+
Zcl.DataType.UINT8, // Attribute Type
|
|
1174
|
+
0x08,
|
|
1175
|
+
0x01,
|
|
1176
|
+
0x20,
|
|
1125
1177
|
Zcl.DataType.CHAR_STR,
|
|
1126
1178
|
0x06,
|
|
1127
1179
|
0x5a,
|
|
@@ -1131,16 +1183,154 @@ describe("ZCL Buffalo", () => {
|
|
|
1131
1183
|
0x45,
|
|
1132
1184
|
0x45,
|
|
1133
1185
|
0x02,
|
|
1134
|
-
|
|
1186
|
+
0x20,
|
|
1135
1187
|
Zcl.DataType.BOOLEAN,
|
|
1136
1188
|
0x01,
|
|
1137
1189
|
];
|
|
1138
1190
|
const buffalo = new BuffaloZcl(Buffer.from(value));
|
|
1139
1191
|
|
|
1140
1192
|
expect(buffalo.read(Zcl.BuffaloZclDataType.GPD_FRAME, {payload: {commandID: 0xa1, payloadSize: value.length}})).toStrictEqual({
|
|
1141
|
-
manufacturerCode:
|
|
1142
|
-
clusterID:
|
|
1143
|
-
|
|
1193
|
+
manufacturerCode: 0x3412,
|
|
1194
|
+
clusterID: 0x0000,
|
|
1195
|
+
clusterName: "genBasic",
|
|
1196
|
+
attributes: {zclVersion: 8, 8193: "ZIGBEE", 8194: 1},
|
|
1197
|
+
});
|
|
1198
|
+
});
|
|
1199
|
+
|
|
1200
|
+
it("Reads multi-cluster attribute report", () => {
|
|
1201
|
+
const value = [
|
|
1202
|
+
0xff,
|
|
1203
|
+
0xff, // Cluster ID
|
|
1204
|
+
0x00,
|
|
1205
|
+
0x00, // Attribute ID
|
|
1206
|
+
Zcl.DataType.UINT32, // Attribute Type
|
|
1207
|
+
0x00,
|
|
1208
|
+
0x01,
|
|
1209
|
+
0x02,
|
|
1210
|
+
0x03,
|
|
1211
|
+
0x00,
|
|
1212
|
+
0x00, // Cluster ID
|
|
1213
|
+
0x01,
|
|
1214
|
+
0x00, // Attribute ID
|
|
1215
|
+
Zcl.DataType.UINT8, // Attribute Type
|
|
1216
|
+
0x10,
|
|
1217
|
+
];
|
|
1218
|
+
const buffalo = new BuffaloZcl(Buffer.from(value));
|
|
1219
|
+
|
|
1220
|
+
expect(buffalo.read(Zcl.BuffaloZclDataType.GPD_FRAME, {payload: {commandID: 0xa2, payloadSize: value.length}})).toStrictEqual({
|
|
1221
|
+
reports: [
|
|
1222
|
+
{
|
|
1223
|
+
clusterID: 0xffff,
|
|
1224
|
+
clusterName: "65535",
|
|
1225
|
+
attribute: 0,
|
|
1226
|
+
attrData: 50462976,
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
clusterID: 0x0000,
|
|
1230
|
+
clusterName: "genBasic",
|
|
1231
|
+
attribute: "appVersion",
|
|
1232
|
+
attrData: 0x10,
|
|
1233
|
+
},
|
|
1234
|
+
],
|
|
1235
|
+
});
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1238
|
+
it("Reads manufacturer-specific multi-cluster attribute report", () => {
|
|
1239
|
+
const value = [
|
|
1240
|
+
0xef,
|
|
1241
|
+
0xf3, // Manufacturer code
|
|
1242
|
+
0x00,
|
|
1243
|
+
0x00, // Cluster ID
|
|
1244
|
+
0x00,
|
|
1245
|
+
0x00, // Attribute ID
|
|
1246
|
+
Zcl.DataType.UINT8, // Attribute Type
|
|
1247
|
+
0x08,
|
|
1248
|
+
0xff,
|
|
1249
|
+
0xfe, // Cluster ID
|
|
1250
|
+
0x00,
|
|
1251
|
+
0x01, // Attribute ID
|
|
1252
|
+
Zcl.DataType.UINT16, // Attribute Type
|
|
1253
|
+
0x10,
|
|
1254
|
+
0x11,
|
|
1255
|
+
];
|
|
1256
|
+
const buffalo = new BuffaloZcl(Buffer.from(value));
|
|
1257
|
+
|
|
1258
|
+
expect(buffalo.read(Zcl.BuffaloZclDataType.GPD_FRAME, {payload: {commandID: 0xa3, payloadSize: value.length}})).toStrictEqual({
|
|
1259
|
+
manufacturerCode: 0xf3ef,
|
|
1260
|
+
reports: [
|
|
1261
|
+
{
|
|
1262
|
+
clusterID: 0x0000,
|
|
1263
|
+
clusterName: "genBasic",
|
|
1264
|
+
attribute: "zclVersion",
|
|
1265
|
+
attrData: 8,
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
clusterID: 0xfeff,
|
|
1269
|
+
clusterName: "65279",
|
|
1270
|
+
attribute: 0x0100,
|
|
1271
|
+
attrData: 4368,
|
|
1272
|
+
},
|
|
1273
|
+
],
|
|
1274
|
+
});
|
|
1275
|
+
});
|
|
1276
|
+
|
|
1277
|
+
it("Reads attribute request", () => {
|
|
1278
|
+
const value = [
|
|
1279
|
+
0x02, // Options
|
|
1280
|
+
0xfe,
|
|
1281
|
+
0xef, // Manufacturer code
|
|
1282
|
+
0xff,
|
|
1283
|
+
0xff, // Cluster ID
|
|
1284
|
+
0x02, // Length
|
|
1285
|
+
0x00,
|
|
1286
|
+
0x00, // Attribute ID
|
|
1287
|
+
0x00,
|
|
1288
|
+
0x01, // Attribute ID
|
|
1289
|
+
];
|
|
1290
|
+
const buffalo = new BuffaloZcl(Buffer.from(value));
|
|
1291
|
+
|
|
1292
|
+
expect(buffalo.read(Zcl.BuffaloZclDataType.GPD_FRAME, {payload: {commandID: 0xa4, payloadSize: value.length}})).toStrictEqual({
|
|
1293
|
+
options: 0x02,
|
|
1294
|
+
manufacturerID: 0xeffe,
|
|
1295
|
+
records: [{clusterID: 0xffff, attributes: [0x0000, 0x0100]}],
|
|
1296
|
+
});
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
it("Reads attribute response", () => {
|
|
1300
|
+
const value = [
|
|
1301
|
+
0x02, // Options
|
|
1302
|
+
0xfe,
|
|
1303
|
+
0xef, // Manufacturer code
|
|
1304
|
+
0x00,
|
|
1305
|
+
0x00, // Cluster ID
|
|
1306
|
+
0x02, // Length
|
|
1307
|
+
0x00,
|
|
1308
|
+
0x00, // Attribute ID
|
|
1309
|
+
0x00, // Status
|
|
1310
|
+
Zcl.DataType.UINT8, // Data type
|
|
1311
|
+
0x08, // Attr data
|
|
1312
|
+
0xfc,
|
|
1313
|
+
0xff, // Attribute ID
|
|
1314
|
+
0x00, // Status
|
|
1315
|
+
Zcl.DataType.UINT16, // Data type
|
|
1316
|
+
0x00,
|
|
1317
|
+
0x10, // Attr data
|
|
1318
|
+
];
|
|
1319
|
+
const buffalo = new BuffaloZcl(Buffer.from(value));
|
|
1320
|
+
|
|
1321
|
+
expect(buffalo.read(Zcl.BuffaloZclDataType.GPD_FRAME, {payload: {commandID: 0xa5, payloadSize: value.length}})).toStrictEqual({
|
|
1322
|
+
options: 0x02,
|
|
1323
|
+
manufacturerID: 0xeffe,
|
|
1324
|
+
records: [
|
|
1325
|
+
{
|
|
1326
|
+
clusterID: 0x0000,
|
|
1327
|
+
clusterName: "genBasic",
|
|
1328
|
+
attributes: {
|
|
1329
|
+
zclVersion: {status: Zcl.Status.SUCCESS, attrData: 0x08},
|
|
1330
|
+
65532: {status: Zcl.Status.SUCCESS, attrData: 0x1000},
|
|
1331
|
+
},
|
|
1332
|
+
},
|
|
1333
|
+
],
|
|
1144
1334
|
});
|
|
1145
1335
|
});
|
|
1146
1336
|
|
|
@@ -1298,6 +1488,56 @@ describe("ZCL Buffalo", () => {
|
|
|
1298
1488
|
expect(buffalo.getPosition()).toStrictEqual(expectedWritten.length);
|
|
1299
1489
|
});
|
|
1300
1490
|
|
|
1491
|
+
it("Reads Mi Struct", () => {
|
|
1492
|
+
const buffer = Buffer.from([
|
|
1493
|
+
34, 1, 33, 213, 12, 3, 40, 33, 4, 33, 168, 19, 5, 33, 43, 0, 6, 36, 0, 0, 5, 0, 0, 8, 33, 4, 2, 10, 33, 0, 0, 100, 16, 0,
|
|
1494
|
+
]);
|
|
1495
|
+
const buffalo = new BuffaloZcl(buffer);
|
|
1496
|
+
|
|
1497
|
+
expect(buffalo.read(Zcl.BuffaloZclDataType.MI_STRUCT, {})).toStrictEqual({
|
|
1498
|
+
"1": 3285,
|
|
1499
|
+
"3": 33,
|
|
1500
|
+
"4": 5032,
|
|
1501
|
+
"5": 43,
|
|
1502
|
+
"6": 327680,
|
|
1503
|
+
"8": 516,
|
|
1504
|
+
"10": 0,
|
|
1505
|
+
"100": 0,
|
|
1506
|
+
});
|
|
1507
|
+
expect(buffalo.getPosition()).toStrictEqual(buffer.byteLength);
|
|
1508
|
+
});
|
|
1509
|
+
|
|
1510
|
+
it("Reads Mi Struct with padding", () => {
|
|
1511
|
+
const buffer = Buffer.from([
|
|
1512
|
+
68, 3, 40, 29, 5, 33, 190, 45, 8, 33, 47, 18, 9, 33, 2, 21, 100, 16, 1, 101, 16, 0, 110, 32, 255, 111, 32, 255, 148, 32, 4, 149, 57, 184,
|
|
1513
|
+
30, 21, 62, 150, 57, 211, 249, 17, 69, 151, 57, 0, 48, 104, 59, 152, 57, 0, 0, 0, 0, 155, 33, 1, 0, 156, 32, 1, 10, 33, 56, 38, 12, 40, 0,
|
|
1514
|
+
0,
|
|
1515
|
+
]);
|
|
1516
|
+
|
|
1517
|
+
const buffalo = new BuffaloZcl(buffer);
|
|
1518
|
+
|
|
1519
|
+
expect(buffalo.read(Zcl.BuffaloZclDataType.MI_STRUCT, {})).toStrictEqual({
|
|
1520
|
+
"3": 29,
|
|
1521
|
+
"5": 11710,
|
|
1522
|
+
"8": 4655,
|
|
1523
|
+
"9": 5378,
|
|
1524
|
+
"10": 9784,
|
|
1525
|
+
"12": 0,
|
|
1526
|
+
"100": 1,
|
|
1527
|
+
"101": 0,
|
|
1528
|
+
"110": 255,
|
|
1529
|
+
"111": 255,
|
|
1530
|
+
"148": 4,
|
|
1531
|
+
"149": 0.14562499523162842,
|
|
1532
|
+
"150": 2335.614013671875,
|
|
1533
|
+
"151": 0.0035429000854492188,
|
|
1534
|
+
"152": 0,
|
|
1535
|
+
"155": 1,
|
|
1536
|
+
"156": 1,
|
|
1537
|
+
});
|
|
1538
|
+
expect(buffalo.getPosition()).toStrictEqual(buffer.byteLength);
|
|
1539
|
+
});
|
|
1540
|
+
|
|
1301
1541
|
it("Writes & Reads big endian uint24", () => {
|
|
1302
1542
|
const value = 16777200;
|
|
1303
1543
|
const expectedWritten = [0xff, 0xff, 0xf0];
|