@zwave-js/cc 15.27.0 → 15.28.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.
Files changed (87) hide show
  1. package/build/cjs/cc/AssociationGroupInfoCC.js +1 -0
  2. package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
  3. package/build/cjs/cc/BatteryCC.js +2 -1
  4. package/build/cjs/cc/BatteryCC.js.map +2 -2
  5. package/build/cjs/cc/BinarySensorCC.js +5 -1
  6. package/build/cjs/cc/BinarySensorCC.js.map +2 -2
  7. package/build/cjs/cc/ConfigurationCC.js +15 -4
  8. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  9. package/build/cjs/cc/DoorLockCC.js +1 -1
  10. package/build/cjs/cc/DoorLockCC.js.map +1 -1
  11. package/build/cjs/cc/IndicatorCC.js +4 -3
  12. package/build/cjs/cc/IndicatorCC.js.map +2 -2
  13. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.d.ts +1 -0
  14. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.js +13 -0
  15. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.js.map +2 -2
  16. package/build/cjs/cc/ManufacturerSpecificCC.d.ts +6 -4
  17. package/build/cjs/cc/ManufacturerSpecificCC.js +41 -7
  18. package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
  19. package/build/cjs/cc/MeterCC.js +10 -8
  20. package/build/cjs/cc/MeterCC.js.map +2 -2
  21. package/build/cjs/cc/ProtectionCC.js +2 -0
  22. package/build/cjs/cc/ProtectionCC.js.map +2 -2
  23. package/build/cjs/cc/SecurityCC.d.ts +1 -1
  24. package/build/cjs/cc/SecurityCC.js.map +2 -2
  25. package/build/cjs/cc/UserCodeCC.js +2 -0
  26. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  27. package/build/cjs/cc/UserCredentialCC.js +4 -0
  28. package/build/cjs/cc/UserCredentialCC.js.map +2 -2
  29. package/build/cjs/cc/_CCValues.generated.d.ts +2 -2
  30. package/build/cjs/cc/_CCValues.generated.js +1 -1
  31. package/build/cjs/cc/_CCValues.generated.js.map +1 -1
  32. package/build/cjs/lib/CommandClass.d.ts +3 -1
  33. package/build/cjs/lib/CommandClass.js +11 -4
  34. package/build/cjs/lib/CommandClass.js.map +2 -2
  35. package/build/cjs/lib/_Types.d.ts +4 -0
  36. package/build/cjs/lib/_Types.js +7 -0
  37. package/build/cjs/lib/_Types.js.map +3 -3
  38. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  39. package/build/esm/cc/AssociationGroupInfoCC.js +1 -0
  40. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  41. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  42. package/build/esm/cc/BatteryCC.js +5 -2
  43. package/build/esm/cc/BatteryCC.js.map +1 -1
  44. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  45. package/build/esm/cc/BinarySensorCC.js +8 -2
  46. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  47. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  48. package/build/esm/cc/ConfigurationCC.js +17 -4
  49. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  50. package/build/esm/cc/DoorLockCC.js +1 -1
  51. package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
  52. package/build/esm/cc/IndicatorCC.js +8 -4
  53. package/build/esm/cc/IndicatorCC.js.map +1 -1
  54. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts +1 -0
  55. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts.map +1 -1
  56. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.js +10 -0
  57. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.js.map +1 -1
  58. package/build/esm/cc/ManufacturerSpecificCC.d.ts +6 -4
  59. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  60. package/build/esm/cc/ManufacturerSpecificCC.js +54 -14
  61. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  62. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  63. package/build/esm/cc/MeterCC.js +13 -9
  64. package/build/esm/cc/MeterCC.js.map +1 -1
  65. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  66. package/build/esm/cc/ProtectionCC.js +3 -0
  67. package/build/esm/cc/ProtectionCC.js.map +1 -1
  68. package/build/esm/cc/SecurityCC.d.ts +1 -1
  69. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  70. package/build/esm/cc/SecurityCC.js.map +1 -1
  71. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  72. package/build/esm/cc/UserCodeCC.js +3 -0
  73. package/build/esm/cc/UserCodeCC.js.map +1 -1
  74. package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
  75. package/build/esm/cc/UserCredentialCC.js +7 -1
  76. package/build/esm/cc/UserCredentialCC.js.map +1 -1
  77. package/build/esm/cc/_CCValues.generated.d.ts +2 -2
  78. package/build/esm/cc/_CCValues.generated.js +1 -1
  79. package/build/esm/lib/CommandClass.d.ts +3 -1
  80. package/build/esm/lib/CommandClass.d.ts.map +1 -1
  81. package/build/esm/lib/CommandClass.js +11 -4
  82. package/build/esm/lib/CommandClass.js.map +1 -1
  83. package/build/esm/lib/_Types.d.ts +4 -0
  84. package/build/esm/lib/_Types.d.ts.map +1 -1
  85. package/build/esm/lib/_Types.js +5 -0
  86. package/build/esm/lib/_Types.js.map +1 -1
  87. package/package.json +7 -7
@@ -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 GetValueDB, MAX_NODES, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, Timeout, type ValueID, ValueMetadata, type WithAddress, encodeBitMask, enumValuesToMetadataStates, getNodeTag, logDict, logList, logText, 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 tag: \"interview\",\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 = logText(\"received protection capabilities:\", {\n nested: logDict({\n \"exclusive control\": resp.supportsExclusiveControl,\n timeout: resp.supportsTimeout,\n \"local protection states\": logList(resp.supportedLocalStates.map((local) => getEnumMemberName(LocalProtectionState, local))),\n \"RF protection states\": logList(resp.supportedRFStates.map((local) => getEnumMemberName(RFProtectionState, local))),\n }),\n });\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, { tag: \"interview\" });\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 tag: options?.tag,\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 ? getNodeTag(nodeId)\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\": logList(this.supportedLocalStates.map((local) => getEnumMemberName(LocalProtectionState, local))),\n \"RF protection states\": logList(this.supportedRFStates.map((rf) => getEnumMemberName(RFProtectionState, rf))),\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,kBAAgV;AAChV,oBAA+C;AAC/C,iBAAkN;AAClN,0BAAyK;AACzK,oCAAiI;AAEjI,mBAA4E;AAE5E,gCAAmC;AATnC,MAAM,EAAE,kCAAkC,kDAAkD,wCAAuC,IAAK;IAY3H,mBAAe,MAAA;8BAD3B,mCAAI,2BAAe,UAAU,CAAC;;;;oBACM;;;;;uCAAA,YAAK;WAAA;;;;;;;;yBAkGrC,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,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAmBhC,qCAAA,MAAA,MAAA,wBAAA,EAAA,MAAA,UAAA,MAAA,cAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAA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,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, getNodeTag, logDict, logList, logText, 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 tag: \"interview\",\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 = logText(\"received protection capabilities:\", {\n nested: logDict({\n \"exclusive control\": resp.supportsExclusiveControl,\n timeout: resp.supportsTimeout,\n \"local protection states\": logList(resp.supportedLocalStates.map((local) => getEnumMemberName(LocalProtectionState, local))),\n \"RF protection states\": logList(resp.supportedRFStates.map((local) => getEnumMemberName(RFProtectionState, local))),\n }),\n });\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, { tag: \"interview\" });\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 tag: options?.tag,\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 ? getNodeTag(nodeId)\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 // This command only exists in V2. Ignore it if the device advertises a lower version.\n if (getEffectiveCCVersion(ctx, this) < 2)\n return true;\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\": logList(this.supportedLocalStates.map((local) => getEnumMemberName(LocalProtectionState, local))),\n \"RF protection states\": logList(this.supportedRFStates.map((rf) => getEnumMemberName(RFProtectionState, rf))),\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,kBAAgV;AAChV,oBAA+C;AAC/C,iBAAkN;AAClN,0BAAyK;AACzK,oCAAiI;AAEjI,mBAA4E;AAE5E,gCAAmC;AATnC,MAAM,EAAE,kCAAkC,kDAAkD,wCAAuC,IAAK;IAY3H,mBAAe,MAAA;8BAD3B,mCAAI,2BAAe,UAAU,CAAC;;;;oBACM;;;;;uCAAA,YAAK;WAAA;;;;;;;;yBAkGrC,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,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I,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
  }
@@ -63,7 +63,7 @@ export declare class SecurityCCCommandEncapsulation extends SecurityCC {
63
63
  private sequenced;
64
64
  private secondFrame;
65
65
  private sequenceCounter;
66
- private decryptedCCBytes;
66
+ decryptedCCBytes: BytesView | undefined;
67
67
  encapsulated: CommandClass;
68
68
  private alternativeNetworkKey?;
69
69
  get nonceId(): number | undefined;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/SecurityCC.ts"],
4
- "sourcesContent": ["import { CommandClasses, EncapsulationFlags, type GetNode, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, SecurityClass, type SecurityManager, type SupportsCC, TransmitOptions, type WithAddress, ZWaveError, ZWaveErrorCodes, computeMAC, decryptAES128OFB, encodeCCList, encryptAES128OFB, generateAuthKey, generateEncryptionKey, getCCName, isTransmissionError, logDict, logList, logText, parseCCList, randomBytes, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex, getenv, num2hex, pick, } from \"@zwave-js/shared\";\nimport { wait } from \"alcalzone-shared/async\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { SecurityCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { CRC16CC } from \"./CRC16CC.js\";\nimport { Security2CC } from \"./Security2CC.js\";\nimport { TransportServiceCC } from \"./TransportServiceCC.js\";\n// @noSetValueAPI This is an encapsulation CC\nfunction getAuthenticationData(senderNonce: BytesView, receiverNonce: BytesView, ccCommand: SecurityCommand, sendingNodeId: number, receivingNodeId: number, encryptedPayload: BytesView): BytesView {\n return Bytes.concat([\n senderNonce,\n receiverNonce,\n [\n ccCommand,\n sendingNodeId,\n receivingNodeId,\n encryptedPayload.length,\n ],\n encryptedPayload,\n ]);\n}\nfunction throwNoNonce(reason?: string): never {\n let message = `Security CC requires a nonce to be sent!`;\n if (reason)\n message += ` Reason: ${reason}`;\n throw new ZWaveError(message, ZWaveErrorCodes.SecurityCC_NoNonce);\n}\nconst HALF_NONCE_SIZE = 8;\nfunction assertSecurityRX(ctx: CCParsingContext): asserts ctx is CCParsingContext & {\n securityManager: SecurityManager;\n} {\n if (!ctx.ownNodeId) {\n throw new ZWaveError(`Secure commands (S0) can only be decoded when the controller's node id is known!`, ZWaveErrorCodes.Driver_NotReady);\n }\n if (!ctx.securityManager) {\n throw new ZWaveError(`Secure commands (S0) can only be decoded when the security manager is set up!`, ZWaveErrorCodes.Driver_NoSecurity);\n }\n}\nfunction assertSecurityTX(ctx: CCEncodingContext): asserts ctx is CCEncodingContext & {\n securityManager: SecurityManager;\n} {\n if (!ctx.ownNodeId) {\n throw new ZWaveError(`Secure commands (S0) can only be sent when the controller's node id is known!`, ZWaveErrorCodes.Driver_NotReady);\n }\n if (!ctx.securityManager) {\n throw new ZWaveError(`Secure commands (S0) can only be sent when the security manager is set up!`, ZWaveErrorCodes.Driver_NoSecurity);\n }\n}\n// TODO: Ignore commands if received via multicast\n// Encapsulation CCs are used internally and too frequently that we\n// want to pay the cost of validating each call\n/* eslint-disable @zwave-js/ccapi-validate-args */\n@API(CommandClasses.Security)\nexport class SecurityCCAPI extends PhysicalCCAPI {\n public supportsCommand(_cmd: SecurityCommand): MaybeNotKnown<boolean> {\n // All commands are mandatory\n return true;\n }\n public async sendEncapsulated(encapsulated: CommandClass, requestNextNonce: boolean = false): Promise<void> {\n if (requestNextNonce) {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.CommandEncapsulation);\n }\n else {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.CommandEncapsulationNonceGet);\n }\n const cc = new (requestNextNonce\n ? SecurityCCCommandEncapsulationNonceGet\n : SecurityCCCommandEncapsulation)({\n nodeId: this.endpoint.nodeId,\n encapsulated,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n /**\n * Requests a new nonce for Security CC encapsulation which is not directly linked to a specific command.\n */\n public async getNonce(): Promise<BytesView | undefined> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.NonceGet);\n const cc = new SecurityCCNonceGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<SecurityCCNonceReport>(cc, {\n ...this.commandOptions,\n // Only try getting a nonce once\n maxSendAttempts: 1,\n });\n if (!response)\n return;\n const nonce = response.nonce;\n const secMan = this.host.securityManager!;\n secMan.setNonce({\n issuer: this.endpoint.nodeId,\n nonceId: secMan.getNonceId(nonce),\n }, { nonce, receiver: this.host.ownNodeId }, { free: true });\n return nonce;\n }\n /**\n * Responds to a NonceGet request. The message is sent without any retransmission etc.\n * The return value indicates whether a nonce was successfully sent\n */\n public async sendNonce(): Promise<boolean> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.NonceReport);\n if (!this.host.securityManager) {\n throw new ZWaveError(`Nonces can only be sent if secure communication is set up!`, ZWaveErrorCodes.Driver_NoSecurity);\n }\n const nonce = this.host.securityManager.generateNonce(this.endpoint.nodeId, HALF_NONCE_SIZE);\n const nonceId = this.host.securityManager.getNonceId(nonce);\n const cc = new SecurityCCNonceReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n nonce,\n });\n try {\n await this.host.sendCommand(cc, {\n ...this.commandOptions,\n // Seems we need these options or some nodes won't accept the nonce\n transmitOptions: TransmitOptions.ACK\n | TransmitOptions.AutoRoute,\n // Only try sending a nonce once\n maxSendAttempts: 1,\n // Nonce requests must be handled immediately\n priority: MessagePriority.Immediate,\n // We don't want failures causing us to treat the node as asleep or dead\n changeNodeStatusOnMissingACK: false,\n });\n }\n catch (e) {\n if (isTransmissionError(e)) {\n // The nonce could not be sent, invalidate it\n this.host.securityManager.deleteNonce(nonceId);\n return false;\n }\n else {\n // Pass other errors through\n throw e;\n }\n }\n return true;\n }\n public async getSecurityScheme(): Promise<[\n 0\n ]> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.SchemeGet);\n const cc = new SecurityCCSchemeGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n // There is only one scheme, so we hardcode it\n return [0];\n }\n public async reportSecurityScheme(encapsulated: boolean): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.SchemeReport);\n let cc: CommandClass = new SecurityCCSchemeReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n if (encapsulated) {\n cc = new SecurityCCCommandEncapsulation({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n encapsulated: cc,\n });\n }\n await this.host.sendCommand(cc, this.commandOptions);\n }\n public async inheritSecurityScheme(): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.SchemeInherit);\n const cc = new SecurityCCSchemeInherit({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n // There is only one scheme, so we don't return anything here\n }\n public async setNetworkKey(networkKey: BytesView): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.NetworkKeySet);\n const keySet = new SecurityCCNetworkKeySet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n networkKey,\n });\n const cc = new SecurityCCCommandEncapsulation({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n encapsulated: keySet,\n alternativeNetworkKey: new Uint8Array(16).fill(0),\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n public async verifyNetworkKey(): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.NetworkKeyVerify);\n const cc = new SecurityCCNetworkKeyVerify({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupportedCommands() {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.CommandsSupportedGet);\n const cc = new SecurityCCCommandsSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<SecurityCCCommandsSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"supportedCCs\", \"controlledCCs\"]);\n }\n }\n public async reportSupportedCommands(supportedCCs: CommandClasses[], controlledCCs: CommandClasses[]): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.CommandsSupportedReport);\n const cc = new SecurityCCCommandsSupportedReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n supportedCCs,\n controlledCCs,\n reportsToFollow: 0,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses.Security)\n@implementedVersion(1)\nexport class SecurityCC extends CommandClass {\n declare ccCommand: SecurityCommand;\n // Force singlecast for the Security CC\n declare nodeId: number;\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.Security, ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n message: \"Querying securely supported commands (S0)...\",\n direction: \"outbound\",\n });\n let supportedCCs: CommandClasses[] | undefined;\n let controlledCCs: CommandClasses[] | undefined;\n // Try up to 3 times on the root device. We REALLY don't want a spurious timeout or collision to cause us to discard a known good security class\n const MAX_ATTEMPTS = this.endpointIndex === 0 ? 3 : 1;\n for (let attempts = 1; attempts <= MAX_ATTEMPTS; attempts++) {\n const resp = await api.getSupportedCommands();\n if (resp) {\n supportedCCs = resp.supportedCCs;\n controlledCCs = resp.controlledCCs;\n break;\n }\n else if (attempts < MAX_ATTEMPTS) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Querying securely supported commands (S0), attempt ${attempts}/${MAX_ATTEMPTS} failed. Retrying in 500ms...`,\n level: \"warn\",\n });\n await wait(500);\n }\n }\n if (!supportedCCs || !controlledCCs) {\n if (node.hasSecurityClass(SecurityClass.S0_Legacy) === true) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying securely supported commands (S0) failed\",\n level: \"warn\",\n });\n // TODO: Abort interview?\n }\n else {\n // We didn't know if the node was secure and it didn't respond,\n // assume that it doesn't have the S0 security class\n ctx.logNode(node.id, `The node was not granted the S0 security class. Continuing interview non-securely.`);\n node.setSecurityClass(SecurityClass.S0_Legacy, false);\n }\n return;\n }\n ctx.logNode(node.id, {\n message: logText(\"received secure commands (S0)\", {\n nested: logDict({\n \"supported CCs\": logList(supportedCCs.map((cc) => getCCName(cc))),\n \"controlled CCs\": logList(controlledCCs.map((cc) => getCCName(cc))),\n }),\n }),\n direction: \"inbound\",\n });\n // Remember which commands are supported securely\n for (const cc of supportedCCs) {\n // Basic CC has special rules for when it is considered supported\n // Therefore we mark all other CCs as supported, but not Basic CC,\n // for which support is determined later.\n if (cc === CommandClasses.Basic) {\n endpoint.addCC(cc, { secure: true });\n }\n else {\n endpoint.addCC(cc, {\n isSupported: true,\n secure: true,\n });\n }\n }\n for (const cc of controlledCCs) {\n // Basic CC has special rules for when it is considered supported\n // Therefore we mark all other CCs as supported, but not Basic CC,\n // for which support is determined later.\n if (cc === CommandClasses.Basic) {\n endpoint.addCC(cc, { secure: true });\n }\n else {\n endpoint.addCC(cc, {\n isControlled: true,\n secure: true,\n });\n }\n }\n // We know for sure that the node is included securely\n if (node.hasSecurityClass(SecurityClass.S0_Legacy) !== true) {\n node.setSecurityClass(SecurityClass.S0_Legacy, true);\n ctx.logNode(node.id, `The node was granted the S0 security class`);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n /** Tests if a command should be sent secure and thus requires encapsulation */\n public static requiresEncapsulation(cc: CommandClass): boolean {\n // No security flag -> no encapsulation\n if (!(cc.encapsulationFlags & EncapsulationFlags.Security)) {\n return false;\n }\n // S2, CRC16, Transport Service -> no S2 encapsulation\n if (cc instanceof Security2CC\n || cc instanceof CRC16CC\n || cc instanceof TransportServiceCC) {\n return false;\n }\n // S0: check command\n if (cc instanceof SecurityCC) {\n switch (cc.ccCommand) {\n // Already encapsulated\n case SecurityCommand.CommandEncapsulation:\n case SecurityCommand.CommandEncapsulationNonceGet:\n // Cannot be sent encapsulated:\n case SecurityCommand.NonceGet:\n case SecurityCommand.NonceReport:\n case SecurityCommand.SchemeGet:\n case SecurityCommand.SchemeReport:\n return false;\n default:\n // All other commands must be encapsulated\n return true;\n }\n }\n // Everything else needs to be encapsulated if the CC is secure\n return true;\n }\n /** Encapsulates a command that should be sent encrypted */\n public static encapsulate(ownNodeId: number, securityManager: SecurityManager, cc: CommandClass): SecurityCCCommandEncapsulation {\n // TODO: When to return a SecurityCCCommandEncapsulationNonceGet?\n const ret = new SecurityCCCommandEncapsulation({\n nodeId: cc.nodeId,\n encapsulated: cc,\n });\n // Copy the encapsulation flags from the encapsulated command\n // but omit Security, since we're doing that right now\n ret.encapsulationFlags = cc.encapsulationFlags\n & ~EncapsulationFlags.Security;\n return ret;\n }\n}\ninterface SecurityCCNonceReportOptions {\n nonce: BytesView;\n}\n@CCCommand(SecurityCommand.NonceReport)\nexport class SecurityCCNonceReport extends SecurityCC {\n constructor(options: WithAddress<SecurityCCNonceReportOptions>) {\n super(options);\n if (options.nonce.length !== HALF_NONCE_SIZE) {\n throw new ZWaveError(`Nonce must have length ${HALF_NONCE_SIZE}!`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.nonce = options.nonce;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCNonceReport {\n validatePayload.withReason(\"Invalid nonce length\")(raw.payload.length === HALF_NONCE_SIZE);\n return new this({\n nodeId: ctx.sourceNodeId,\n nonce: raw.payload,\n });\n }\n public nonce: BytesView;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.view(this.nonce);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { nonce: buffer2hex(this.nonce) },\n };\n }\n}\n@CCCommand(SecurityCommand.NonceGet)\n@expectedCCResponse(SecurityCCNonceReport)\nexport class SecurityCCNonceGet extends SecurityCC {\n}\n// @publicAPI\nexport type SecurityCCCommandEncapsulationOptions = {\n alternativeNetworkKey?: BytesView;\n} & ({\n encapsulated: CommandClass;\n} | {\n decryptedCCBytes: BytesView;\n sequenced: boolean;\n secondFrame: boolean;\n sequenceCounter: number;\n});\nfunction getCCResponseForCommandEncapsulation(ctx: GetNode<NodeId & SupportsCC>, sent: SecurityCCCommandEncapsulation) {\n if (sent.encapsulated.expectsCCResponse(ctx)) {\n return SecurityCCCommandEncapsulation;\n }\n}\n@CCCommand(SecurityCommand.CommandEncapsulation)\n@expectedCCResponse(getCCResponseForCommandEncapsulation, () => \"checkEncapsulated\")\nexport class SecurityCCCommandEncapsulation extends SecurityCC {\n public constructor(options: WithAddress<SecurityCCCommandEncapsulationOptions>) {\n super(options);\n if (\"encapsulated\" in options) {\n this.encapsulated = options.encapsulated;\n this.encapsulated.encapsulatingCC = this as any;\n }\n else {\n this.decryptedCCBytes = options.decryptedCCBytes;\n this.sequenced = options.sequenced;\n this.secondFrame = options.secondFrame;\n this.sequenceCounter = options.sequenceCounter;\n }\n this.alternativeNetworkKey = options.alternativeNetworkKey;\n }\n public static async from(raw: CCRaw, ctx: CCParsingContext): Promise<SecurityCCCommandEncapsulation> {\n assertSecurityRX(ctx);\n // HALF_NONCE_SIZE bytes iv, 1 byte frame control, at least 1 CC byte, 1 byte nonce id, 8 bytes auth code\n validatePayload(raw.payload.length >= HALF_NONCE_SIZE + 1 + 1 + 1 + 8);\n const iv = raw.payload.subarray(0, HALF_NONCE_SIZE);\n const encryptedPayload = raw.payload.subarray(HALF_NONCE_SIZE, -9);\n const nonceId = raw.payload.at(-9)!;\n const authCode = raw.payload.subarray(-8);\n // Retrieve the used nonce from the nonce store\n const nonce = ctx.securityManager.getNonce(nonceId);\n // Only accept the message if the nonce hasn't expired\n if (!nonce) {\n validatePayload.fail(`Nonce ${num2hex(nonceId)} expired, cannot decode security encapsulated command.`);\n }\n // and mark the nonce as used\n ctx.securityManager.deleteNonce(nonceId);\n // Validate the encrypted data\n const authData = getAuthenticationData(iv, nonce, SecurityCommand.CommandEncapsulation, ctx.sourceNodeId, ctx.ownNodeId, encryptedPayload);\n const expectedAuthCode = await computeMAC(authData, await ctx.securityManager.getAuthKey());\n // Only accept messages with a correct auth code\n validatePayload.withReason(\"Invalid auth code, won't accept security encapsulated command.\")(authCode.equals(expectedAuthCode));\n // Decrypt the encapsulated CC\n const frameControlAndDecryptedCC = await decryptAES128OFB(encryptedPayload, await ctx.securityManager.getEncryptionKey(), Bytes.concat([iv, nonce]));\n const frameControl = frameControlAndDecryptedCC[0];\n const sequenceCounter = frameControl & 0b1111;\n const sequenced = !!(frameControl & 16);\n const secondFrame = !!(frameControl & 32);\n const decryptedCCBytes = frameControlAndDecryptedCC.subarray(1);\n const ret = new SecurityCCCommandEncapsulation({\n nodeId: ctx.sourceNodeId,\n sequenceCounter,\n sequenced,\n secondFrame,\n decryptedCCBytes,\n });\n ret.authData = authData;\n ret.authCode = authCode;\n ret.iv = iv;\n return ret;\n }\n private sequenced: boolean | undefined;\n private secondFrame: boolean | undefined;\n private sequenceCounter: number | undefined;\n private decryptedCCBytes: BytesView | undefined;\n public encapsulated!: CommandClass;\n private alternativeNetworkKey?: BytesView;\n public get nonceId(): number | undefined {\n return this.nonce?.[0];\n }\n public nonce: BytesView | undefined;\n // Only used testing/for debugging purposes\n private iv?: BytesView;\n private authData?: BytesView;\n private authCode?: BytesView;\n private ciphertext?: BytesView;\n public getPartialCCSessionId(): Record<string, any> | undefined {\n if (this.sequenced) {\n return {\n // Treat Encapsulation and EncapsulationNonceGet as one\n ccCommand: undefined,\n sequence: this.sequenceCounter,\n };\n }\n else {\n return {\n // Treat Encapsulation and EncapsulationNonceGet as one\n ccCommand: undefined,\n };\n }\n }\n public getRemainingSegments(): number | undefined {\n // Sequenced S0 commands are always split into exactly two frames\n if (!this.sequenced)\n return 0;\n return this.secondFrame ? 0 : 1;\n }\n public async mergePartialCCs(partials: SecurityCCCommandEncapsulation[], ctx: CCParsingContext): Promise<void> {\n // Concat the CC buffers\n this.decryptedCCBytes = Bytes.concat([...partials, this].map((cc) => cc.decryptedCCBytes!));\n // make sure this contains a complete CC command that's worth splitting\n validatePayload(this.decryptedCCBytes.length >= 2);\n // and deserialize the CC\n this.encapsulated = await CommandClass.parse(this.decryptedCCBytes, ctx);\n this.encapsulated.encapsulatingCC = this as any;\n }\n public async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (!this.nonce)\n throwNoNonce();\n if (this.nonce.length !== HALF_NONCE_SIZE) {\n throwNoNonce(\"Invalid nonce size\");\n }\n assertSecurityTX(ctx);\n let authKey: BytesView;\n let encryptionKey: BytesView;\n if (this.alternativeNetworkKey) {\n authKey = await generateAuthKey(this.alternativeNetworkKey);\n encryptionKey = await generateEncryptionKey(this.alternativeNetworkKey);\n }\n else {\n authKey = await ctx.securityManager.getAuthKey();\n encryptionKey = await ctx.securityManager.getEncryptionKey();\n }\n const serializedCC = await this.encapsulated.serialize(ctx);\n const plaintext = Bytes.concat([\n [0], // TODO: frame control\n serializedCC,\n ]);\n // Encrypt the payload\n const senderNonce = randomBytes(HALF_NONCE_SIZE);\n const iv = Bytes.concat([senderNonce, this.nonce]);\n const ciphertext = await encryptAES128OFB(plaintext, encryptionKey, iv);\n // And generate the auth code\n const authData = getAuthenticationData(senderNonce, this.nonce, this.ccCommand, ctx.ownNodeId, this.nodeId, ciphertext);\n const authCode = await computeMAC(authData, authKey);\n // Remember for debugging purposes\n this.iv = iv;\n this.authData = authData;\n this.authCode = authCode;\n this.ciphertext = ciphertext;\n this.payload = Bytes.concat([\n senderNonce,\n ciphertext,\n [this.nonceId!],\n authCode,\n ]);\n return super.serialize(ctx);\n }\n protected computeEncapsulationOverhead(): number {\n // Security CC adds 8 bytes IV, 1 byte frame control, 1 byte nonce ID, 8 bytes MAC\n return super.computeEncapsulationOverhead() + 18;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.nonceId != undefined) {\n message[\"nonce id\"] = this.nonceId;\n }\n if (this.sequenced != undefined) {\n message.sequenced = this.sequenced;\n if (this.sequenced) {\n if (this.secondFrame != undefined) {\n message[\"second frame\"] = this.secondFrame;\n }\n if (this.sequenceCounter != undefined) {\n message[\"sequence counter\"] = this.sequenceCounter;\n }\n }\n }\n // Log the plaintext in integration tests and development mode\n if (getenv(\"NODE_ENV\") === \"test\"\n || getenv(\"NODE_ENV\") === \"development\") {\n if (this.iv) {\n message.IV = buffer2hex(this.iv);\n }\n if (this.ciphertext) {\n message.ciphertext = buffer2hex(this.ciphertext);\n }\n else if (this.decryptedCCBytes) {\n message.plaintext = buffer2hex(this.decryptedCCBytes);\n }\n if (this.authData) {\n message[\"auth data\"] = buffer2hex(this.authData);\n }\n if (this.authCode) {\n message[\"auth code\"] = buffer2hex(this.authCode);\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// This is the same message, but with another CC command\n@CCCommand(SecurityCommand.CommandEncapsulationNonceGet)\nexport class SecurityCCCommandEncapsulationNonceGet extends SecurityCCCommandEncapsulation {\n}\n@CCCommand(SecurityCommand.SchemeReport)\nexport class SecurityCCSchemeReport extends SecurityCC {\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCSchemeReport {\n validatePayload(raw.payload.length >= 1);\n // The including controller MUST NOT perform any validation of the Supported Security Schemes byte\n return new this({\n nodeId: ctx.sourceNodeId,\n });\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Since it is unlikely that any more schemes will be added to S0, we hardcode the default scheme here (bit 0 = 0)\n this.payload = Bytes.from([0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n // Hide the default payload line\n message: undefined,\n };\n }\n}\n@CCCommand(SecurityCommand.SchemeGet)\n@expectedCCResponse(SecurityCCSchemeReport)\nexport class SecurityCCSchemeGet extends SecurityCC {\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCSchemeGet {\n validatePayload(raw.payload.length >= 1);\n // The joining node MUST NOT perform any validation of the Supported Security Schemes byte\n return new this({\n nodeId: ctx.sourceNodeId,\n });\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Since it is unlikely that any more schemes will be added to S0, we hardcode the default scheme here (bit 0 = 0)\n this.payload = Bytes.from([0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n // Hide the default payload line\n message: undefined,\n };\n }\n}\n@CCCommand(SecurityCommand.SchemeInherit)\n@expectedCCResponse(SecurityCCSchemeReport)\nexport class SecurityCCSchemeInherit extends SecurityCC {\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCSchemeInherit {\n validatePayload(raw.payload.length >= 1);\n // The joining node MUST NOT perform any validation of the Supported Security Schemes byte\n return new this({\n nodeId: ctx.sourceNodeId,\n });\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Since it is unlikely that any more schemes will be added to S0, we hardcode the default scheme here (bit 0 = 0)\n this.payload = Bytes.from([0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n // Hide the default payload line\n message: undefined,\n };\n }\n}\n@CCCommand(SecurityCommand.NetworkKeyVerify)\nexport class SecurityCCNetworkKeyVerify extends SecurityCC {\n}\n// @publicAPI\nexport interface SecurityCCNetworkKeySetOptions {\n networkKey: BytesView;\n}\n@CCCommand(SecurityCommand.NetworkKeySet)\n@expectedCCResponse(SecurityCCNetworkKeyVerify)\nexport class SecurityCCNetworkKeySet extends SecurityCC {\n public constructor(options: WithAddress<SecurityCCNetworkKeySetOptions>) {\n super(options);\n if (options.networkKey.length !== 16) {\n throw new ZWaveError(`The network key must have length 16!`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.networkKey = options.networkKey;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCNetworkKeySet {\n validatePayload(raw.payload.length >= 16);\n const networkKey: BytesView = raw.payload.subarray(0, 16);\n return new this({\n nodeId: ctx.sourceNodeId,\n networkKey,\n });\n }\n public networkKey: BytesView;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.view(this.networkKey);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n // The network key shouldn't be logged, so users can safely post their logs online\n const { message, ...log } = super.toLogEntry(ctx);\n return log;\n }\n}\n// @publicAPI\nexport interface SecurityCCCommandsSupportedReportOptions {\n reportsToFollow?: number;\n supportedCCs: CommandClasses[];\n controlledCCs: CommandClasses[];\n}\n@CCCommand(SecurityCommand.CommandsSupportedReport)\nexport class SecurityCCCommandsSupportedReport extends SecurityCC {\n public constructor(options: WithAddress<SecurityCCCommandsSupportedReportOptions>) {\n super(options);\n this.supportedCCs = options.supportedCCs;\n this.controlledCCs = options.controlledCCs;\n // TODO: properly split the CCs into multiple reports\n this.reportsToFollow = options.reportsToFollow ?? 0;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCCommandsSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const reportsToFollow = raw.payload[0];\n const list = parseCCList(raw.payload.subarray(1));\n const supportedCCs: CommandClasses[] = list.supportedCCs;\n const controlledCCs: CommandClasses[] = list.controlledCCs;\n return new this({\n nodeId: ctx.sourceNodeId,\n reportsToFollow,\n supportedCCs,\n controlledCCs,\n });\n }\n public reportsToFollow: number;\n public supportedCCs: CommandClasses[];\n public controlledCCs: CommandClasses[];\n public getPartialCCSessionId(): Record<string, any> | undefined {\n // Nothing special we can distinguish sessions with\n return {};\n }\n public getRemainingSegments(): number | undefined {\n return this.reportsToFollow;\n }\n public mergePartialCCs(partials: SecurityCCCommandsSupportedReport[]): Promise<void> {\n // Concat the lists of CCs\n this.supportedCCs = [...partials, this]\n .map((report) => report.supportedCCs)\n .reduce((prev, cur) => prev.concat(...cur), []);\n this.controlledCCs = [...partials, this]\n .map((report) => report.controlledCCs)\n .reduce((prev, cur) => prev.concat(...cur), []);\n return Promise.resolve();\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.reportsToFollow],\n encodeCCList(this.supportedCCs, this.controlledCCs),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n reportsToFollow: this.reportsToFollow,\n supportedCCs: logList(this.supportedCCs.map((cc) => getCCName(cc))),\n controlledCCs: logList(this.controlledCCs.map((cc) => getCCName(cc))),\n },\n };\n }\n}\n@CCCommand(SecurityCommand.CommandsSupportedGet)\n@expectedCCResponse(SecurityCCCommandsSupportedReport)\nexport class SecurityCCCommandsSupportedGet extends SecurityCC {\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;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AAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
4
+ "sourcesContent": ["import { CommandClasses, EncapsulationFlags, type GetNode, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, SecurityClass, type SecurityManager, type SupportsCC, TransmitOptions, type WithAddress, ZWaveError, ZWaveErrorCodes, computeMAC, decryptAES128OFB, encodeCCList, encryptAES128OFB, generateAuthKey, generateEncryptionKey, getCCName, isTransmissionError, logDict, logList, logText, parseCCList, randomBytes, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex, getenv, num2hex, pick, } from \"@zwave-js/shared\";\nimport { wait } from \"alcalzone-shared/async\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { SecurityCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { CRC16CC } from \"./CRC16CC.js\";\nimport { Security2CC } from \"./Security2CC.js\";\nimport { TransportServiceCC } from \"./TransportServiceCC.js\";\n// @noSetValueAPI This is an encapsulation CC\nfunction getAuthenticationData(senderNonce: BytesView, receiverNonce: BytesView, ccCommand: SecurityCommand, sendingNodeId: number, receivingNodeId: number, encryptedPayload: BytesView): BytesView {\n return Bytes.concat([\n senderNonce,\n receiverNonce,\n [\n ccCommand,\n sendingNodeId,\n receivingNodeId,\n encryptedPayload.length,\n ],\n encryptedPayload,\n ]);\n}\nfunction throwNoNonce(reason?: string): never {\n let message = `Security CC requires a nonce to be sent!`;\n if (reason)\n message += ` Reason: ${reason}`;\n throw new ZWaveError(message, ZWaveErrorCodes.SecurityCC_NoNonce);\n}\nconst HALF_NONCE_SIZE = 8;\nfunction assertSecurityRX(ctx: CCParsingContext): asserts ctx is CCParsingContext & {\n securityManager: SecurityManager;\n} {\n if (!ctx.ownNodeId) {\n throw new ZWaveError(`Secure commands (S0) can only be decoded when the controller's node id is known!`, ZWaveErrorCodes.Driver_NotReady);\n }\n if (!ctx.securityManager) {\n throw new ZWaveError(`Secure commands (S0) can only be decoded when the security manager is set up!`, ZWaveErrorCodes.Driver_NoSecurity);\n }\n}\nfunction assertSecurityTX(ctx: CCEncodingContext): asserts ctx is CCEncodingContext & {\n securityManager: SecurityManager;\n} {\n if (!ctx.ownNodeId) {\n throw new ZWaveError(`Secure commands (S0) can only be sent when the controller's node id is known!`, ZWaveErrorCodes.Driver_NotReady);\n }\n if (!ctx.securityManager) {\n throw new ZWaveError(`Secure commands (S0) can only be sent when the security manager is set up!`, ZWaveErrorCodes.Driver_NoSecurity);\n }\n}\n// TODO: Ignore commands if received via multicast\n// Encapsulation CCs are used internally and too frequently that we\n// want to pay the cost of validating each call\n/* eslint-disable @zwave-js/ccapi-validate-args */\n@API(CommandClasses.Security)\nexport class SecurityCCAPI extends PhysicalCCAPI {\n public supportsCommand(_cmd: SecurityCommand): MaybeNotKnown<boolean> {\n // All commands are mandatory\n return true;\n }\n public async sendEncapsulated(encapsulated: CommandClass, requestNextNonce: boolean = false): Promise<void> {\n if (requestNextNonce) {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.CommandEncapsulation);\n }\n else {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.CommandEncapsulationNonceGet);\n }\n const cc = new (requestNextNonce\n ? SecurityCCCommandEncapsulationNonceGet\n : SecurityCCCommandEncapsulation)({\n nodeId: this.endpoint.nodeId,\n encapsulated,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n /**\n * Requests a new nonce for Security CC encapsulation which is not directly linked to a specific command.\n */\n public async getNonce(): Promise<BytesView | undefined> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.NonceGet);\n const cc = new SecurityCCNonceGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<SecurityCCNonceReport>(cc, {\n ...this.commandOptions,\n // Only try getting a nonce once\n maxSendAttempts: 1,\n });\n if (!response)\n return;\n const nonce = response.nonce;\n const secMan = this.host.securityManager!;\n secMan.setNonce({\n issuer: this.endpoint.nodeId,\n nonceId: secMan.getNonceId(nonce),\n }, { nonce, receiver: this.host.ownNodeId }, { free: true });\n return nonce;\n }\n /**\n * Responds to a NonceGet request. The message is sent without any retransmission etc.\n * The return value indicates whether a nonce was successfully sent\n */\n public async sendNonce(): Promise<boolean> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.NonceReport);\n if (!this.host.securityManager) {\n throw new ZWaveError(`Nonces can only be sent if secure communication is set up!`, ZWaveErrorCodes.Driver_NoSecurity);\n }\n const nonce = this.host.securityManager.generateNonce(this.endpoint.nodeId, HALF_NONCE_SIZE);\n const nonceId = this.host.securityManager.getNonceId(nonce);\n const cc = new SecurityCCNonceReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n nonce,\n });\n try {\n await this.host.sendCommand(cc, {\n ...this.commandOptions,\n // Seems we need these options or some nodes won't accept the nonce\n transmitOptions: TransmitOptions.ACK\n | TransmitOptions.AutoRoute,\n // Only try sending a nonce once\n maxSendAttempts: 1,\n // Nonce requests must be handled immediately\n priority: MessagePriority.Immediate,\n // We don't want failures causing us to treat the node as asleep or dead\n changeNodeStatusOnMissingACK: false,\n });\n }\n catch (e) {\n if (isTransmissionError(e)) {\n // The nonce could not be sent, invalidate it\n this.host.securityManager.deleteNonce(nonceId);\n return false;\n }\n else {\n // Pass other errors through\n throw e;\n }\n }\n return true;\n }\n public async getSecurityScheme(): Promise<[\n 0\n ]> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.SchemeGet);\n const cc = new SecurityCCSchemeGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n // There is only one scheme, so we hardcode it\n return [0];\n }\n public async reportSecurityScheme(encapsulated: boolean): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.SchemeReport);\n let cc: CommandClass = new SecurityCCSchemeReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n if (encapsulated) {\n cc = new SecurityCCCommandEncapsulation({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n encapsulated: cc,\n });\n }\n await this.host.sendCommand(cc, this.commandOptions);\n }\n public async inheritSecurityScheme(): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.SchemeInherit);\n const cc = new SecurityCCSchemeInherit({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n // There is only one scheme, so we don't return anything here\n }\n public async setNetworkKey(networkKey: BytesView): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.NetworkKeySet);\n const keySet = new SecurityCCNetworkKeySet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n networkKey,\n });\n const cc = new SecurityCCCommandEncapsulation({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n encapsulated: keySet,\n alternativeNetworkKey: new Uint8Array(16).fill(0),\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n public async verifyNetworkKey(): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.NetworkKeyVerify);\n const cc = new SecurityCCNetworkKeyVerify({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupportedCommands() {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.CommandsSupportedGet);\n const cc = new SecurityCCCommandsSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<SecurityCCCommandsSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"supportedCCs\", \"controlledCCs\"]);\n }\n }\n public async reportSupportedCommands(supportedCCs: CommandClasses[], controlledCCs: CommandClasses[]): Promise<void> {\n this.assertSupportsCommand(SecurityCommand, SecurityCommand.CommandsSupportedReport);\n const cc = new SecurityCCCommandsSupportedReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n supportedCCs,\n controlledCCs,\n reportsToFollow: 0,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses.Security)\n@implementedVersion(1)\nexport class SecurityCC extends CommandClass {\n declare ccCommand: SecurityCommand;\n // Force singlecast for the Security CC\n declare nodeId: number;\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.Security, ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n message: \"Querying securely supported commands (S0)...\",\n direction: \"outbound\",\n });\n let supportedCCs: CommandClasses[] | undefined;\n let controlledCCs: CommandClasses[] | undefined;\n // Try up to 3 times on the root device. We REALLY don't want a spurious timeout or collision to cause us to discard a known good security class\n const MAX_ATTEMPTS = this.endpointIndex === 0 ? 3 : 1;\n for (let attempts = 1; attempts <= MAX_ATTEMPTS; attempts++) {\n const resp = await api.getSupportedCommands();\n if (resp) {\n supportedCCs = resp.supportedCCs;\n controlledCCs = resp.controlledCCs;\n break;\n }\n else if (attempts < MAX_ATTEMPTS) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Querying securely supported commands (S0), attempt ${attempts}/${MAX_ATTEMPTS} failed. Retrying in 500ms...`,\n level: \"warn\",\n });\n await wait(500);\n }\n }\n if (!supportedCCs || !controlledCCs) {\n if (node.hasSecurityClass(SecurityClass.S0_Legacy) === true) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying securely supported commands (S0) failed\",\n level: \"warn\",\n });\n // TODO: Abort interview?\n }\n else {\n // We didn't know if the node was secure and it didn't respond,\n // assume that it doesn't have the S0 security class\n ctx.logNode(node.id, `The node was not granted the S0 security class. Continuing interview non-securely.`);\n node.setSecurityClass(SecurityClass.S0_Legacy, false);\n }\n return;\n }\n ctx.logNode(node.id, {\n message: logText(\"received secure commands (S0)\", {\n nested: logDict({\n \"supported CCs\": logList(supportedCCs.map((cc) => getCCName(cc))),\n \"controlled CCs\": logList(controlledCCs.map((cc) => getCCName(cc))),\n }),\n }),\n direction: \"inbound\",\n });\n // Remember which commands are supported securely\n for (const cc of supportedCCs) {\n // Basic CC has special rules for when it is considered supported\n // Therefore we mark all other CCs as supported, but not Basic CC,\n // for which support is determined later.\n if (cc === CommandClasses.Basic) {\n endpoint.addCC(cc, { secure: true });\n }\n else {\n endpoint.addCC(cc, {\n isSupported: true,\n secure: true,\n });\n }\n }\n for (const cc of controlledCCs) {\n // Basic CC has special rules for when it is considered supported\n // Therefore we mark all other CCs as supported, but not Basic CC,\n // for which support is determined later.\n if (cc === CommandClasses.Basic) {\n endpoint.addCC(cc, { secure: true });\n }\n else {\n endpoint.addCC(cc, {\n isControlled: true,\n secure: true,\n });\n }\n }\n // We know for sure that the node is included securely\n if (node.hasSecurityClass(SecurityClass.S0_Legacy) !== true) {\n node.setSecurityClass(SecurityClass.S0_Legacy, true);\n ctx.logNode(node.id, `The node was granted the S0 security class`);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n /** Tests if a command should be sent secure and thus requires encapsulation */\n public static requiresEncapsulation(cc: CommandClass): boolean {\n // No security flag -> no encapsulation\n if (!(cc.encapsulationFlags & EncapsulationFlags.Security)) {\n return false;\n }\n // S2, CRC16, Transport Service -> no S2 encapsulation\n if (cc instanceof Security2CC\n || cc instanceof CRC16CC\n || cc instanceof TransportServiceCC) {\n return false;\n }\n // S0: check command\n if (cc instanceof SecurityCC) {\n switch (cc.ccCommand) {\n // Already encapsulated\n case SecurityCommand.CommandEncapsulation:\n case SecurityCommand.CommandEncapsulationNonceGet:\n // Cannot be sent encapsulated:\n case SecurityCommand.NonceGet:\n case SecurityCommand.NonceReport:\n case SecurityCommand.SchemeGet:\n case SecurityCommand.SchemeReport:\n return false;\n default:\n // All other commands must be encapsulated\n return true;\n }\n }\n // Everything else needs to be encapsulated if the CC is secure\n return true;\n }\n /** Encapsulates a command that should be sent encrypted */\n public static encapsulate(ownNodeId: number, securityManager: SecurityManager, cc: CommandClass): SecurityCCCommandEncapsulation {\n // TODO: When to return a SecurityCCCommandEncapsulationNonceGet?\n const ret = new SecurityCCCommandEncapsulation({\n nodeId: cc.nodeId,\n encapsulated: cc,\n });\n // Copy the encapsulation flags from the encapsulated command\n // but omit Security, since we're doing that right now\n ret.encapsulationFlags = cc.encapsulationFlags\n & ~EncapsulationFlags.Security;\n return ret;\n }\n}\ninterface SecurityCCNonceReportOptions {\n nonce: BytesView;\n}\n@CCCommand(SecurityCommand.NonceReport)\nexport class SecurityCCNonceReport extends SecurityCC {\n constructor(options: WithAddress<SecurityCCNonceReportOptions>) {\n super(options);\n if (options.nonce.length !== HALF_NONCE_SIZE) {\n throw new ZWaveError(`Nonce must have length ${HALF_NONCE_SIZE}!`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.nonce = options.nonce;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCNonceReport {\n validatePayload.withReason(\"Invalid nonce length\")(raw.payload.length === HALF_NONCE_SIZE);\n return new this({\n nodeId: ctx.sourceNodeId,\n nonce: raw.payload,\n });\n }\n public nonce: BytesView;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.view(this.nonce);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { nonce: buffer2hex(this.nonce) },\n };\n }\n}\n@CCCommand(SecurityCommand.NonceGet)\n@expectedCCResponse(SecurityCCNonceReport)\nexport class SecurityCCNonceGet extends SecurityCC {\n}\n// @publicAPI\nexport type SecurityCCCommandEncapsulationOptions = {\n alternativeNetworkKey?: BytesView;\n} & ({\n encapsulated: CommandClass;\n} | {\n decryptedCCBytes: BytesView;\n sequenced: boolean;\n secondFrame: boolean;\n sequenceCounter: number;\n});\nfunction getCCResponseForCommandEncapsulation(ctx: GetNode<NodeId & SupportsCC>, sent: SecurityCCCommandEncapsulation) {\n if (sent.encapsulated.expectsCCResponse(ctx)) {\n return SecurityCCCommandEncapsulation;\n }\n}\n@CCCommand(SecurityCommand.CommandEncapsulation)\n@expectedCCResponse(getCCResponseForCommandEncapsulation, () => \"checkEncapsulated\")\nexport class SecurityCCCommandEncapsulation extends SecurityCC {\n public constructor(options: WithAddress<SecurityCCCommandEncapsulationOptions>) {\n super(options);\n if (\"encapsulated\" in options) {\n this.encapsulated = options.encapsulated;\n this.encapsulated.encapsulatingCC = this as any;\n }\n else {\n this.decryptedCCBytes = options.decryptedCCBytes;\n this.sequenced = options.sequenced;\n this.secondFrame = options.secondFrame;\n this.sequenceCounter = options.sequenceCounter;\n }\n this.alternativeNetworkKey = options.alternativeNetworkKey;\n }\n public static async from(raw: CCRaw, ctx: CCParsingContext): Promise<SecurityCCCommandEncapsulation> {\n assertSecurityRX(ctx);\n // HALF_NONCE_SIZE bytes iv, 1 byte frame control, at least 1 CC byte, 1 byte nonce id, 8 bytes auth code\n validatePayload(raw.payload.length >= HALF_NONCE_SIZE + 1 + 1 + 1 + 8);\n const iv = raw.payload.subarray(0, HALF_NONCE_SIZE);\n const encryptedPayload = raw.payload.subarray(HALF_NONCE_SIZE, -9);\n const nonceId = raw.payload.at(-9)!;\n const authCode = raw.payload.subarray(-8);\n // Retrieve the used nonce from the nonce store\n const nonce = ctx.securityManager.getNonce(nonceId);\n // Only accept the message if the nonce hasn't expired\n if (!nonce) {\n validatePayload.fail(`Nonce ${num2hex(nonceId)} expired, cannot decode security encapsulated command.`);\n }\n // and mark the nonce as used\n ctx.securityManager.deleteNonce(nonceId);\n // Validate the encrypted data\n const authData = getAuthenticationData(iv, nonce, SecurityCommand.CommandEncapsulation, ctx.sourceNodeId, ctx.ownNodeId, encryptedPayload);\n const expectedAuthCode = await computeMAC(authData, await ctx.securityManager.getAuthKey());\n // Only accept messages with a correct auth code\n validatePayload.withReason(\"Invalid auth code, won't accept security encapsulated command.\")(authCode.equals(expectedAuthCode));\n // Decrypt the encapsulated CC\n const frameControlAndDecryptedCC = await decryptAES128OFB(encryptedPayload, await ctx.securityManager.getEncryptionKey(), Bytes.concat([iv, nonce]));\n const frameControl = frameControlAndDecryptedCC[0];\n const sequenceCounter = frameControl & 0b1111;\n const sequenced = !!(frameControl & 16);\n const secondFrame = !!(frameControl & 32);\n const decryptedCCBytes = frameControlAndDecryptedCC.subarray(1);\n const ret = new SecurityCCCommandEncapsulation({\n nodeId: ctx.sourceNodeId,\n sequenceCounter,\n sequenced,\n secondFrame,\n decryptedCCBytes,\n });\n ret.authData = authData;\n ret.authCode = authCode;\n ret.iv = iv;\n return ret;\n }\n private sequenced: boolean | undefined;\n private secondFrame: boolean | undefined;\n private sequenceCounter: number | undefined;\n public decryptedCCBytes: BytesView | undefined;\n public encapsulated!: CommandClass;\n private alternativeNetworkKey?: BytesView;\n public get nonceId(): number | undefined {\n return this.nonce?.[0];\n }\n public nonce: BytesView | undefined;\n // Only used testing/for debugging purposes\n private iv?: BytesView;\n private authData?: BytesView;\n private authCode?: BytesView;\n private ciphertext?: BytesView;\n public getPartialCCSessionId(): Record<string, any> | undefined {\n if (this.sequenced) {\n return {\n // Treat Encapsulation and EncapsulationNonceGet as one\n ccCommand: undefined,\n sequence: this.sequenceCounter,\n };\n }\n else {\n return {\n // Treat Encapsulation and EncapsulationNonceGet as one\n ccCommand: undefined,\n };\n }\n }\n public getRemainingSegments(): number | undefined {\n // Sequenced S0 commands are always split into exactly two frames\n if (!this.sequenced)\n return 0;\n return this.secondFrame ? 0 : 1;\n }\n public async mergePartialCCs(partials: SecurityCCCommandEncapsulation[], ctx: CCParsingContext): Promise<void> {\n // Concat the CC buffers\n this.decryptedCCBytes = Bytes.concat([...partials, this].map((cc) => cc.decryptedCCBytes!));\n // make sure this contains a complete CC command that's worth splitting\n validatePayload(this.decryptedCCBytes.length >= 2);\n // and deserialize the CC\n this.encapsulated = await CommandClass.parse(this.decryptedCCBytes, ctx);\n this.encapsulated.encapsulatingCC = this as any;\n }\n public async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (!this.nonce)\n throwNoNonce();\n if (this.nonce.length !== HALF_NONCE_SIZE) {\n throwNoNonce(\"Invalid nonce size\");\n }\n assertSecurityTX(ctx);\n let authKey: BytesView;\n let encryptionKey: BytesView;\n if (this.alternativeNetworkKey) {\n authKey = await generateAuthKey(this.alternativeNetworkKey);\n encryptionKey = await generateEncryptionKey(this.alternativeNetworkKey);\n }\n else {\n authKey = await ctx.securityManager.getAuthKey();\n encryptionKey = await ctx.securityManager.getEncryptionKey();\n }\n const serializedCC = await this.encapsulated.serialize(ctx);\n const plaintext = Bytes.concat([\n [0], // TODO: frame control\n serializedCC,\n ]);\n // Encrypt the payload\n const senderNonce = randomBytes(HALF_NONCE_SIZE);\n const iv = Bytes.concat([senderNonce, this.nonce]);\n const ciphertext = await encryptAES128OFB(plaintext, encryptionKey, iv);\n // And generate the auth code\n const authData = getAuthenticationData(senderNonce, this.nonce, this.ccCommand, ctx.ownNodeId, this.nodeId, ciphertext);\n const authCode = await computeMAC(authData, authKey);\n // Remember for debugging purposes\n this.iv = iv;\n this.authData = authData;\n this.authCode = authCode;\n this.ciphertext = ciphertext;\n this.payload = Bytes.concat([\n senderNonce,\n ciphertext,\n [this.nonceId!],\n authCode,\n ]);\n return super.serialize(ctx);\n }\n protected computeEncapsulationOverhead(): number {\n // Security CC adds 8 bytes IV, 1 byte frame control, 1 byte nonce ID, 8 bytes MAC\n return super.computeEncapsulationOverhead() + 18;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.nonceId != undefined) {\n message[\"nonce id\"] = this.nonceId;\n }\n if (this.sequenced != undefined) {\n message.sequenced = this.sequenced;\n if (this.sequenced) {\n if (this.secondFrame != undefined) {\n message[\"second frame\"] = this.secondFrame;\n }\n if (this.sequenceCounter != undefined) {\n message[\"sequence counter\"] = this.sequenceCounter;\n }\n }\n }\n // Log the plaintext in integration tests and development mode\n if (getenv(\"NODE_ENV\") === \"test\"\n || getenv(\"NODE_ENV\") === \"development\") {\n if (this.iv) {\n message.IV = buffer2hex(this.iv);\n }\n if (this.ciphertext) {\n message.ciphertext = buffer2hex(this.ciphertext);\n }\n else if (this.decryptedCCBytes) {\n message.plaintext = buffer2hex(this.decryptedCCBytes);\n }\n if (this.authData) {\n message[\"auth data\"] = buffer2hex(this.authData);\n }\n if (this.authCode) {\n message[\"auth code\"] = buffer2hex(this.authCode);\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// This is the same message, but with another CC command\n@CCCommand(SecurityCommand.CommandEncapsulationNonceGet)\nexport class SecurityCCCommandEncapsulationNonceGet extends SecurityCCCommandEncapsulation {\n}\n@CCCommand(SecurityCommand.SchemeReport)\nexport class SecurityCCSchemeReport extends SecurityCC {\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCSchemeReport {\n validatePayload(raw.payload.length >= 1);\n // The including controller MUST NOT perform any validation of the Supported Security Schemes byte\n return new this({\n nodeId: ctx.sourceNodeId,\n });\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Since it is unlikely that any more schemes will be added to S0, we hardcode the default scheme here (bit 0 = 0)\n this.payload = Bytes.from([0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n // Hide the default payload line\n message: undefined,\n };\n }\n}\n@CCCommand(SecurityCommand.SchemeGet)\n@expectedCCResponse(SecurityCCSchemeReport)\nexport class SecurityCCSchemeGet extends SecurityCC {\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCSchemeGet {\n validatePayload(raw.payload.length >= 1);\n // The joining node MUST NOT perform any validation of the Supported Security Schemes byte\n return new this({\n nodeId: ctx.sourceNodeId,\n });\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Since it is unlikely that any more schemes will be added to S0, we hardcode the default scheme here (bit 0 = 0)\n this.payload = Bytes.from([0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n // Hide the default payload line\n message: undefined,\n };\n }\n}\n@CCCommand(SecurityCommand.SchemeInherit)\n@expectedCCResponse(SecurityCCSchemeReport)\nexport class SecurityCCSchemeInherit extends SecurityCC {\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCSchemeInherit {\n validatePayload(raw.payload.length >= 1);\n // The joining node MUST NOT perform any validation of the Supported Security Schemes byte\n return new this({\n nodeId: ctx.sourceNodeId,\n });\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Since it is unlikely that any more schemes will be added to S0, we hardcode the default scheme here (bit 0 = 0)\n this.payload = Bytes.from([0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n // Hide the default payload line\n message: undefined,\n };\n }\n}\n@CCCommand(SecurityCommand.NetworkKeyVerify)\nexport class SecurityCCNetworkKeyVerify extends SecurityCC {\n}\n// @publicAPI\nexport interface SecurityCCNetworkKeySetOptions {\n networkKey: BytesView;\n}\n@CCCommand(SecurityCommand.NetworkKeySet)\n@expectedCCResponse(SecurityCCNetworkKeyVerify)\nexport class SecurityCCNetworkKeySet extends SecurityCC {\n public constructor(options: WithAddress<SecurityCCNetworkKeySetOptions>) {\n super(options);\n if (options.networkKey.length !== 16) {\n throw new ZWaveError(`The network key must have length 16!`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.networkKey = options.networkKey;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCNetworkKeySet {\n validatePayload(raw.payload.length >= 16);\n const networkKey: BytesView = raw.payload.subarray(0, 16);\n return new this({\n nodeId: ctx.sourceNodeId,\n networkKey,\n });\n }\n public networkKey: BytesView;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.view(this.networkKey);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n // The network key shouldn't be logged, so users can safely post their logs online\n const { message, ...log } = super.toLogEntry(ctx);\n return log;\n }\n}\n// @publicAPI\nexport interface SecurityCCCommandsSupportedReportOptions {\n reportsToFollow?: number;\n supportedCCs: CommandClasses[];\n controlledCCs: CommandClasses[];\n}\n@CCCommand(SecurityCommand.CommandsSupportedReport)\nexport class SecurityCCCommandsSupportedReport extends SecurityCC {\n public constructor(options: WithAddress<SecurityCCCommandsSupportedReportOptions>) {\n super(options);\n this.supportedCCs = options.supportedCCs;\n this.controlledCCs = options.controlledCCs;\n // TODO: properly split the CCs into multiple reports\n this.reportsToFollow = options.reportsToFollow ?? 0;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SecurityCCCommandsSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const reportsToFollow = raw.payload[0];\n const list = parseCCList(raw.payload.subarray(1));\n const supportedCCs: CommandClasses[] = list.supportedCCs;\n const controlledCCs: CommandClasses[] = list.controlledCCs;\n return new this({\n nodeId: ctx.sourceNodeId,\n reportsToFollow,\n supportedCCs,\n controlledCCs,\n });\n }\n public reportsToFollow: number;\n public supportedCCs: CommandClasses[];\n public controlledCCs: CommandClasses[];\n public getPartialCCSessionId(): Record<string, any> | undefined {\n // Nothing special we can distinguish sessions with\n return {};\n }\n public getRemainingSegments(): number | undefined {\n return this.reportsToFollow;\n }\n public mergePartialCCs(partials: SecurityCCCommandsSupportedReport[]): Promise<void> {\n // Concat the lists of CCs\n this.supportedCCs = [...partials, this]\n .map((report) => report.supportedCCs)\n .reduce((prev, cur) => prev.concat(...cur), []);\n this.controlledCCs = [...partials, this]\n .map((report) => report.controlledCCs)\n .reduce((prev, cur) => prev.concat(...cur), []);\n return Promise.resolve();\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.reportsToFollow],\n encodeCCList(this.supportedCCs, this.controlledCCs),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n reportsToFollow: this.reportsToFollow,\n supportedCCs: logList(this.supportedCCs.map((cc) => getCCName(cc))),\n controlledCCs: logList(this.controlledCCs.map((cc) => getCCName(cc))),\n },\n };\n }\n}\n@CCCommand(SecurityCommand.CommandsSupportedGet)\n@expectedCCResponse(SecurityCCCommandsSupportedReport)\nexport class SecurityCCCommandsSupportedGet extends SecurityCC {\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAqf;AACrf,oBAA0E;AAC1E,mBAAqB;AACrB,iBAAqC;AACrC,0BAAiE;AACjE,oCAAsF;AACtF,mBAAgC;AAEhC,qBAAwB;AACxB,yBAA4B;AAC5B,gCAAmC;AAEnC,SAAS,sBAAsB,aAAwB,eAA0B,WAA4B,eAAuB,iBAAyB,kBAA2B;AACpL,SAAO,oBAAM,OAAO;IAChB;IACA;IACA;MACI;MACA;MACA;MACA,iBAAiB;;IAErB;GACH;AACL;AAZS;AAaT,SAAS,aAAa,QAAe;AACjC,MAAI,UAAU;AACd,MAAI;AACA,eAAW,YAAY,MAAM;AACjC,QAAM,IAAI,uBAAW,SAAS,4BAAgB,kBAAkB;AACpE;AALS;AAMT,MAAM,kBAAkB;AACxB,SAAS,iBAAiB,KAAqB;AAG3C,MAAI,CAAC,IAAI,WAAW;AAChB,UAAM,IAAI,uBAAW,oFAAoF,4BAAgB,e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AAG,GAAG,CAAA,CAAE;AAClD,aAAO,QAAQ,QAAO;IAC1B;IACO,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,OAAO;QACxB,CAAC,KAAK,eAAe;YACrB,0BAAa,KAAK,cAAc,KAAK,aAAa;OACrD;AACD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,iBAAiB,KAAK;UACtB,kBAAc,qBAAQ,KAAK,aAAa,IAAI,CAAC,WAAO,uBAAU,EAAE,CAAC,CAAC;UAClE,mBAAe,qBAAQ,KAAK,cAAc,IAAI,CAAC,WAAO,uBAAU,EAAE,CAAC,CAAC;;;IAGhF;;;;IAIS,kCAA8B,MAAA;8BAF1C,yCAAU,6BAAgB,oBAAoB,OAC9C,kDAAmB,iCAAiC,CAAC;;;;oBACF;sDAAA,YAAU;WAAA;;;;;;;;AAA9D,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
6
6
  "names": ["SecurityCC", "SecurityCCCommandEncapsulation"]
7
7
  }
@@ -1309,6 +1309,8 @@ let UserCodeCCKeypadModeReport = (() => {
1309
1309
  persistValues(ctx) {
1310
1310
  if (!super.persistValues(ctx))
1311
1311
  return false;
1312
+ if ((0, import_CommandClass.getEffectiveCCVersion)(ctx, this) < 2)
1313
+ return true;
1312
1314
  const supportedKeypadModes = this.getValue(ctx, import_CCValues_generated.UserCodeCCValues.supportedKeypadModes) ?? [this.keypadMode];
1313
1315
  const keypadModeValue = import_CCValues_generated.UserCodeCCValues.keypadMode;
1314
1316
  this.setMetadata(ctx, keypadModeValue, {