@zwave-js/cc 15.23.5 → 15.24.2

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.
@@ -1,6 +1,6 @@
1
- import { type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, Timeout, type WithAddress } from "@zwave-js/core";
1
+ import { type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, Timeout, type ValueID, type WithAddress } from "@zwave-js/core";
2
2
  import { Bytes } from "@zwave-js/shared";
3
- import { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation } from "../lib/API.js";
3
+ import { CCAPI, POLL_VALUE, 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 { LocalProtectionState, ProtectionCommand, RFProtectionState } from "../lib/_Types.js";
6
6
  import type { CCEncodingContext, CCParsingContext } from "../lib/traits.js";
@@ -10,6 +10,8 @@ export declare class ProtectionCCAPI extends CCAPI {
10
10
  supportsCommand(cmd: ProtectionCommand): MaybeNotKnown<boolean>;
11
11
  protected get [SET_VALUE](): SetValueImplementation;
12
12
  protected get [POLL_VALUE](): PollValueImplementation;
13
+ protected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory;
14
+ isSetValueOptimistic(_valueId: ValueID): boolean;
13
15
  get(): Promise<Pick<ProtectionCCReport, "local" | "rf"> | undefined>;
14
16
  set(local: LocalProtectionState, rf?: RFProtectionState): Promise<SupervisionResult | undefined>;
15
17
  getSupported(): Promise<Pick<ProtectionCCSupportedReport, "supportedLocalStates" | "supportedRFStates" | "supportsExclusiveControl" | "supportsTimeout"> | undefined>;
@@ -29,7 +31,7 @@ export interface ProtectionCCSetOptions {
29
31
  }
30
32
  export declare class ProtectionCCSet extends ProtectionCC {
31
33
  constructor(options: WithAddress<ProtectionCCSetOptions>);
32
- static from(_raw: CCRaw, _ctx: CCParsingContext): ProtectionCCSet;
34
+ static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCSet;
33
35
  local: LocalProtectionState;
34
36
  rf?: RFProtectionState;
35
37
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
@@ -44,6 +46,7 @@ export declare class ProtectionCCReport extends ProtectionCC {
44
46
  static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCReport;
45
47
  readonly local: LocalProtectionState;
46
48
  readonly rf?: RFProtectionState;
49
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
47
50
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
48
51
  }
49
52
  export declare class ProtectionCCGet extends ProtectionCC {
@@ -62,6 +65,7 @@ export declare class ProtectionCCSupportedReport extends ProtectionCC {
62
65
  readonly supportsTimeout: boolean;
63
66
  readonly supportedLocalStates: LocalProtectionState[];
64
67
  readonly supportedRFStates: RFProtectionState[];
68
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
65
69
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
66
70
  }
67
71
  export declare class ProtectionCCSupportedGet extends ProtectionCC {
@@ -73,6 +77,7 @@ export declare class ProtectionCCExclusiveControlReport extends ProtectionCC {
73
77
  constructor(options: WithAddress<ProtectionCCExclusiveControlReportOptions>);
74
78
  static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCExclusiveControlReport;
75
79
  readonly exclusiveControlNodeId: number;
80
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
76
81
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
77
82
  }
78
83
  export declare class ProtectionCCExclusiveControlGet extends ProtectionCC {
@@ -82,7 +87,7 @@ export interface ProtectionCCExclusiveControlSetOptions {
82
87
  }
83
88
  export declare class ProtectionCCExclusiveControlSet extends ProtectionCC {
84
89
  constructor(options: WithAddress<ProtectionCCExclusiveControlSetOptions>);
85
- static from(_raw: CCRaw, _ctx: CCParsingContext): ProtectionCCExclusiveControlSet;
90
+ static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCExclusiveControlSet;
86
91
  exclusiveControlNodeId: number;
87
92
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
88
93
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
@@ -94,6 +99,7 @@ export declare class ProtectionCCTimeoutReport extends ProtectionCC {
94
99
  constructor(options: WithAddress<ProtectionCCTimeoutReportOptions>);
95
100
  static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCTimeoutReport;
96
101
  readonly timeout: Timeout;
102
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
97
103
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
98
104
  }
99
105
  export declare class ProtectionCCTimeoutGet extends ProtectionCC {
@@ -103,7 +109,7 @@ export interface ProtectionCCTimeoutSetOptions {
103
109
  }
104
110
  export declare class ProtectionCCTimeoutSet extends ProtectionCC {
105
111
  constructor(options: WithAddress<ProtectionCCTimeoutSetOptions>);
106
- static from(_raw: CCRaw, _ctx: CCParsingContext): ProtectionCCTimeoutSet;
112
+ static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCTimeoutSet;
107
113
  timeout: Timeout;
108
114
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
109
115
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
@@ -53,7 +53,6 @@ var import_API = require("../lib/API.js");
53
53
  var import_CommandClass = require("../lib/CommandClass.js");
54
54
  var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
55
55
  var import_Types = require("../lib/_Types.js");
56
- var import_ApplicationStatusCC = require("./ApplicationStatusCC.js");
57
56
  var import_CCValues_generated = require("./_CCValues.generated.js");
58
57
  const { validateArgs_ProtectionCCAPI_set, validateArgs_ProtectionCCAPI_setExclusiveControl, validateArgs_ProtectionCCAPI_setTimeout } = __validateArgs;
59
58
  let ProtectionCCAPI = (() => {
@@ -144,6 +143,23 @@ let ProtectionCCAPI = (() => {
144
143
  }
145
144
  };
146
145
  }
146
+ [import_API.SET_VALUE_HOOKS] = ((0, import_tslib.__runInitializers)(this, _instanceExtraInitializers), ({ property }, value) => {
147
+ if (property === "local" && typeof value === "number" || property === "rf" && typeof value === "number") {
148
+ return {
149
+ forceVerifyChanges: /* @__PURE__ */ __name(() => true, "forceVerifyChanges"),
150
+ verifyChanges: /* @__PURE__ */ __name(() => {
151
+ if (this.isSinglecast()) {
152
+ this.schedulePoll({ property }, value, {
153
+ transition: "fast"
154
+ });
155
+ }
156
+ }, "verifyChanges")
157
+ };
158
+ }
159
+ });
160
+ isSetValueOptimistic(_valueId) {
161
+ return false;
162
+ }
147
163
  // oxlint-disable-next-line typescript/explicit-module-boundary-types
148
164
  async get() {
149
165
  this.assertSupportsCommand(import_Types.ProtectionCommand, import_Types.ProtectionCommand.Get);
@@ -219,10 +235,6 @@ let ProtectionCCAPI = (() => {
219
235
  });
220
236
  return this.host.sendCommand(cc, this.commandOptions);
221
237
  }
222
- constructor() {
223
- super(...arguments);
224
- (0, import_tslib.__runInitializers)(this, _instanceExtraInitializers);
225
- }
226
238
  };
227
239
  return ProtectionCCAPI2 = _classThis;
228
240
  })();
@@ -339,14 +351,8 @@ rf ${(0, import_shared.getEnumMemberName)(import_Types.RFProtectionState, pr
339
351
  };
340
352
  return ProtectionCC2 = _classThis;
341
353
  })();
342
- function getCCResponseForProtectionCCSet(ctx, sent) {
343
- if (sent.isSinglecast() && !sent.isEncapsulatedWith(import_core.CommandClasses.Supervision) && ctx.getNode(sent.nodeId)?.supportsCC(import_core.CommandClasses["Application Status"])) {
344
- return import_ApplicationStatusCC.ApplicationStatusCCRejectedRequest;
345
- }
346
- }
347
- __name(getCCResponseForProtectionCCSet, "getCCResponseForProtectionCCSet");
348
354
  let ProtectionCCSet = (() => {
349
- let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ProtectionCommand.Set), (0, import_CommandClassDecorators.expectedCCResponse)(getCCResponseForProtectionCCSet), (0, import_CommandClassDecorators.useSupervision)()];
355
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ProtectionCommand.Set), (0, import_CommandClassDecorators.useSupervision)()];
350
356
  let _classDescriptor;
351
357
  let _classExtraInitializers = [];
352
358
  let _classThis;
@@ -370,8 +376,18 @@ let ProtectionCCSet = (() => {
370
376
  this.local = options.local;
371
377
  this.rf = options.rf;
372
378
  }
373
- static from(_raw, _ctx) {
374
- throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
379
+ static from(raw, ctx) {
380
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
381
+ const local = raw.payload[0] & 15;
382
+ let rf;
383
+ if (raw.payload.length >= 2) {
384
+ rf = raw.payload[1] & 15;
385
+ }
386
+ return new this({
387
+ nodeId: ctx.sourceNodeId,
388
+ local,
389
+ rf
390
+ });
375
391
  }
376
392
  local;
377
393
  rf;
@@ -441,6 +457,10 @@ let ProtectionCCReport = (() => {
441
457
  }
442
458
  local;
443
459
  rf;
460
+ serialize(ctx) {
461
+ this.payload = this.rf !== void 0 ? import_shared.Bytes.from([this.local & 15, this.rf & 15]) : import_shared.Bytes.from([this.local & 15]);
462
+ return super.serialize(ctx);
463
+ }
444
464
  toLogEntry(ctx) {
445
465
  const message = {
446
466
  local: (0, import_shared.getEnumMemberName)(import_Types.LocalProtectionState, this.local)
@@ -539,6 +559,15 @@ let ProtectionCCSupportedReport = (() => {
539
559
  supportsTimeout;
540
560
  supportedLocalStates;
541
561
  supportedRFStates;
562
+ serialize(ctx) {
563
+ const flags = (this.supportsTimeout ? 1 : 0) | (this.supportsExclusiveControl ? 2 : 0);
564
+ this.payload = import_shared.Bytes.concat([
565
+ [flags],
566
+ (0, import_core.encodeBitMask)(this.supportedLocalStates, 15, import_Types.LocalProtectionState.Unprotected),
567
+ (0, import_core.encodeBitMask)(this.supportedRFStates, 15, import_Types.RFProtectionState.Unprotected)
568
+ ]);
569
+ return super.serialize(ctx);
570
+ }
542
571
  toLogEntry(ctx) {
543
572
  return {
544
573
  ...super.toLogEntry(ctx),
@@ -611,6 +640,10 @@ let ProtectionCCExclusiveControlReport = (() => {
611
640
  });
612
641
  }
613
642
  exclusiveControlNodeId;
643
+ serialize(ctx) {
644
+ this.payload = import_shared.Bytes.from([this.exclusiveControlNodeId]);
645
+ return super.serialize(ctx);
646
+ }
614
647
  toLogEntry(ctx) {
615
648
  return {
616
649
  ...super.toLogEntry(ctx),
@@ -669,8 +702,12 @@ let ProtectionCCExclusiveControlSet = (() => {
669
702
  super(options);
670
703
  this.exclusiveControlNodeId = options.exclusiveControlNodeId;
671
704
  }
672
- static from(_raw, _ctx) {
673
- throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
705
+ static from(raw, ctx) {
706
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
707
+ return new this({
708
+ nodeId: ctx.sourceNodeId,
709
+ exclusiveControlNodeId: raw.payload[0]
710
+ });
674
711
  }
675
712
  exclusiveControlNodeId;
676
713
  serialize(ctx) {
@@ -721,6 +758,10 @@ let ProtectionCCTimeoutReport = (() => {
721
758
  });
722
759
  }
723
760
  timeout;
761
+ serialize(ctx) {
762
+ this.payload = import_shared.Bytes.from([this.timeout.serialize()]);
763
+ return super.serialize(ctx);
764
+ }
724
765
  toLogEntry(ctx) {
725
766
  return {
726
767
  ...super.toLogEntry(ctx),
@@ -777,8 +818,12 @@ let ProtectionCCTimeoutSet = (() => {
777
818
  super(options);
778
819
  this.timeout = options.timeout;
779
820
  }
780
- static from(_raw, _ctx) {
781
- throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
821
+ static from(raw, ctx) {
822
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
823
+ return new this({
824
+ nodeId: ctx.sourceNodeId,
825
+ timeout: import_core.Timeout.parse(raw.payload[0])
826
+ });
782
827
  }
783
828
  timeout;
784
829
  serialize(ctx) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/ProtectionCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./ProtectionCC._validateArgs.js\";\nconst { validateArgs_ProtectionCCAPI_set, validateArgs_ProtectionCCAPI_setExclusiveControl, validateArgs_ProtectionCCAPI_setTimeout } = __validateArgs;\nimport { CommandClasses, type GetNode, type GetValueDB, MAX_NODES, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, type SupervisionResult, type SupportsCC, Timeout, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, enumValuesToMetadataStates, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, getEffectiveCCVersion, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { LocalProtectionState, ProtectionCommand, RFProtectionState, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ApplicationStatusCCRejectedRequest } from \"./ApplicationStatusCC.js\";\nimport { ProtectionCCValues } from \"./_CCValues.generated.js\";\nexport { ProtectionCCValues };\n@API(CommandClasses.Protection)\nexport class ProtectionCCAPI extends CCAPI {\n public supportsCommand(cmd: ProtectionCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ProtectionCommand.Get:\n return this.isSinglecast();\n case ProtectionCommand.Set:\n return true; // This is mandatory\n case ProtectionCommand.SupportedGet:\n return this.version >= 2 && this.isSinglecast();\n case ProtectionCommand.TimeoutGet:\n case ProtectionCommand.TimeoutSet: {\n return (this.isSinglecast()\n && this.tryGetValueDB()?.getValue<boolean>(ProtectionCCValues.supportsTimeout.endpoint(this.endpoint.index)));\n }\n case ProtectionCommand.ExclusiveControlGet:\n case ProtectionCommand.ExclusiveControlSet: {\n return (this.isSinglecast()\n && this.tryGetValueDB()?.getValue<boolean>(ProtectionCCValues.supportsExclusiveControl.endpoint(this.endpoint.index)));\n }\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ProtectionCCAPI, { property }, value) {\n const valueDB = this.tryGetValueDB();\n if (property === \"local\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // We need to set both values together, so retrieve the other one from the value DB\n const rf = valueDB?.getValue<RFProtectionState>(ProtectionCCValues.rfProtectionState.endpoint(this.endpoint.index));\n return this.set(value, rf);\n }\n else if (property === \"rf\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // We need to set both values together, so retrieve the other one from the value DB\n const local = valueDB?.getValue<LocalProtectionState>(ProtectionCCValues.localProtectionState.endpoint(this.endpoint.index));\n return this.set(local ?? LocalProtectionState.Unprotected, value);\n }\n else if (property === \"exclusiveControlNodeId\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n return this.setExclusiveControl(value);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ProtectionCCAPI, { property }) {\n switch (property) {\n case \"local\":\n case \"rf\":\n return (await this.get())?.[property];\n case \"exclusiveControlNodeId\":\n return this.getExclusiveControl();\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.Get);\n const cc = new ProtectionCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ProtectionCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"local\", \"rf\"]);\n }\n }\n @validateArgs_ProtectionCCAPI_set()\n public async set(local: LocalProtectionState, rf?: RFProtectionState): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.Set);\n const cc = new ProtectionCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n local,\n rf,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.SupportedGet);\n const cc = new ProtectionCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ProtectionCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"supportsExclusiveControl\",\n \"supportsTimeout\",\n \"supportedLocalStates\",\n \"supportedRFStates\",\n ]);\n }\n }\n public async getExclusiveControl(): Promise<MaybeNotKnown<number>> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.ExclusiveControlGet);\n const cc = new ProtectionCCExclusiveControlGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ProtectionCCExclusiveControlReport>(cc, this.commandOptions);\n return response?.exclusiveControlNodeId;\n }\n @validateArgs_ProtectionCCAPI_setExclusiveControl()\n public async setExclusiveControl(nodeId: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.ExclusiveControlSet);\n const cc = new ProtectionCCExclusiveControlSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n exclusiveControlNodeId: nodeId,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getTimeout(): Promise<MaybeNotKnown<Timeout>> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.TimeoutGet);\n const cc = new ProtectionCCTimeoutGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ProtectionCCTimeoutReport>(cc, this.commandOptions);\n return response?.timeout;\n }\n @validateArgs_ProtectionCCAPI_setTimeout()\n public async setTimeout(timeout: Timeout): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.TimeoutSet);\n const cc = new ProtectionCCTimeoutSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n timeout,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses.Protection)\n@implementedVersion(2)\n@ccValues(ProtectionCCValues)\nexport class ProtectionCC extends CommandClass {\n declare ccCommand: ProtectionCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Protection, ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // We need to do some queries after a potential timeout\n // In this case, do now mark this CC as interviewed completely\n let hadCriticalTimeout = false;\n // First find out what the device supports\n if (api.version >= 2) {\n ctx.logNode(node.id, {\n message: \"querying protection capabilities...\",\n direction: \"outbound\",\n });\n const resp = await api.getSupported();\n if (resp) {\n const logMessage = `received protection capabilities:\nexclusive control: ${resp.supportsExclusiveControl}\ntimeout: ${resp.supportsTimeout}\nlocal protection states: ${resp.supportedLocalStates\n .map((local) => getEnumMemberName(LocalProtectionState, local))\n .map((str) => `\\n\u00B7 ${str}`)\n .join(\"\")}\nRF protection states: ${resp.supportedRFStates\n .map((local) => getEnumMemberName(RFProtectionState, local))\n .map((str) => `\\n\u00B7 ${str}`)\n .join(\"\")}`;\n ctx.logNode(node.id, {\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n hadCriticalTimeout = true;\n }\n }\n await this.refreshValues(ctx);\n // Remember that the interview is complete\n if (!hadCriticalTimeout)\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Protection, ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n const supportsExclusiveControl = !!this.getValue(ctx, ProtectionCCValues.supportsExclusiveControl);\n const supportsTimeout = !!this.getValue(ctx, ProtectionCCValues.supportsTimeout);\n // Query the current state\n ctx.logNode(node.id, {\n message: \"querying protection status...\",\n direction: \"outbound\",\n });\n const protectionResp = await api.get();\n if (protectionResp) {\n let logMessage = `received protection status:\nlocal: ${getEnumMemberName(LocalProtectionState, protectionResp.local)}`;\n if (protectionResp.rf != undefined) {\n logMessage += `\nrf ${getEnumMemberName(RFProtectionState, protectionResp.rf)}`;\n }\n ctx.logNode(node.id, {\n message: logMessage,\n direction: \"inbound\",\n });\n }\n if (supportsTimeout) {\n // Query the current timeout\n ctx.logNode(node.id, {\n message: \"querying protection timeout...\",\n direction: \"outbound\",\n });\n const timeout = await api.getTimeout();\n if (timeout) {\n ctx.logNode(node.id, {\n message: `received timeout: ${timeout.toString()}`,\n direction: \"inbound\",\n });\n }\n }\n if (supportsExclusiveControl) {\n // Query the current timeout\n ctx.logNode(node.id, {\n message: \"querying exclusive control node...\",\n direction: \"outbound\",\n });\n const nodeId = await api.getExclusiveControl();\n if (nodeId != undefined) {\n ctx.logNode(node.id, {\n message: (nodeId !== 0\n ? `Node ${nodeId.toString().padStart(3, \"0\")}`\n : `no node`) + ` has exclusive control`,\n direction: \"inbound\",\n });\n }\n }\n }\n}\n// @publicAPI\nexport interface ProtectionCCSetOptions {\n local: LocalProtectionState;\n rf?: RFProtectionState;\n}\nfunction getCCResponseForProtectionCCSet(ctx: GetNode<NodeId & SupportsCC>, sent: ProtectionCCSet) {\n // The NodeID that has exclusive control can override the RF protection\n // state of the device and can control it regardless of the protection\n // state. Commands from any other nodes in the network may be restricted\n // by the RF protection state. In that case, the Application Rejected\n // Request Command MUST be returned.\n if (sent.isSinglecast()\n && !sent.isEncapsulatedWith(CommandClasses.Supervision)\n && ctx.getNode(sent.nodeId)?.supportsCC(CommandClasses[\"Application Status\"])) {\n return ApplicationStatusCCRejectedRequest;\n }\n}\n@CCCommand(ProtectionCommand.Set)\n@expectedCCResponse(getCCResponseForProtectionCCSet)\n@useSupervision()\nexport class ProtectionCCSet extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCSetOptions>) {\n super(options);\n this.local = options.local;\n this.rf = options.rf;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ProtectionCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ProtectionCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public local: LocalProtectionState;\n public rf?: RFProtectionState;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.local & 0b1111,\n (this.rf ?? RFProtectionState.Unprotected) & 0b1111,\n ]);\n const ccVersion = getEffectiveCCVersion(ctx, this);\n if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.encodeCCsUsingTargetVersion) {\n // When forcing CC version 1, only include the local state\n this.payload = this.payload.subarray(0, 1);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n local: getEnumMemberName(LocalProtectionState, this.local),\n };\n if (this.rf != undefined) {\n message.rf = getEnumMemberName(RFProtectionState, this.rf);\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ProtectionCCReportOptions {\n local: LocalProtectionState;\n rf?: RFProtectionState;\n}\n@CCCommand(ProtectionCommand.Report)\n@ccValueProperty(\"local\", ProtectionCCValues.localProtectionState)\n@ccValueProperty(\"rf\", ProtectionCCValues.rfProtectionState)\nexport class ProtectionCCReport extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.local = options.local;\n this.rf = options.rf;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCReport {\n validatePayload(raw.payload.length >= 1);\n const local: LocalProtectionState = raw.payload[0] & 0b1111;\n let rf: RFProtectionState | undefined;\n if (raw.payload.length >= 2) {\n rf = raw.payload[1] & 0b1111;\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n local,\n rf,\n });\n }\n public readonly local: LocalProtectionState;\n public readonly rf?: RFProtectionState;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n local: getEnumMemberName(LocalProtectionState, this.local),\n };\n if (this.rf != undefined) {\n message.rf = getEnumMemberName(RFProtectionState, this.rf);\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ProtectionCommand.Get)\n@expectedCCResponse(ProtectionCCReport)\nexport class ProtectionCCGet extends ProtectionCC {\n}\n// @publicAPI\nexport interface ProtectionCCSupportedReportOptions {\n supportsTimeout: boolean;\n supportsExclusiveControl: boolean;\n supportedLocalStates: LocalProtectionState[];\n supportedRFStates: RFProtectionState[];\n}\n@CCCommand(ProtectionCommand.SupportedReport)\n@ccValueProperty(\"supportsExclusiveControl\", ProtectionCCValues.supportsExclusiveControl)\n@ccValueProperty(\"supportsTimeout\", ProtectionCCValues.supportsTimeout)\n@ccValueProperty(\"supportedLocalStates\", ProtectionCCValues.supportedLocalStates)\n@ccValueProperty(\"supportedRFStates\", ProtectionCCValues.supportedRFStates)\nexport class ProtectionCCSupportedReport extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.supportsTimeout = options.supportsTimeout;\n this.supportsExclusiveControl = options.supportsExclusiveControl;\n this.supportedLocalStates = options.supportedLocalStates;\n this.supportedRFStates = options.supportedRFStates;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCSupportedReport {\n validatePayload(raw.payload.length >= 5);\n const supportsTimeout = !!(raw.payload[0] & 0b1);\n const supportsExclusiveControl = !!(raw.payload[0] & 0b10);\n const supportedLocalStates: LocalProtectionState[] = parseBitMask(raw.payload.subarray(1, 3), LocalProtectionState.Unprotected);\n const supportedRFStates: RFProtectionState[] = parseBitMask(raw.payload.subarray(3, 5), RFProtectionState.Unprotected);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportsTimeout,\n supportsExclusiveControl,\n supportedLocalStates,\n supportedRFStates,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // update metadata (partially) for the local and rf values\n const localStateValue = ProtectionCCValues.localProtectionState;\n this.setMetadata(ctx, localStateValue, {\n ...localStateValue.meta,\n states: enumValuesToMetadataStates(LocalProtectionState, this.supportedLocalStates),\n });\n const rfStateValue = ProtectionCCValues.rfProtectionState;\n this.setMetadata(ctx, rfStateValue, {\n ...rfStateValue.meta,\n states: enumValuesToMetadataStates(RFProtectionState, this.supportedRFStates),\n });\n return true;\n }\n public readonly supportsExclusiveControl: boolean;\n public readonly supportsTimeout: boolean;\n public readonly supportedLocalStates: LocalProtectionState[];\n public readonly supportedRFStates: RFProtectionState[];\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supports exclusive control\": this.supportsExclusiveControl,\n \"supports timeout\": this.supportsTimeout,\n \"local protection states\": this.supportedLocalStates\n .map((local) => getEnumMemberName(LocalProtectionState, local))\n .map((str) => `\\n\u00B7 ${str}`)\n .join(\"\"),\n \"RF protection states\": this.supportedRFStates\n .map((rf) => getEnumMemberName(RFProtectionState, rf))\n .map((str) => `\\n\u00B7 ${str}`)\n .join(\"\"),\n },\n };\n }\n}\n@CCCommand(ProtectionCommand.SupportedGet)\n@expectedCCResponse(ProtectionCCSupportedReport)\nexport class ProtectionCCSupportedGet extends ProtectionCC {\n}\n// @publicAPI\nexport interface ProtectionCCExclusiveControlReportOptions {\n exclusiveControlNodeId: number;\n}\n@CCCommand(ProtectionCommand.ExclusiveControlReport)\n@ccValueProperty(\"exclusiveControlNodeId\", ProtectionCCValues.exclusiveControlNodeId)\nexport class ProtectionCCExclusiveControlReport extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCExclusiveControlReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.exclusiveControlNodeId = options.exclusiveControlNodeId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCExclusiveControlReport {\n validatePayload(raw.payload.length >= 1);\n const exclusiveControlNodeId = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n exclusiveControlNodeId,\n });\n }\n public readonly exclusiveControlNodeId: number;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"exclusive control node id\": this.exclusiveControlNodeId,\n },\n };\n }\n}\n@CCCommand(ProtectionCommand.ExclusiveControlGet)\n@expectedCCResponse(ProtectionCCExclusiveControlReport)\nexport class ProtectionCCExclusiveControlGet extends ProtectionCC {\n}\n// @publicAPI\nexport interface ProtectionCCExclusiveControlSetOptions {\n exclusiveControlNodeId: number;\n}\n@CCCommand(ProtectionCommand.ExclusiveControlSet)\n@expectedCCResponse(ProtectionCCReport)\n@useSupervision()\nexport class ProtectionCCExclusiveControlSet extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCExclusiveControlSetOptions>) {\n super(options);\n this.exclusiveControlNodeId = options.exclusiveControlNodeId;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ProtectionCCExclusiveControlSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ProtectionCCExclusiveControlSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public exclusiveControlNodeId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.exclusiveControlNodeId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"exclusive control node id\": this.exclusiveControlNodeId,\n },\n };\n }\n}\n// @publicAPI\nexport interface ProtectionCCTimeoutReportOptions {\n timeout: Timeout;\n}\n@CCCommand(ProtectionCommand.TimeoutReport)\n@ccValueProperty(\"timeout\", ProtectionCCValues.timeout)\nexport class ProtectionCCTimeoutReport extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCTimeoutReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.timeout = options.timeout;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCTimeoutReport {\n validatePayload(raw.payload.length >= 1);\n const timeout: Timeout = Timeout.parse(raw.payload[0]);\n return new this({\n nodeId: ctx.sourceNodeId,\n timeout,\n });\n }\n public readonly timeout: Timeout;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { timeout: this.timeout.toString() },\n };\n }\n}\n@CCCommand(ProtectionCommand.TimeoutGet)\n@expectedCCResponse(ProtectionCCTimeoutReport)\nexport class ProtectionCCTimeoutGet extends ProtectionCC {\n}\n// @publicAPI\nexport interface ProtectionCCTimeoutSetOptions {\n timeout: Timeout;\n}\n@CCCommand(ProtectionCommand.TimeoutSet)\n@expectedCCResponse(ProtectionCCReport)\n@useSupervision()\nexport class ProtectionCCTimeoutSet extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCTimeoutSetOptions>) {\n super(options);\n this.timeout = options.timeout;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ProtectionCCTimeoutSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ProtectionCCTimeoutSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public timeout: Timeout;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.timeout.serialize()]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { timeout: this.timeout.toString() },\n };\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAqV;AACrV,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAAyK;AACzK,oCAAiI;AAEjI,mBAA4E;AAE5E,iCAAmD;AACnD,gCAAmC;AAVnC,MAAM,EAAE,kCAAkC,kDAAkD,wCAAuC,IAAK;IAa3H,mBAAe,MAAA;8BAD3B,mCAAI,2BAAe,UAAU,CAAC;;;;oBACM;;;;;uCAAA,YAAK;WAAA;;;;;;;;yBA6ErC,iCAAgC,CAAE;yCAqClC,iDAAgD,CAAE;gCAmBlD,wCAAuC,CAAE;AAvD1C,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAqChB,qCAAA,MAAA,MAAA,iCAAA,EAAA,MAAA,UAAA,MAAA,uBAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,yBAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,qBAAb,OAAgC,GA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AO;AACb,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,MAAa,MAAsB;AAElD,YAAM,IAAI,uBAAW,GAAG,KAAK,IAAI,qCAAqC,4BAAgB,8BAA8B;IAIxH;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,QAAQ,UAAS,CAAE,CAAC;AACpD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,SAAS,KAAK,QAAQ,SAAQ,EAAE;;IAEnD;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./ProtectionCC._validateArgs.js\";\nconst { validateArgs_ProtectionCCAPI_set, validateArgs_ProtectionCCAPI_setExclusiveControl, validateArgs_ProtectionCCAPI_setTimeout } = __validateArgs;\nimport { CommandClasses, type GetValueDB, MAX_NODES, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, Timeout, type ValueID, ValueMetadata, type WithAddress, encodeBitMask, enumValuesToMetadataStates, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, SET_VALUE_HOOKS, type SetValueImplementation, type SetValueImplementationHooksFactory, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, getEffectiveCCVersion, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { LocalProtectionState, ProtectionCommand, RFProtectionState, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ProtectionCCValues } from \"./_CCValues.generated.js\";\nexport { ProtectionCCValues };\n@API(CommandClasses.Protection)\nexport class ProtectionCCAPI extends CCAPI {\n public supportsCommand(cmd: ProtectionCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ProtectionCommand.Get:\n return this.isSinglecast();\n case ProtectionCommand.Set:\n return true; // This is mandatory\n case ProtectionCommand.SupportedGet:\n return this.version >= 2 && this.isSinglecast();\n case ProtectionCommand.TimeoutGet:\n case ProtectionCommand.TimeoutSet: {\n return (this.isSinglecast()\n && this.tryGetValueDB()?.getValue<boolean>(ProtectionCCValues.supportsTimeout.endpoint(this.endpoint.index)));\n }\n case ProtectionCommand.ExclusiveControlGet:\n case ProtectionCommand.ExclusiveControlSet: {\n return (this.isSinglecast()\n && this.tryGetValueDB()?.getValue<boolean>(ProtectionCCValues.supportsExclusiveControl.endpoint(this.endpoint.index)));\n }\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ProtectionCCAPI, { property }, value) {\n const valueDB = this.tryGetValueDB();\n if (property === \"local\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // We need to set both values together, so retrieve the other one from the value DB\n const rf = valueDB?.getValue<RFProtectionState>(ProtectionCCValues.rfProtectionState.endpoint(this.endpoint.index));\n return this.set(value, rf);\n }\n else if (property === \"rf\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // We need to set both values together, so retrieve the other one from the value DB\n const local = valueDB?.getValue<LocalProtectionState>(ProtectionCCValues.localProtectionState.endpoint(this.endpoint.index));\n return this.set(local ?? LocalProtectionState.Unprotected, value);\n }\n else if (property === \"exclusiveControlNodeId\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n return this.setExclusiveControl(value);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ProtectionCCAPI, { property }) {\n switch (property) {\n case \"local\":\n case \"rf\":\n return (await this.get())?.[property];\n case \"exclusiveControlNodeId\":\n return this.getExclusiveControl();\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = ({ property }, value) => {\n if ((property === \"local\"\n && typeof value === \"number\")\n || (property === \"rf\" && typeof value === \"number\")) {\n return {\n forceVerifyChanges: () => true,\n verifyChanges: () => {\n if (this.isSinglecast()) {\n this.schedulePoll({ property }, value, {\n transition: \"fast\",\n });\n }\n },\n };\n }\n };\n public override isSetValueOptimistic(_valueId: ValueID): boolean {\n // Protection changes may be rejected depending on the node's current\n // exclusive/RF protection state, so we always read the state back.\n return false;\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.Get);\n const cc = new ProtectionCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ProtectionCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"local\", \"rf\"]);\n }\n }\n @validateArgs_ProtectionCCAPI_set()\n public async set(local: LocalProtectionState, rf?: RFProtectionState): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.Set);\n const cc = new ProtectionCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n local,\n rf,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.SupportedGet);\n const cc = new ProtectionCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ProtectionCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"supportsExclusiveControl\",\n \"supportsTimeout\",\n \"supportedLocalStates\",\n \"supportedRFStates\",\n ]);\n }\n }\n public async getExclusiveControl(): Promise<MaybeNotKnown<number>> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.ExclusiveControlGet);\n const cc = new ProtectionCCExclusiveControlGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ProtectionCCExclusiveControlReport>(cc, this.commandOptions);\n return response?.exclusiveControlNodeId;\n }\n @validateArgs_ProtectionCCAPI_setExclusiveControl()\n public async setExclusiveControl(nodeId: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.ExclusiveControlSet);\n const cc = new ProtectionCCExclusiveControlSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n exclusiveControlNodeId: nodeId,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getTimeout(): Promise<MaybeNotKnown<Timeout>> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.TimeoutGet);\n const cc = new ProtectionCCTimeoutGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ProtectionCCTimeoutReport>(cc, this.commandOptions);\n return response?.timeout;\n }\n @validateArgs_ProtectionCCAPI_setTimeout()\n public async setTimeout(timeout: Timeout): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ProtectionCommand, ProtectionCommand.TimeoutSet);\n const cc = new ProtectionCCTimeoutSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n timeout,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses.Protection)\n@implementedVersion(2)\n@ccValues(ProtectionCCValues)\nexport class ProtectionCC extends CommandClass {\n declare ccCommand: ProtectionCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Protection, ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // We need to do some queries after a potential timeout\n // In this case, do now mark this CC as interviewed completely\n let hadCriticalTimeout = false;\n // First find out what the device supports\n if (api.version >= 2) {\n ctx.logNode(node.id, {\n message: \"querying protection capabilities...\",\n direction: \"outbound\",\n });\n const resp = await api.getSupported();\n if (resp) {\n const logMessage = `received protection capabilities:\nexclusive control: ${resp.supportsExclusiveControl}\ntimeout: ${resp.supportsTimeout}\nlocal protection states: ${resp.supportedLocalStates\n .map((local) => getEnumMemberName(LocalProtectionState, local))\n .map((str) => `\\n\u00B7 ${str}`)\n .join(\"\")}\nRF protection states: ${resp.supportedRFStates\n .map((local) => getEnumMemberName(RFProtectionState, local))\n .map((str) => `\\n\u00B7 ${str}`)\n .join(\"\")}`;\n ctx.logNode(node.id, {\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n hadCriticalTimeout = true;\n }\n }\n await this.refreshValues(ctx);\n // Remember that the interview is complete\n if (!hadCriticalTimeout)\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Protection, ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n const supportsExclusiveControl = !!this.getValue(ctx, ProtectionCCValues.supportsExclusiveControl);\n const supportsTimeout = !!this.getValue(ctx, ProtectionCCValues.supportsTimeout);\n // Query the current state\n ctx.logNode(node.id, {\n message: \"querying protection status...\",\n direction: \"outbound\",\n });\n const protectionResp = await api.get();\n if (protectionResp) {\n let logMessage = `received protection status:\nlocal: ${getEnumMemberName(LocalProtectionState, protectionResp.local)}`;\n if (protectionResp.rf != undefined) {\n logMessage += `\nrf ${getEnumMemberName(RFProtectionState, protectionResp.rf)}`;\n }\n ctx.logNode(node.id, {\n message: logMessage,\n direction: \"inbound\",\n });\n }\n if (supportsTimeout) {\n // Query the current timeout\n ctx.logNode(node.id, {\n message: \"querying protection timeout...\",\n direction: \"outbound\",\n });\n const timeout = await api.getTimeout();\n if (timeout) {\n ctx.logNode(node.id, {\n message: `received timeout: ${timeout.toString()}`,\n direction: \"inbound\",\n });\n }\n }\n if (supportsExclusiveControl) {\n // Query the current timeout\n ctx.logNode(node.id, {\n message: \"querying exclusive control node...\",\n direction: \"outbound\",\n });\n const nodeId = await api.getExclusiveControl();\n if (nodeId != undefined) {\n ctx.logNode(node.id, {\n message: (nodeId !== 0\n ? `Node ${nodeId.toString().padStart(3, \"0\")}`\n : `no node`) + ` has exclusive control`,\n direction: \"inbound\",\n });\n }\n }\n }\n}\n// @publicAPI\nexport interface ProtectionCCSetOptions {\n local: LocalProtectionState;\n rf?: RFProtectionState;\n}\n@CCCommand(ProtectionCommand.Set)\n@useSupervision()\nexport class ProtectionCCSet extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCSetOptions>) {\n super(options);\n this.local = options.local;\n this.rf = options.rf;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCSet {\n validatePayload(raw.payload.length >= 1);\n const local: LocalProtectionState = raw.payload[0] & 0b1111;\n let rf: RFProtectionState | undefined;\n if (raw.payload.length >= 2) {\n rf = raw.payload[1] & 0b1111;\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n local,\n rf,\n });\n }\n public local: LocalProtectionState;\n public rf?: RFProtectionState;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.local & 0b1111,\n (this.rf ?? RFProtectionState.Unprotected) & 0b1111,\n ]);\n const ccVersion = getEffectiveCCVersion(ctx, this);\n if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.encodeCCsUsingTargetVersion) {\n // When forcing CC version 1, only include the local state\n this.payload = this.payload.subarray(0, 1);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n local: getEnumMemberName(LocalProtectionState, this.local),\n };\n if (this.rf != undefined) {\n message.rf = getEnumMemberName(RFProtectionState, this.rf);\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ProtectionCCReportOptions {\n local: LocalProtectionState;\n rf?: RFProtectionState;\n}\n@CCCommand(ProtectionCommand.Report)\n@ccValueProperty(\"local\", ProtectionCCValues.localProtectionState)\n@ccValueProperty(\"rf\", ProtectionCCValues.rfProtectionState)\nexport class ProtectionCCReport extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCReportOptions>) {\n super(options);\n this.local = options.local;\n this.rf = options.rf;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCReport {\n validatePayload(raw.payload.length >= 1);\n const local: LocalProtectionState = raw.payload[0] & 0b1111;\n let rf: RFProtectionState | undefined;\n if (raw.payload.length >= 2) {\n rf = raw.payload[1] & 0b1111;\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n local,\n rf,\n });\n }\n public readonly local: LocalProtectionState;\n public readonly rf?: RFProtectionState;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = this.rf !== undefined\n ? Bytes.from([this.local & 0b1111, this.rf & 0b1111])\n : Bytes.from([this.local & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n local: getEnumMemberName(LocalProtectionState, this.local),\n };\n if (this.rf != undefined) {\n message.rf = getEnumMemberName(RFProtectionState, this.rf);\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ProtectionCommand.Get)\n@expectedCCResponse(ProtectionCCReport)\nexport class ProtectionCCGet extends ProtectionCC {\n}\n// @publicAPI\nexport interface ProtectionCCSupportedReportOptions {\n supportsTimeout: boolean;\n supportsExclusiveControl: boolean;\n supportedLocalStates: LocalProtectionState[];\n supportedRFStates: RFProtectionState[];\n}\n@CCCommand(ProtectionCommand.SupportedReport)\n@ccValueProperty(\"supportsExclusiveControl\", ProtectionCCValues.supportsExclusiveControl)\n@ccValueProperty(\"supportsTimeout\", ProtectionCCValues.supportsTimeout)\n@ccValueProperty(\"supportedLocalStates\", ProtectionCCValues.supportedLocalStates)\n@ccValueProperty(\"supportedRFStates\", ProtectionCCValues.supportedRFStates)\nexport class ProtectionCCSupportedReport extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCSupportedReportOptions>) {\n super(options);\n this.supportsTimeout = options.supportsTimeout;\n this.supportsExclusiveControl = options.supportsExclusiveControl;\n this.supportedLocalStates = options.supportedLocalStates;\n this.supportedRFStates = options.supportedRFStates;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCSupportedReport {\n validatePayload(raw.payload.length >= 5);\n const supportsTimeout = !!(raw.payload[0] & 0b1);\n const supportsExclusiveControl = !!(raw.payload[0] & 0b10);\n const supportedLocalStates: LocalProtectionState[] = parseBitMask(raw.payload.subarray(1, 3), LocalProtectionState.Unprotected);\n const supportedRFStates: RFProtectionState[] = parseBitMask(raw.payload.subarray(3, 5), RFProtectionState.Unprotected);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportsTimeout,\n supportsExclusiveControl,\n supportedLocalStates,\n supportedRFStates,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // update metadata (partially) for the local and rf values\n const localStateValue = ProtectionCCValues.localProtectionState;\n this.setMetadata(ctx, localStateValue, {\n ...localStateValue.meta,\n states: enumValuesToMetadataStates(LocalProtectionState, this.supportedLocalStates),\n });\n const rfStateValue = ProtectionCCValues.rfProtectionState;\n this.setMetadata(ctx, rfStateValue, {\n ...rfStateValue.meta,\n states: enumValuesToMetadataStates(RFProtectionState, this.supportedRFStates),\n });\n return true;\n }\n public readonly supportsExclusiveControl: boolean;\n public readonly supportsTimeout: boolean;\n public readonly supportedLocalStates: LocalProtectionState[];\n public readonly supportedRFStates: RFProtectionState[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const flags = (this.supportsTimeout ? 0b1 : 0)\n | (this.supportsExclusiveControl ? 0b10 : 0);\n this.payload = Bytes.concat([\n [flags],\n encodeBitMask(this.supportedLocalStates, 15, LocalProtectionState.Unprotected),\n encodeBitMask(this.supportedRFStates, 15, RFProtectionState.Unprotected),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supports exclusive control\": this.supportsExclusiveControl,\n \"supports timeout\": this.supportsTimeout,\n \"local protection states\": this.supportedLocalStates\n .map((local) => getEnumMemberName(LocalProtectionState, local))\n .map((str) => `\\n\u00B7 ${str}`)\n .join(\"\"),\n \"RF protection states\": this.supportedRFStates\n .map((rf) => getEnumMemberName(RFProtectionState, rf))\n .map((str) => `\\n\u00B7 ${str}`)\n .join(\"\"),\n },\n };\n }\n}\n@CCCommand(ProtectionCommand.SupportedGet)\n@expectedCCResponse(ProtectionCCSupportedReport)\nexport class ProtectionCCSupportedGet extends ProtectionCC {\n}\n// @publicAPI\nexport interface ProtectionCCExclusiveControlReportOptions {\n exclusiveControlNodeId: number;\n}\n@CCCommand(ProtectionCommand.ExclusiveControlReport)\n@ccValueProperty(\"exclusiveControlNodeId\", ProtectionCCValues.exclusiveControlNodeId)\nexport class ProtectionCCExclusiveControlReport extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCExclusiveControlReportOptions>) {\n super(options);\n this.exclusiveControlNodeId = options.exclusiveControlNodeId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCExclusiveControlReport {\n validatePayload(raw.payload.length >= 1);\n const exclusiveControlNodeId = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n exclusiveControlNodeId,\n });\n }\n public readonly exclusiveControlNodeId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.exclusiveControlNodeId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"exclusive control node id\": this.exclusiveControlNodeId,\n },\n };\n }\n}\n@CCCommand(ProtectionCommand.ExclusiveControlGet)\n@expectedCCResponse(ProtectionCCExclusiveControlReport)\nexport class ProtectionCCExclusiveControlGet extends ProtectionCC {\n}\n// @publicAPI\nexport interface ProtectionCCExclusiveControlSetOptions {\n exclusiveControlNodeId: number;\n}\n@CCCommand(ProtectionCommand.ExclusiveControlSet)\n@expectedCCResponse(ProtectionCCReport)\n@useSupervision()\nexport class ProtectionCCExclusiveControlSet extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCExclusiveControlSetOptions>) {\n super(options);\n this.exclusiveControlNodeId = options.exclusiveControlNodeId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCExclusiveControlSet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n exclusiveControlNodeId: raw.payload[0],\n });\n }\n public exclusiveControlNodeId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.exclusiveControlNodeId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"exclusive control node id\": this.exclusiveControlNodeId,\n },\n };\n }\n}\n// @publicAPI\nexport interface ProtectionCCTimeoutReportOptions {\n timeout: Timeout;\n}\n@CCCommand(ProtectionCommand.TimeoutReport)\n@ccValueProperty(\"timeout\", ProtectionCCValues.timeout)\nexport class ProtectionCCTimeoutReport extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCTimeoutReportOptions>) {\n super(options);\n this.timeout = options.timeout;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCTimeoutReport {\n validatePayload(raw.payload.length >= 1);\n const timeout: Timeout = Timeout.parse(raw.payload[0]);\n return new this({\n nodeId: ctx.sourceNodeId,\n timeout,\n });\n }\n public readonly timeout: Timeout;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.timeout.serialize()]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { timeout: this.timeout.toString() },\n };\n }\n}\n@CCCommand(ProtectionCommand.TimeoutGet)\n@expectedCCResponse(ProtectionCCTimeoutReport)\nexport class ProtectionCCTimeoutGet extends ProtectionCC {\n}\n// @publicAPI\nexport interface ProtectionCCTimeoutSetOptions {\n timeout: Timeout;\n}\n@CCCommand(ProtectionCommand.TimeoutSet)\n@expectedCCResponse(ProtectionCCReport)\n@useSupervision()\nexport class ProtectionCCTimeoutSet extends ProtectionCC {\n public constructor(options: WithAddress<ProtectionCCTimeoutSetOptions>) {\n super(options);\n this.timeout = options.timeout;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ProtectionCCTimeoutSet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n timeout: Timeout.parse(raw.payload[0]),\n });\n }\n public timeout: Timeout;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.timeout.serialize()]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { timeout: this.timeout.toString() },\n };\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAyS;AACzS,oBAA+C;AAC/C,iBAAkN;AAClN,0BAAyK;AACzK,oCAAiI;AAEjI,mBAA4E;AAE5E,gCAAmC;AATnC,MAAM,EAAE,kCAAkC,kDAAkD,wC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A,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;IASA,0BAAsB,MAAA;8BAHlC,yCAAU,+BAAkB,UAAU,OACtC,kDAAmB,kBAAkB,OACrC,8CAAc,CAAE;;;;oBAC2B;8CAAA,YAAY;WAAA;;;;;;;;AAAxD,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAAmD;AAClE,YAAM,OAAO;AACb,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ,SAAS,oBAAQ,MAAM,IAAI,QAAQ,CAAC,CAAC;OACxC;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,QAAQ,UAAS,CAAE,CAAC;AACpD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,SAAS,KAAK,QAAQ,SAAQ,EAAE;;IAEnD;;;;",
6
6
  "names": []
7
7
  }
@@ -1794,14 +1794,33 @@ let UserCredentialCCCredentialReport = (() => {
1794
1794
  persistValues(ctx) {
1795
1795
  if (!super.persistValues(ctx))
1796
1796
  return false;
1797
- if (this.credentialType === import_Types.UserCredentialType.None || this.credentialSlot === 0) {
1797
+ if (this.reportType === import_Types.UserCredentialCredentialReportType.CredentialDeleted || this.reportType === import_Types.UserCredentialCredentialReportType.CredentialModifyRejectedLocationEmpty) {
1798
+ if (this.credentialType !== import_Types.UserCredentialType.None && this.credentialSlot !== 0) {
1799
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.credentialType, this.credentialSlot));
1800
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialOwner(this.credentialType, this.credentialSlot));
1801
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.credentialType, this.credentialSlot));
1802
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.credentialType, this.credentialSlot));
1803
+ } else {
1804
+ const valueDB = this.getValueDB(ctx);
1805
+ const credentialOwners = valueDB.findValues((vid) => import_CCValues_generated.UserCredentialCCValues.credentialOwner.is(vid) && vid.endpoint === this.endpointIndex);
1806
+ for (const { endpoint, propertyKey, value } of credentialOwners) {
1807
+ if (this.userId !== 0 && value !== this.userId)
1808
+ continue;
1809
+ const key = propertyKey;
1810
+ const cType = key >>> 16;
1811
+ const cSlot = key & 65535;
1812
+ if (this.credentialType !== import_Types.UserCredentialType.None && cType !== this.credentialType) {
1813
+ continue;
1814
+ }
1815
+ valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credential(cType, cSlot).endpoint(endpoint));
1816
+ valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialOwner(cType, cSlot).endpoint(endpoint));
1817
+ valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialModifierType(cType, cSlot).endpoint(endpoint));
1818
+ valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(cType, cSlot).endpoint(endpoint));
1819
+ }
1820
+ }
1798
1821
  return true;
1799
1822
  }
1800
- if (this.reportType === import_Types.UserCredentialCredentialReportType.CredentialDeleted || this.reportType === import_Types.UserCredentialCredentialReportType.CredentialModifyRejectedLocationEmpty) {
1801
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.credentialType, this.credentialSlot));
1802
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialOwner(this.credentialType, this.credentialSlot));
1803
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.credentialType, this.credentialSlot));
1804
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.credentialType, this.credentialSlot));
1823
+ if (this.credentialType === import_Types.UserCredentialType.None || this.credentialSlot === 0) {
1805
1824
  return true;
1806
1825
  }
1807
1826
  const isRejectionWithReadback = this.reportType === import_Types.UserCredentialCredentialReportType.CredentialAddRejectedLocationOccupied && this.credentialReadBack;