@zwave-js/cc 15.23.0 → 15.23.3
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/build/cjs/cc/DoorLockCC.d.ts +7 -3
- package/build/cjs/cc/DoorLockCC.js +164 -15
- package/build/cjs/cc/DoorLockCC.js.map +2 -2
- package/build/cjs/cc/LockCC.d.ts +2 -1
- package/build/cjs/cc/LockCC.js +11 -2
- package/build/cjs/cc/LockCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.js +4 -0
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/UserCredentialCC._validateArgs.js +4 -4
- package/build/cjs/cc/UserCredentialCC._validateArgs.js.map +2 -2
- package/build/cjs/cc/UserCredentialCC.d.ts +75 -37
- package/build/cjs/cc/UserCredentialCC.js +203 -156
- package/build/cjs/cc/UserCredentialCC.js.map +3 -3
- package/build/cjs/cc/_CCValues.generated.d.ts +62 -6
- package/build/cjs/cc/_CCValues.generated.js +38 -6
- package/build/cjs/cc/_CCValues.generated.js.map +2 -2
- package/build/cjs/cc/index.d.ts +3 -3
- package/build/cjs/cc/index.js +6 -6
- package/build/cjs/cc/index.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts +7 -3
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +192 -27
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts +2 -1
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +12 -7
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +6 -1
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/UserCredentialCC._validateArgs.js +4 -4
- package/build/esm/cc/UserCredentialCC._validateArgs.js.map +1 -1
- package/build/esm/cc/UserCredentialCC.d.ts +75 -37
- package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
- package/build/esm/cc/UserCredentialCC.js +237 -152
- package/build/esm/cc/UserCredentialCC.js.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts +62 -6
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.js +41 -6
- package/build/esm/cc/_CCValues.generated.js.map +1 -1
- package/build/esm/cc/index.d.ts +3 -3
- package/build/esm/cc/index.d.ts.map +1 -1
- package/build/esm/cc/index.js +4 -4
- package/build/esm/cc/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Duration, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, type WithAddress } from "@zwave-js/core";
|
|
2
2
|
import { Bytes } from "@zwave-js/shared";
|
|
3
|
-
import { POLL_VALUE, PhysicalCCAPI, type PollValueImplementation, SET_VALUE, type SetValueImplementation } from "../lib/API.js";
|
|
3
|
+
import { POLL_VALUE, PhysicalCCAPI, type PollValueImplementation, SET_VALUE, SET_VALUE_HOOKS, type SetValueImplementation, type SetValueImplementationHooksFactory } from "../lib/API.js";
|
|
4
4
|
import { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions } from "../lib/CommandClass.js";
|
|
5
5
|
import { type DoorHandleStatus, DoorLockCommand, DoorLockMode, DoorLockOperationType } from "../lib/_Types.js";
|
|
6
6
|
import type { CCEncodingContext, CCParsingContext } from "../lib/traits.js";
|
|
@@ -16,6 +16,7 @@ export declare function shouldAutoCreateHoldAndReleaseConfigValue(ctx: GetValueD
|
|
|
16
16
|
export declare class DoorLockCCAPI extends PhysicalCCAPI {
|
|
17
17
|
supportsCommand(cmd: DoorLockCommand): MaybeNotKnown<boolean>;
|
|
18
18
|
protected get [SET_VALUE](): SetValueImplementation;
|
|
19
|
+
protected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory;
|
|
19
20
|
protected get [POLL_VALUE](): PollValueImplementation;
|
|
20
21
|
getCapabilities(): Promise<Pick<DoorLockCCCapabilitiesReport, "autoRelockSupported" | "blockToBlockSupported" | "boltSupported" | "doorSupported" | "holdAndReleaseSupported" | "latchSupported" | "supportedDoorLockModes" | "supportedInsideHandles" | "supportedOperationTypes" | "supportedOutsideHandles" | "twistAssistSupported"> | undefined>;
|
|
21
22
|
get(): Promise<Pick<DoorLockCCOperationReport, "boltStatus" | "currentMode" | "doorStatus" | "duration" | "insideHandlesCanOpenDoor" | "latchStatus" | "lockTimeout" | "outsideHandlesCanOpenDoor" | "targetMode"> | undefined>;
|
|
@@ -63,7 +64,7 @@ export interface DoorLockCCOperationSetOptions {
|
|
|
63
64
|
}
|
|
64
65
|
export declare class DoorLockCCOperationSet extends DoorLockCC {
|
|
65
66
|
constructor(options: WithAddress<DoorLockCCOperationSetOptions>);
|
|
66
|
-
static from(
|
|
67
|
+
static from(raw: CCRaw, ctx: CCParsingContext): DoorLockCCOperationSet;
|
|
67
68
|
mode: DoorLockMode;
|
|
68
69
|
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
69
70
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
@@ -82,6 +83,7 @@ export interface DoorLockCCOperationReportOptions {
|
|
|
82
83
|
export declare class DoorLockCCOperationReport extends DoorLockCC {
|
|
83
84
|
constructor(options: WithAddress<DoorLockCCOperationReportOptions>);
|
|
84
85
|
static from(raw: CCRaw, ctx: CCParsingContext): DoorLockCCOperationReport;
|
|
86
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
85
87
|
persistValues(ctx: PersistValuesContext): boolean;
|
|
86
88
|
readonly currentMode: DoorLockMode;
|
|
87
89
|
readonly targetMode?: DoorLockMode;
|
|
@@ -109,6 +111,7 @@ export interface DoorLockCCConfigurationReportOptions {
|
|
|
109
111
|
export declare class DoorLockCCConfigurationReport extends DoorLockCC {
|
|
110
112
|
constructor(options: WithAddress<DoorLockCCConfigurationReportOptions>);
|
|
111
113
|
static from(raw: CCRaw, ctx: CCParsingContext): DoorLockCCConfigurationReport;
|
|
114
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
112
115
|
readonly operationType: DoorLockOperationType;
|
|
113
116
|
readonly outsideHandlesCanOpenDoorConfiguration: DoorHandleStatus;
|
|
114
117
|
readonly insideHandlesCanOpenDoorConfiguration: DoorHandleStatus;
|
|
@@ -138,7 +141,7 @@ export type DoorLockCCConfigurationSetOptions = ({
|
|
|
138
141
|
};
|
|
139
142
|
export declare class DoorLockCCConfigurationSet extends DoorLockCC {
|
|
140
143
|
constructor(options: WithAddress<DoorLockCCConfigurationSetOptions>);
|
|
141
|
-
static from(
|
|
144
|
+
static from(raw: CCRaw, ctx: CCParsingContext): DoorLockCCConfigurationSet;
|
|
142
145
|
operationType: DoorLockOperationType;
|
|
143
146
|
outsideHandlesCanOpenDoorConfiguration: DoorHandleStatus;
|
|
144
147
|
insideHandlesCanOpenDoorConfiguration: DoorHandleStatus;
|
|
@@ -177,6 +180,7 @@ export declare class DoorLockCCCapabilitiesReport extends DoorLockCC {
|
|
|
177
180
|
readonly holdAndReleaseSupported: boolean;
|
|
178
181
|
readonly twistAssistSupported: boolean;
|
|
179
182
|
readonly blockToBlockSupported: boolean;
|
|
183
|
+
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
180
184
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
181
185
|
}
|
|
182
186
|
export declare class DoorLockCCCapabilitiesGet extends DoorLockCC {
|
|
@@ -165,13 +165,7 @@ let DoorLockCCAPI = (() => {
|
|
|
165
165
|
if (typeof value !== "number") {
|
|
166
166
|
(0, import_API.throwWrongValueType)(this.ccId, property, "number", typeof value);
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
if ((0, import_core.supervisedCommandSucceeded)(result)) {
|
|
170
|
-
this.getValueDB().setValue(import_CCValues_generated.DoorLockCCValues.currentMode.endpoint(this.endpoint.index), value);
|
|
171
|
-
} else {
|
|
172
|
-
this.schedulePoll({ property }, value);
|
|
173
|
-
}
|
|
174
|
-
return result;
|
|
168
|
+
return this.set(value);
|
|
175
169
|
} else if (typeof property === "string" && configurationSetParameters.includes(property)) {
|
|
176
170
|
const config = {
|
|
177
171
|
[property]: value
|
|
@@ -202,6 +196,44 @@ let DoorLockCCAPI = (() => {
|
|
|
202
196
|
}
|
|
203
197
|
};
|
|
204
198
|
}
|
|
199
|
+
[import_API.SET_VALUE_HOOKS] = ((0, import_tslib.__runInitializers)(this, _instanceExtraInitializers), ({ property }, value) => {
|
|
200
|
+
if (property === "targetMode" && typeof value === "number") {
|
|
201
|
+
const targetMode = value;
|
|
202
|
+
const currentModeValueId = import_CCValues_generated.DoorLockCCValues.currentMode.endpoint(this.endpoint.index);
|
|
203
|
+
return {
|
|
204
|
+
isSplitStateTargetValue: true,
|
|
205
|
+
supervisionDelayedUpdates: true,
|
|
206
|
+
optimisticallyUpdateRelatedValues: /* @__PURE__ */ __name((_supervisedAndSuccessful) => {
|
|
207
|
+
this.tryGetValueDB()?.setValue(currentModeValueId, targetMode);
|
|
208
|
+
}, "optimisticallyUpdateRelatedValues"),
|
|
209
|
+
supervisionOnSuccess: /* @__PURE__ */ __name(() => {
|
|
210
|
+
this.tryGetValueDB()?.setValue(currentModeValueId, targetMode);
|
|
211
|
+
}, "supervisionOnSuccess"),
|
|
212
|
+
supervisionOnFailure: /* @__PURE__ */ __name(async () => {
|
|
213
|
+
try {
|
|
214
|
+
await this.get();
|
|
215
|
+
} catch {
|
|
216
|
+
}
|
|
217
|
+
}, "supervisionOnFailure"),
|
|
218
|
+
verifyChanges: /* @__PURE__ */ __name(async (result) => {
|
|
219
|
+
switch (result?.status) {
|
|
220
|
+
case import_core.SupervisionStatus.Success:
|
|
221
|
+
case import_core.SupervisionStatus.Working:
|
|
222
|
+
return;
|
|
223
|
+
case import_core.SupervisionStatus.Fail:
|
|
224
|
+
case import_core.SupervisionStatus.NoSupport:
|
|
225
|
+
try {
|
|
226
|
+
await this.get();
|
|
227
|
+
} catch {
|
|
228
|
+
}
|
|
229
|
+
return;
|
|
230
|
+
default:
|
|
231
|
+
this.schedulePoll({ property: "currentMode" }, targetMode);
|
|
232
|
+
}
|
|
233
|
+
}, "verifyChanges")
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
});
|
|
205
237
|
get [import_API.POLL_VALUE]() {
|
|
206
238
|
return async function({ property }) {
|
|
207
239
|
switch (property) {
|
|
@@ -314,10 +346,6 @@ let DoorLockCCAPI = (() => {
|
|
|
314
346
|
]);
|
|
315
347
|
}
|
|
316
348
|
}
|
|
317
|
-
constructor() {
|
|
318
|
-
super(...arguments);
|
|
319
|
-
(0, import_tslib.__runInitializers)(this, _instanceExtraInitializers);
|
|
320
|
-
}
|
|
321
349
|
};
|
|
322
350
|
return DoorLockCCAPI2 = _classThis;
|
|
323
351
|
})();
|
|
@@ -562,8 +590,13 @@ let DoorLockCCOperationSet = (() => {
|
|
|
562
590
|
}
|
|
563
591
|
this.mode = options.mode;
|
|
564
592
|
}
|
|
565
|
-
static from(
|
|
566
|
-
|
|
593
|
+
static from(raw, ctx) {
|
|
594
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
595
|
+
const mode = raw.payload[0];
|
|
596
|
+
return new this({
|
|
597
|
+
nodeId: ctx.sourceNodeId,
|
|
598
|
+
mode
|
|
599
|
+
});
|
|
567
600
|
}
|
|
568
601
|
mode;
|
|
569
602
|
serialize(ctx) {
|
|
@@ -656,6 +689,32 @@ let DoorLockCCOperationReport = (() => {
|
|
|
656
689
|
duration
|
|
657
690
|
});
|
|
658
691
|
}
|
|
692
|
+
serialize(ctx) {
|
|
693
|
+
const handles = [
|
|
694
|
+
...this.insideHandlesCanOpenDoor,
|
|
695
|
+
...this.outsideHandlesCanOpenDoor
|
|
696
|
+
].map((val, i) => val ? 1 << i : 0).reduce((acc, cur) => acc | cur, 0);
|
|
697
|
+
const doorCondition = (this.doorStatus === "closed" ? 1 : 0) | (this.boltStatus === "unlocked" ? 2 : 0) | (this.latchStatus === "closed" ? 4 : 0);
|
|
698
|
+
let lockTimeoutMinutes = 254;
|
|
699
|
+
let lockTimeoutSeconds = 254;
|
|
700
|
+
if (this.lockTimeout != void 0) {
|
|
701
|
+
lockTimeoutMinutes = Math.floor(this.lockTimeout / 60);
|
|
702
|
+
lockTimeoutSeconds = this.lockTimeout % 60;
|
|
703
|
+
}
|
|
704
|
+
const payload = [
|
|
705
|
+
this.currentMode,
|
|
706
|
+
handles,
|
|
707
|
+
doorCondition,
|
|
708
|
+
lockTimeoutMinutes,
|
|
709
|
+
lockTimeoutSeconds
|
|
710
|
+
];
|
|
711
|
+
if (this.targetMode != void 0) {
|
|
712
|
+
payload.push(this.targetMode);
|
|
713
|
+
payload.push((this.duration ?? import_core.Duration.default()).serializeReport());
|
|
714
|
+
}
|
|
715
|
+
this.payload = import_shared.Bytes.from(payload);
|
|
716
|
+
return super.serialize(ctx);
|
|
717
|
+
}
|
|
659
718
|
persistValues(ctx) {
|
|
660
719
|
if (!super.persistValues(ctx))
|
|
661
720
|
return false;
|
|
@@ -815,6 +874,35 @@ let DoorLockCCConfigurationReport = (() => {
|
|
|
815
874
|
blockToBlock
|
|
816
875
|
});
|
|
817
876
|
}
|
|
877
|
+
serialize(ctx) {
|
|
878
|
+
const handles = [
|
|
879
|
+
...this.insideHandlesCanOpenDoorConfiguration,
|
|
880
|
+
...this.outsideHandlesCanOpenDoorConfiguration
|
|
881
|
+
].map((val, i) => val ? 1 << i : 0).reduce((acc, cur) => acc | cur, 0);
|
|
882
|
+
let lockTimeoutMinutes;
|
|
883
|
+
let lockTimeoutSeconds;
|
|
884
|
+
if (this.operationType === import_Types.DoorLockOperationType.Timed && this.lockTimeoutConfiguration != void 0) {
|
|
885
|
+
lockTimeoutMinutes = Math.floor(this.lockTimeoutConfiguration / 60);
|
|
886
|
+
lockTimeoutSeconds = this.lockTimeoutConfiguration % 60;
|
|
887
|
+
} else {
|
|
888
|
+
lockTimeoutMinutes = lockTimeoutSeconds = 254;
|
|
889
|
+
}
|
|
890
|
+
const flags = (this.twistAssist ? 1 : 0) | (this.blockToBlock ? 2 : 0);
|
|
891
|
+
this.payload = import_shared.Bytes.from([
|
|
892
|
+
this.operationType,
|
|
893
|
+
handles,
|
|
894
|
+
lockTimeoutMinutes,
|
|
895
|
+
lockTimeoutSeconds
|
|
896
|
+
]);
|
|
897
|
+
if (this.autoRelockTime != void 0 || this.holdAndReleaseTime != void 0 || this.twistAssist != void 0 || this.blockToBlock != void 0) {
|
|
898
|
+
const extended = import_shared.Bytes.alloc(5);
|
|
899
|
+
extended.writeUInt16BE((this.autoRelockTime ?? 0) & 65535, 0);
|
|
900
|
+
extended.writeUInt16BE((this.holdAndReleaseTime ?? 0) & 65535, 2);
|
|
901
|
+
extended[4] = flags;
|
|
902
|
+
this.payload = import_shared.Bytes.concat([this.payload, extended]);
|
|
903
|
+
}
|
|
904
|
+
return super.serialize(ctx);
|
|
905
|
+
}
|
|
818
906
|
operationType;
|
|
819
907
|
outsideHandlesCanOpenDoorConfiguration;
|
|
820
908
|
insideHandlesCanOpenDoorConfiguration;
|
|
@@ -929,8 +1017,51 @@ let DoorLockCCConfigurationSet = (() => {
|
|
|
929
1017
|
this.twistAssist = options.twistAssist;
|
|
930
1018
|
this.blockToBlock = options.blockToBlock;
|
|
931
1019
|
}
|
|
932
|
-
static from(
|
|
933
|
-
|
|
1020
|
+
static from(raw, ctx) {
|
|
1021
|
+
(0, import_core.validatePayload)(raw.payload.length >= 4);
|
|
1022
|
+
const operationType = raw.payload[0];
|
|
1023
|
+
const outsideHandlesCanOpenDoorConfiguration = [
|
|
1024
|
+
!!(raw.payload[1] & 16),
|
|
1025
|
+
!!(raw.payload[1] & 32),
|
|
1026
|
+
!!(raw.payload[1] & 64),
|
|
1027
|
+
!!(raw.payload[1] & 128)
|
|
1028
|
+
];
|
|
1029
|
+
const insideHandlesCanOpenDoorConfiguration = [
|
|
1030
|
+
!!(raw.payload[1] & 1),
|
|
1031
|
+
!!(raw.payload[1] & 2),
|
|
1032
|
+
!!(raw.payload[1] & 4),
|
|
1033
|
+
!!(raw.payload[1] & 8)
|
|
1034
|
+
];
|
|
1035
|
+
let lockTimeoutConfiguration;
|
|
1036
|
+
if (operationType === import_Types.DoorLockOperationType.Timed) {
|
|
1037
|
+
const lockTimeoutMinutes = raw.payload[2];
|
|
1038
|
+
const lockTimeoutSeconds = raw.payload[3];
|
|
1039
|
+
if (lockTimeoutMinutes <= 253 && lockTimeoutSeconds <= 59) {
|
|
1040
|
+
lockTimeoutConfiguration = lockTimeoutSeconds + lockTimeoutMinutes * 60;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
let autoRelockTime;
|
|
1044
|
+
let holdAndReleaseTime;
|
|
1045
|
+
let twistAssist;
|
|
1046
|
+
let blockToBlock;
|
|
1047
|
+
if (raw.payload.length >= 9) {
|
|
1048
|
+
autoRelockTime = raw.payload.readUInt16BE(4);
|
|
1049
|
+
holdAndReleaseTime = raw.payload.readUInt16BE(6);
|
|
1050
|
+
const flags = raw.payload[8];
|
|
1051
|
+
twistAssist = !!(flags & 1);
|
|
1052
|
+
blockToBlock = !!(flags & 2);
|
|
1053
|
+
}
|
|
1054
|
+
return new this({
|
|
1055
|
+
nodeId: ctx.sourceNodeId,
|
|
1056
|
+
operationType,
|
|
1057
|
+
outsideHandlesCanOpenDoorConfiguration,
|
|
1058
|
+
insideHandlesCanOpenDoorConfiguration,
|
|
1059
|
+
lockTimeoutConfiguration,
|
|
1060
|
+
autoRelockTime,
|
|
1061
|
+
holdAndReleaseTime,
|
|
1062
|
+
twistAssist,
|
|
1063
|
+
blockToBlock
|
|
1064
|
+
});
|
|
934
1065
|
}
|
|
935
1066
|
operationType;
|
|
936
1067
|
outsideHandlesCanOpenDoorConfiguration;
|
|
@@ -1100,6 +1231,24 @@ let DoorLockCCCapabilitiesReport = (() => {
|
|
|
1100
1231
|
holdAndReleaseSupported;
|
|
1101
1232
|
twistAssistSupported;
|
|
1102
1233
|
blockToBlockSupported;
|
|
1234
|
+
serialize(ctx) {
|
|
1235
|
+
const operationTypeMask = (0, import_core.encodeBitMask)(this.supportedOperationTypes, void 0, 0);
|
|
1236
|
+
const modeList = import_shared.Bytes.from(this.supportedDoorLockModes);
|
|
1237
|
+
const handles = [
|
|
1238
|
+
...this.supportedInsideHandles,
|
|
1239
|
+
...this.supportedOutsideHandles
|
|
1240
|
+
].map((val, i) => val ? 1 << i : 0).reduce((acc, cur) => acc | cur, 0);
|
|
1241
|
+
const componentStatus = (this.doorSupported ? 1 : 0) | (this.boltSupported ? 2 : 0) | (this.latchSupported ? 4 : 0);
|
|
1242
|
+
const featureFlags = (this.blockToBlockSupported ? 1 : 0) | (this.twistAssistSupported ? 2 : 0) | (this.holdAndReleaseSupported ? 4 : 0) | (this.autoRelockSupported ? 8 : 0);
|
|
1243
|
+
this.payload = import_shared.Bytes.concat([
|
|
1244
|
+
[operationTypeMask.length & 31],
|
|
1245
|
+
operationTypeMask,
|
|
1246
|
+
[modeList.length],
|
|
1247
|
+
modeList,
|
|
1248
|
+
[handles, componentStatus, featureFlags]
|
|
1249
|
+
]);
|
|
1250
|
+
return super.serialize(ctx);
|
|
1251
|
+
}
|
|
1103
1252
|
toLogEntry(ctx) {
|
|
1104
1253
|
return {
|
|
1105
1254
|
...super.toLogEntry(ctx),
|