@zwave-js/cc 15.31.2 → 15.32.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 (104) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js +2 -3
  2. package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
  3. package/build/cjs/cc/AssociationGroupInfoCC.js +5 -2
  4. package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
  5. package/build/cjs/cc/ColorSwitchCC.js +2 -3
  6. package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
  7. package/build/cjs/cc/ConfigurationCC.d.ts +2 -0
  8. package/build/cjs/cc/ConfigurationCC.js +28 -8
  9. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  10. package/build/cjs/cc/EntryControlCC.js +3 -2
  11. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  12. package/build/cjs/cc/IndicatorCC.js +3 -3
  13. package/build/cjs/cc/IndicatorCC.js.map +2 -2
  14. package/build/cjs/cc/IrrigationCC.js.map +1 -1
  15. package/build/cjs/cc/LanguageCC.js +6 -2
  16. package/build/cjs/cc/LanguageCC.js.map +2 -2
  17. package/build/cjs/cc/ManufacturerSpecificCC.js +1 -1
  18. package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
  19. package/build/cjs/cc/MeterCC.js +25 -4
  20. package/build/cjs/cc/MeterCC.js.map +2 -2
  21. package/build/cjs/cc/NodeNamingCC.js +2 -2
  22. package/build/cjs/cc/NodeNamingCC.js.map +2 -2
  23. package/build/cjs/cc/NotificationCC.js +10 -11
  24. package/build/cjs/cc/NotificationCC.js.map +2 -2
  25. package/build/cjs/cc/Security2CC.js +11 -6
  26. package/build/cjs/cc/Security2CC.js.map +2 -2
  27. package/build/cjs/cc/SecurityCC.js +2 -1
  28. package/build/cjs/cc/SecurityCC.js.map +2 -2
  29. package/build/cjs/cc/SoundSwitchCC.js +1 -1
  30. package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
  31. package/build/cjs/cc/ThermostatSetpointCC.js +2 -1
  32. package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
  33. package/build/cjs/cc/UserCredentialCC.d.ts +6 -0
  34. package/build/cjs/cc/UserCredentialCC.js +81 -6
  35. package/build/cjs/cc/UserCredentialCC.js.map +2 -2
  36. package/build/cjs/lib/Security2/Extension.js +2 -1
  37. package/build/cjs/lib/Security2/Extension.js.map +2 -2
  38. package/build/cjs/lib/securityLogging.d.ts +6 -0
  39. package/build/cjs/lib/securityLogging.js +34 -0
  40. package/build/cjs/lib/securityLogging.js.map +7 -0
  41. package/build/cjs/lib/serializers.js +3 -0
  42. package/build/cjs/lib/serializers.js.map +2 -2
  43. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  44. package/build/esm/cc/AlarmSensorCC.js +5 -3
  45. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  46. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  47. package/build/esm/cc/AssociationGroupInfoCC.js +10 -6
  48. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  49. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  50. package/build/esm/cc/ColorSwitchCC.js +2 -4
  51. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  52. package/build/esm/cc/ConfigurationCC.d.ts +2 -0
  53. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  54. package/build/esm/cc/ConfigurationCC.js +34 -13
  55. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  56. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  57. package/build/esm/cc/EntryControlCC.js +4 -3
  58. package/build/esm/cc/EntryControlCC.js.map +1 -1
  59. package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
  60. package/build/esm/cc/IndicatorCC.js +4 -6
  61. package/build/esm/cc/IndicatorCC.js.map +1 -1
  62. package/build/esm/cc/IrrigationCC.js.map +1 -1
  63. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  64. package/build/esm/cc/LanguageCC.js +8 -3
  65. package/build/esm/cc/LanguageCC.js.map +1 -1
  66. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  67. package/build/esm/cc/ManufacturerSpecificCC.js +2 -2
  68. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  69. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  70. package/build/esm/cc/MeterCC.js +27 -5
  71. package/build/esm/cc/MeterCC.js.map +1 -1
  72. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  73. package/build/esm/cc/NodeNamingCC.js +3 -3
  74. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  75. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  76. package/build/esm/cc/NotificationCC.js +22 -24
  77. package/build/esm/cc/NotificationCC.js.map +1 -1
  78. package/build/esm/cc/Security2CC.d.ts.map +1 -1
  79. package/build/esm/cc/Security2CC.js +21 -10
  80. package/build/esm/cc/Security2CC.js.map +1 -1
  81. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  82. package/build/esm/cc/SecurityCC.js +4 -4
  83. package/build/esm/cc/SecurityCC.js.map +1 -1
  84. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  85. package/build/esm/cc/SoundSwitchCC.js +2 -2
  86. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  87. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  88. package/build/esm/cc/ThermostatSetpointCC.js +5 -1
  89. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  90. package/build/esm/cc/UserCredentialCC.d.ts +6 -0
  91. package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
  92. package/build/esm/cc/UserCredentialCC.js +103 -13
  93. package/build/esm/cc/UserCredentialCC.js.map +1 -1
  94. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  95. package/build/esm/lib/Security2/Extension.js +3 -3
  96. package/build/esm/lib/Security2/Extension.js.map +1 -1
  97. package/build/esm/lib/securityLogging.d.ts +6 -0
  98. package/build/esm/lib/securityLogging.d.ts.map +1 -0
  99. package/build/esm/lib/securityLogging.js +10 -0
  100. package/build/esm/lib/securityLogging.js.map +1 -0
  101. package/build/esm/lib/serializers.d.ts.map +1 -1
  102. package/build/esm/lib/serializers.js +4 -0
  103. package/build/esm/lib/serializers.js.map +1 -1
  104. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/ThermostatSetpointCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./ThermostatSetpointCC._validateArgs.js\";\nconst { validateArgs_ThermostatSetpointCCAPI_get, validateArgs_ThermostatSetpointCCAPI_set, validateArgs_ThermostatSetpointCCAPI_getCapabilities } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type Scale, type SupervisionResult, ValueMetadata, type ValueMetadataNumeric, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, encodeFloatWithScale, getNamedScale, getUnknownScale, logList, logText, parseBitMask, parseFloatWithScale, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, CommandRelation, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatSetpointCommand, ThermostatSetpointType, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\n// This array is used to map the advertised supported types (interpretation A)\n// to the actual enum values\nconst thermostatSetpointTypeMap = [\n 0x00, 0x01, 0x02, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n];\nfunction getScale(scale: number): Scale {\n return getNamedScale(\"temperature\", scale as any) ?? getUnknownScale(scale);\n}\nfunction getSetpointUnit(scale: number): string {\n return getScale(scale).unit ?? \"\";\n}\nimport { ThermostatSetpointCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatSetpointCCValues };\n@API(CommandClasses[\"Thermostat Setpoint\"])\nexport class ThermostatSetpointCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatSetpointCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatSetpointCommand.Get:\n case ThermostatSetpointCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatSetpointCommand.Set:\n return true; // This is mandatory\n case ThermostatSetpointCommand.CapabilitiesGet:\n return this.version >= 3 && this.isSinglecast();\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatSetpointCCAPI, { property, propertyKey }, value) {\n if (property !== \"setpoint\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof propertyKey !== \"number\") {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);\n }\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // SDS14223: The Scale field value MUST be identical to the value received in the Thermostat Setpoint Report for the\n // actual Setpoint Type during the node interview. Fall back to the first scale if none is known\n const preferredScale = this.tryGetValueDB()?.getValue<number>(ThermostatSetpointCCValues.setpointScale(propertyKey).endpoint(this.endpoint.index));\n const result = await this.set(propertyKey, value, preferredScale ?? 0);\n // Verify the current value after a delay, unless the command was supervised and successful\n if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {\n // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600\n // aren't able to handle the GET this quickly.\n this.schedulePoll({ property, propertyKey }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatSetpointCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"setpoint\":\n if (typeof propertyKey !== \"number\") {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);\n }\n return (await this.get(propertyKey))?.value;\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_ThermostatSetpointCCAPI_get()\n public async get(setpointType: ThermostatSetpointType): Promise<{\n value: number;\n scale: Scale;\n } | undefined> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Get);\n const cc = new ThermostatSetpointCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCReport>(cc, this.commandOptions);\n if (!response)\n return;\n if (response.type !== ThermostatSetpointType[\"N/A\"]) {\n // This is a supported setpoint\n const scale = getScale(response.scale);\n return {\n value: response.value,\n scale,\n };\n }\n }\n @validateArgs_ThermostatSetpointCCAPI_set()\n public async set(setpointType: ThermostatSetpointType, value: number, scale: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Set);\n const cc = new ThermostatSetpointCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n value,\n scale,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_ThermostatSetpointCCAPI_getCapabilities()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getCapabilities(setpointType: ThermostatSetpointType) {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.CapabilitiesGet);\n const cc = new ThermostatSetpointCCCapabilitiesGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCCapabilitiesReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"minValue\",\n \"maxValue\",\n \"minValueScale\",\n \"maxValueScale\",\n ]);\n }\n }\n /**\n * Requests the supported setpoint types from the node. Due to inconsistencies it is NOT recommended\n * to use this method on nodes with CC versions 1 and 2. Instead rely on the information determined\n * during node interview.\n */\n public async getSupportedSetpointTypes(): Promise<MaybeNotKnown<readonly ThermostatSetpointType[]>> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.SupportedGet);\n const cc = new ThermostatSetpointCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedSetpointTypes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Setpoint\"])\n@implementedVersion(3)\n@ccValues(ThermostatSetpointCCValues)\nexport class ThermostatSetpointCC extends CommandClass {\n declare ccCommand: ThermostatSetpointCommand;\n public translatePropertyKey(ctx: GetValueDB, property: string | number, propertyKey: string | number): string | undefined {\n if (property === \"setpoint\") {\n return getEnumMemberName(ThermostatSetpointType, propertyKey as any);\n }\n else {\n return super.translatePropertyKey(ctx, property, propertyKey);\n }\n }\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[\"Thermostat Setpoint\"], 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 if (api.version <= 2) {\n // It has been found that early implementations of this Command Class applied two non-interoperable\n // interpretations of the bit mask advertising the support for specific Setpoint Types in the Thermostat\n // Setpoint Supported Report Command.\n // A controlling node SHOULD determine the supported Setpoint Types of a version 1 and version 2\n // supporting node by sending one Thermostat Setpoint Get Command at a time while incrementing\n // the requested Setpoint Type.\n // If the same Setpoint Type is advertised in the returned Thermostat Setpoint Report Command, the\n // controlling node MUST conclude that the actual Setpoint Type is supported.\n // If the Setpoint Type 0x00 (type N/A) is advertised in the returned Thermostat Setpoint Report\n // Command, the controlling node MUST conclude that the actual Setpoint Type is not supported.\n // The specs require us to query the list of supported setpoint types anyways, even if the response is ignored\n await api.getSupportedSetpointTypes();\n // Now scan all endpoints. Each type we received a value for gets marked as supported\n const supportedSetpointTypes: ThermostatSetpointType[] = [];\n for (let type: ThermostatSetpointType = ThermostatSetpointType.Heating; type <= ThermostatSetpointType[\"Full Power\"]; type++) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Every time, query the current value\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value of setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpoint = await api.get(type);\n // If the node did not respond, assume the setpoint type is not supported\n let logMessage: string;\n if (setpoint) {\n // Setpoint supported, remember the type\n supportedSetpointTypes.push(type);\n logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? \"\"}`;\n }\n else {\n // We're sure about the interpretation - this should not happen\n logMessage = `setpoint ${setpointName} is not supported`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n node.reportInterviewProgress(type - ThermostatSetpointType.Heating + 1, ThermostatSetpointType[\"Full Power\"]\n - ThermostatSetpointType.Heating\n + 1);\n }\n // Remember which setpoint types are actually supported\n this.setValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes, supportedSetpointTypes);\n }\n else {\n // Versions >= 3 adhere to bitmap interpretation A, so we can rely on getSupportedSetpointTypes\n // Query the supported setpoint types\n let setpointTypes: ThermostatSetpointType[] = [];\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"retrieving supported setpoint types...\",\n direction: \"outbound\",\n });\n const resp = await api.getSupportedSetpointTypes();\n if (resp) {\n setpointTypes = [...resp];\n const logMessage = logText(\"received supported setpoint types:\", {\n nested: logList(setpointTypes.map((type) => getEnumMemberName(ThermostatSetpointType, type))),\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported setpoint types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n for (const [i, type] of setpointTypes.entries()) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Find out the capabilities of this setpoint\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `retrieving capabilities for setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpointCaps = await api.getCapabilities(type);\n if (setpointCaps) {\n const minValueUnit = getSetpointUnit(setpointCaps.minValueScale);\n const maxValueUnit = getSetpointUnit(setpointCaps.maxValueScale);\n const logMessage = `received capabilities for setpoint ${setpointName}:\nminimum value: ${setpointCaps.minValue} ${minValueUnit}\nmaximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n node.reportInterviewProgress(i + 1, setpointTypes.length);\n }\n // Query the current value for all setpoint types\n await this.refreshValues(ctx, {\n tag: \"interview\",\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n }\n // Remember that the interview is complete\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[\"Thermostat Setpoint\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n const setpointTypes: ThermostatSetpointType[] = this.getValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes) ?? [];\n // Query each setpoint's current value\n for (const [i, type] of setpointTypes.entries()) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Every time, query the current value\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value of setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpoint = await api.get(type);\n if (setpoint) {\n const logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? \"\"}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n options?.onProgress?.(i + 1, setpointTypes.length);\n }\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCSetOptions {\n setpointType: ThermostatSetpointType;\n value: number;\n scale: number;\n}\n@CCCommand(ThermostatSetpointCommand.Set)\n@useSupervision()\nexport class ThermostatSetpointCCSet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCSetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n this.value = options.value;\n this.scale = options.scale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCSet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n // parseFloatWithScale does its own validation\n const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n value,\n scale,\n });\n }\n public setpointType: ThermostatSetpointType;\n public value: number;\n public scale: number;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof ThermostatSetpointCCSet\n && this.setpointType === other.setpointType) {\n return this.value === other.value && this.scale === other.scale\n ? CommandRelation.Redundant\n : CommandRelation.Supersedes;\n }\n return CommandRelation.Unrelated;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // If a config file overwrites how the float should be encoded, use that information\n const override = ctx.getDeviceConfig?.(this.nodeId as number)?.compat\n ?.overrideFloatEncoding;\n this.payload = Bytes.concat([\n [this.setpointType & 0b1111],\n encodeFloatWithScale(this.value, this.scale, override),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const scale = getScale(this.scale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n value: `${this.value} ${scale.unit}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCReportOptions {\n type: ThermostatSetpointType;\n value: number;\n scale: number;\n}\n@CCCommand(ThermostatSetpointCommand.Report)\nexport class ThermostatSetpointCCReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCReportOptions>) {\n super(options);\n this.type = options.type;\n this.value = options.value;\n this.scale = options.scale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCReport {\n validatePayload(raw.payload.length >= 1);\n const type: ThermostatSetpointType = raw.payload[0] & 0b1111;\n if (type === 0) {\n // Not supported\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n value: 0,\n scale: 0,\n });\n }\n // parseFloatWithScale does its own validation\n const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n value,\n scale,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const scale = getScale(this.scale);\n const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);\n const existingMetadata = this.getMetadata<ValueMetadataNumeric>(ctx, setpointValue);\n // Update the metadata when it is missing or the unit has changed\n if (existingMetadata?.unit !== scale.unit) {\n this.setMetadata(ctx, setpointValue, {\n ...(existingMetadata ?? setpointValue.meta),\n unit: scale.unit,\n });\n }\n this.setValue(ctx, setpointValue, this.value);\n // Remember the device-preferred setpoint scale so it can be used in SET commands\n this.setValue(ctx, ThermostatSetpointCCValues.setpointScale(this.type), scale.key);\n return true;\n }\n public type: ThermostatSetpointType;\n public scale: number;\n public value: number;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof ThermostatSetpointCCReport\n && this.type === other.type) {\n return this.value === other.value && this.scale === other.scale\n ? CommandRelation.Redundant\n : CommandRelation.Supersedes;\n }\n return CommandRelation.Unrelated;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.type & 0b1111],\n encodeFloatWithScale(this.value, this.scale),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const scale = getScale(this.scale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.type),\n value: `${this.value} ${scale.unit}`,\n },\n };\n }\n}\nfunction testResponseForThermostatSetpointGet(sent: ThermostatSetpointCCGet, received: ThermostatSetpointCCReport) {\n // We expect a Thermostat Setpoint Report that matches the requested setpoint type\n return received.type === sent.setpointType;\n}\n// @publicAPI\nexport interface ThermostatSetpointCCGetOptions {\n setpointType: ThermostatSetpointType;\n}\n@CCCommand(ThermostatSetpointCommand.Get)\n@expectedCCResponse(ThermostatSetpointCCReport, testResponseForThermostatSetpointGet)\nexport class ThermostatSetpointCCGet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCGetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCGet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n });\n }\n public setpointType: ThermostatSetpointType;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof ThermostatSetpointCCGet\n && this.setpointType === other.setpointType) {\n return CommandRelation.Redundant;\n }\n return CommandRelation.Unrelated;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.setpointType & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCCapabilitiesReportOptions {\n type: ThermostatSetpointType;\n minValue: number;\n minValueScale: number;\n maxValue: number;\n maxValueScale: number;\n}\n@CCCommand(ThermostatSetpointCommand.CapabilitiesReport)\nexport class ThermostatSetpointCCCapabilitiesReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCCapabilitiesReportOptions>) {\n super(options);\n this.type = options.type;\n this.minValue = options.minValue;\n this.minValueScale = options.minValueScale;\n this.maxValue = options.maxValue;\n this.maxValueScale = options.maxValueScale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCCapabilitiesReport {\n validatePayload(raw.payload.length >= 1);\n const type: ThermostatSetpointType = raw.payload[0];\n // parseFloatWithScale does its own validation\n const { value: minValue, scale: minValueScale, bytesRead, } = parseFloatWithScale(raw.payload.subarray(1));\n const { value: maxValue, scale: maxValueScale } = parseFloatWithScale(raw.payload.subarray(1 + bytesRead));\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n minValue,\n minValueScale,\n maxValue,\n maxValueScale,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Predefine the metadata\n const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);\n this.setMetadata(ctx, setpointValue, {\n ...setpointValue.meta,\n min: this.minValue,\n max: this.maxValue,\n unit: getSetpointUnit(this.minValueScale)\n || getSetpointUnit(this.maxValueScale),\n });\n return true;\n }\n public type: ThermostatSetpointType;\n public minValue: number;\n public maxValue: number;\n public minValueScale: number;\n public maxValueScale: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const min = encodeFloatWithScale(this.minValue, this.minValueScale);\n const max = encodeFloatWithScale(this.maxValue, this.maxValueScale);\n this.payload = Bytes.concat([[this.type], min, max]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const minValueScale = getScale(this.minValueScale);\n const maxValueScale = getScale(this.maxValueScale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.type),\n \"min value\": `${this.minValue} ${minValueScale.unit}`,\n \"max value\": `${this.maxValue} ${maxValueScale.unit}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCCapabilitiesGetOptions {\n setpointType: ThermostatSetpointType;\n}\n@CCCommand(ThermostatSetpointCommand.CapabilitiesGet)\n@expectedCCResponse(ThermostatSetpointCCCapabilitiesReport)\nexport class ThermostatSetpointCCCapabilitiesGet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCCapabilitiesGetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCCapabilitiesGet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n });\n }\n public setpointType: ThermostatSetpointType;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.setpointType & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCSupportedReportOptions {\n supportedSetpointTypes: ThermostatSetpointType[];\n}\n@CCCommand(ThermostatSetpointCommand.SupportedReport)\n@ccValueProperty(\"supportedSetpointTypes\", ThermostatSetpointCCValues.supportedSetpointTypes)\nexport class ThermostatSetpointCCSupportedReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCSupportedReportOptions>) {\n super(options);\n if (options.supportedSetpointTypes.length === 0) {\n throw new ZWaveError(`At least one setpoint type must be supported`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.supportedSetpointTypes = options.supportedSetpointTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const bitMask = raw.payload;\n const supported = parseBitMask(bitMask, ThermostatSetpointType[\"N/A\"]);\n // We use this command only when we are sure that bitmask interpretation A is used\n // FIXME: Figure out if we can do this without the CC version\n const supportedSetpointTypes: ThermostatSetpointType[] = supported.map((i) => thermostatSetpointTypeMap[i]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedSetpointTypes,\n });\n }\n public readonly supportedSetpointTypes: readonly ThermostatSetpointType[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(\n // Encode as interpretation A\n this.supportedSetpointTypes\n .map((t) => thermostatSetpointTypeMap.indexOf(t))\n .filter((t) => t !== -1), undefined, ThermostatSetpointType[\"N/A\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported setpoint types\": logList(this.supportedSetpointTypes.map((t) => getEnumMemberName(ThermostatSetpointType, t))),\n },\n };\n }\n}\n@CCCommand(ThermostatSetpointCommand.SupportedGet)\n@expectedCCResponse(ThermostatSetpointCCSupportedReport)\n/**\n * Issues a SupportedGet command to the node. Due to inconsistencies in interpretation,\n * this command should not be used for nodes with CC versions 1 or 2\n */\nexport class ThermostatSetpointCCSupportedGet extends ThermostatSetpointCC {\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAoZ;AACpZ,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAAmK;AACnK,oCAAiI;AAEjI,mBAAmE;AAanE,gCAA2C;AAp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AgC,MAAA;8BAN5C,yCAAU,uCAA0B,YAAY,OAChD,kDAAmB,mCAAmC,CAAC;;;;oBAKF;wDAAA,YAAoB;WAAA;;;;;;;;AAA1E,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./ThermostatSetpointCC._validateArgs.js\";\nconst { validateArgs_ThermostatSetpointCCAPI_get, validateArgs_ThermostatSetpointCCAPI_set, validateArgs_ThermostatSetpointCCAPI_getCapabilities } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type Scale, type SupervisionResult, ValueMetadata, type ValueMetadataNumeric, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, encodeFloatWithScale, getNamedScale, getUnknownScale, logList, logText, parseBitMask, parseFloatWithScale, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, CommandRelation, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatSetpointCommand, ThermostatSetpointType, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\n// This array is used to map the advertised supported types (interpretation A)\n// to the actual enum values\nconst thermostatSetpointTypeMap = [\n 0x00, 0x01, 0x02, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n];\nfunction getScale(scale: number): Scale {\n return getNamedScale(\"temperature\", scale as any) ?? getUnknownScale(scale);\n}\nfunction getSetpointUnit(scale: number): string {\n return getScale(scale).unit ?? \"\";\n}\nimport { ThermostatSetpointCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatSetpointCCValues };\n@API(CommandClasses[\"Thermostat Setpoint\"])\nexport class ThermostatSetpointCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatSetpointCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatSetpointCommand.Get:\n case ThermostatSetpointCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatSetpointCommand.Set:\n return true; // This is mandatory\n case ThermostatSetpointCommand.CapabilitiesGet:\n return this.version >= 3 && this.isSinglecast();\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatSetpointCCAPI, { property, propertyKey }, value) {\n if (property !== \"setpoint\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof propertyKey !== \"number\") {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);\n }\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // SDS14223: The Scale field value MUST be identical to the value received in the Thermostat Setpoint Report for the\n // actual Setpoint Type during the node interview. Fall back to the first scale if none is known\n const preferredScale = this.tryGetValueDB()?.getValue<number>(ThermostatSetpointCCValues.setpointScale(propertyKey).endpoint(this.endpoint.index));\n const result = await this.set(propertyKey, value, preferredScale ?? 0);\n // Verify the current value after a delay, unless the command was supervised and successful\n if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {\n // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600\n // aren't able to handle the GET this quickly.\n this.schedulePoll({ property, propertyKey }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatSetpointCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"setpoint\":\n if (typeof propertyKey !== \"number\") {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);\n }\n return (await this.get(propertyKey))?.value;\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_ThermostatSetpointCCAPI_get()\n public async get(setpointType: ThermostatSetpointType): Promise<{\n value: number;\n scale: Scale;\n } | undefined> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Get);\n const cc = new ThermostatSetpointCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCReport>(cc, this.commandOptions);\n if (!response)\n return;\n if (response.type !== ThermostatSetpointType[\"N/A\"]) {\n // This is a supported setpoint\n const scale = getScale(response.scale);\n return {\n value: response.value,\n scale,\n };\n }\n }\n @validateArgs_ThermostatSetpointCCAPI_set()\n public async set(setpointType: ThermostatSetpointType, value: number, scale: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Set);\n const cc = new ThermostatSetpointCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n value,\n scale,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_ThermostatSetpointCCAPI_getCapabilities()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getCapabilities(setpointType: ThermostatSetpointType) {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.CapabilitiesGet);\n const cc = new ThermostatSetpointCCCapabilitiesGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCCapabilitiesReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"minValue\",\n \"maxValue\",\n \"minValueScale\",\n \"maxValueScale\",\n ]);\n }\n }\n /**\n * Requests the supported setpoint types from the node. Due to inconsistencies it is NOT recommended\n * to use this method on nodes with CC versions 1 and 2. Instead rely on the information determined\n * during node interview.\n */\n public async getSupportedSetpointTypes(): Promise<MaybeNotKnown<readonly ThermostatSetpointType[]>> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.SupportedGet);\n const cc = new ThermostatSetpointCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedSetpointTypes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Setpoint\"])\n@implementedVersion(3)\n@ccValues(ThermostatSetpointCCValues)\nexport class ThermostatSetpointCC extends CommandClass {\n declare ccCommand: ThermostatSetpointCommand;\n public translatePropertyKey(ctx: GetValueDB, property: string | number, propertyKey: string | number): string | undefined {\n if (property === \"setpoint\") {\n return getEnumMemberName(ThermostatSetpointType, propertyKey as any);\n }\n else {\n return super.translatePropertyKey(ctx, property, propertyKey);\n }\n }\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[\"Thermostat Setpoint\"], 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 if (api.version <= 2) {\n // It has been found that early implementations of this Command Class applied two non-interoperable\n // interpretations of the bit mask advertising the support for specific Setpoint Types in the Thermostat\n // Setpoint Supported Report Command.\n // A controlling node SHOULD determine the supported Setpoint Types of a version 1 and version 2\n // supporting node by sending one Thermostat Setpoint Get Command at a time while incrementing\n // the requested Setpoint Type.\n // If the same Setpoint Type is advertised in the returned Thermostat Setpoint Report Command, the\n // controlling node MUST conclude that the actual Setpoint Type is supported.\n // If the Setpoint Type 0x00 (type N/A) is advertised in the returned Thermostat Setpoint Report\n // Command, the controlling node MUST conclude that the actual Setpoint Type is not supported.\n // The specs require us to query the list of supported setpoint types anyways, even if the response is ignored\n await api.getSupportedSetpointTypes();\n // Now scan all endpoints. Each type we received a value for gets marked as supported\n const supportedSetpointTypes: ThermostatSetpointType[] = [];\n for (let type: ThermostatSetpointType = ThermostatSetpointType.Heating; type <= ThermostatSetpointType[\"Full Power\"]; type++) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Every time, query the current value\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value of setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpoint = await api.get(type);\n // If the node did not respond, assume the setpoint type is not supported\n let logMessage: string;\n if (setpoint) {\n // Setpoint supported, remember the type\n supportedSetpointTypes.push(type);\n logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? \"\"}`;\n }\n else {\n // We're sure about the interpretation - this should not happen\n logMessage = `setpoint ${setpointName} is not supported`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n node.reportInterviewProgress(type - ThermostatSetpointType.Heating + 1, ThermostatSetpointType[\"Full Power\"]\n - ThermostatSetpointType.Heating\n + 1);\n }\n // Remember which setpoint types are actually supported\n this.setValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes, supportedSetpointTypes);\n }\n else {\n // Versions >= 3 adhere to bitmap interpretation A, so we can rely on getSupportedSetpointTypes\n // Query the supported setpoint types\n let setpointTypes: ThermostatSetpointType[] = [];\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"retrieving supported setpoint types...\",\n direction: \"outbound\",\n });\n const resp = await api.getSupportedSetpointTypes();\n if (resp) {\n setpointTypes = [...resp];\n const logMessage = logText(\"received supported setpoint types:\", {\n nested: logList(setpointTypes.map((type) => getEnumMemberName(ThermostatSetpointType, type))),\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported setpoint types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n for (const [i, type] of setpointTypes.entries()) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Find out the capabilities of this setpoint\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `retrieving capabilities for setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpointCaps = await api.getCapabilities(type);\n if (setpointCaps) {\n const minValueUnit = getSetpointUnit(setpointCaps.minValueScale);\n const maxValueUnit = getSetpointUnit(setpointCaps.maxValueScale);\n const logMessage = `received capabilities for setpoint ${setpointName}:\nminimum value: ${setpointCaps.minValue} ${minValueUnit}\nmaximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n node.reportInterviewProgress(i + 1, setpointTypes.length);\n }\n // Query the current value for all setpoint types\n await this.refreshValues(ctx, {\n tag: \"interview\",\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n }\n // Remember that the interview is complete\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[\"Thermostat Setpoint\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n const setpointTypes: ThermostatSetpointType[] = this.getValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes) ?? [];\n // Query each setpoint's current value\n for (const [i, type] of setpointTypes.entries()) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Every time, query the current value\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value of setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpoint = await api.get(type);\n if (setpoint) {\n const logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? \"\"}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n options?.onProgress?.(i + 1, setpointTypes.length);\n }\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCSetOptions {\n setpointType: ThermostatSetpointType;\n value: number;\n scale: number;\n}\n@CCCommand(ThermostatSetpointCommand.Set)\n@useSupervision()\nexport class ThermostatSetpointCCSet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCSetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n this.value = options.value;\n this.scale = options.scale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCSet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n // parseFloatWithScale does its own validation\n const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n value,\n scale,\n });\n }\n public setpointType: ThermostatSetpointType;\n public value: number;\n public scale: number;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof ThermostatSetpointCCSet\n && this.setpointType === other.setpointType) {\n return this.value === other.value && this.scale === other.scale\n ? CommandRelation.Redundant\n : CommandRelation.Supersedes;\n }\n return CommandRelation.Unrelated;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // If a config file overwrites how the float should be encoded, use that information\n const override = ctx.getDeviceConfig?.(this.nodeId as number)?.compat\n ?.overrideFloatEncoding;\n this.payload = Bytes.concat([\n [this.setpointType & 0b1111],\n encodeFloatWithScale(this.value, this.scale, override),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const scale = getScale(this.scale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n value: `${this.value} ${scale.unit}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCReportOptions {\n type: ThermostatSetpointType;\n value: number;\n scale: number;\n}\n@CCCommand(ThermostatSetpointCommand.Report)\nexport class ThermostatSetpointCCReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCReportOptions>) {\n super(options);\n this.type = options.type;\n this.value = options.value;\n this.scale = options.scale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCReport {\n validatePayload(raw.payload.length >= 1);\n const type: ThermostatSetpointType = raw.payload[0] & 0b1111;\n if (type === 0) {\n // Not supported\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n value: 0,\n scale: 0,\n });\n }\n // parseFloatWithScale does its own validation\n const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n value,\n scale,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const scale = getScale(this.scale);\n const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);\n const existingMetadata = this.getMetadata<ValueMetadataNumeric>(ctx, setpointValue);\n // Update the metadata when it is missing or the unit has changed\n if (existingMetadata?.unit !== scale.unit) {\n this.setMetadata(ctx, setpointValue, {\n ...(existingMetadata ?? setpointValue.meta),\n unit: scale.unit,\n });\n }\n this.setValue(ctx, setpointValue, this.value);\n // Remember the device-preferred setpoint scale so it can be used in SET commands\n this.setValue(ctx, ThermostatSetpointCCValues.setpointScale(this.type), scale.key);\n return true;\n }\n public type: ThermostatSetpointType;\n public scale: number;\n public value: number;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof ThermostatSetpointCCReport\n && this.type === other.type) {\n return this.value === other.value && this.scale === other.scale\n ? CommandRelation.Redundant\n : CommandRelation.Supersedes;\n }\n return CommandRelation.Unrelated;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.type & 0b1111],\n encodeFloatWithScale(this.value, this.scale),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const scale = getScale(this.scale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.type),\n value: `${this.value} ${scale.unit}`,\n },\n };\n }\n}\nfunction testResponseForThermostatSetpointGet(sent: ThermostatSetpointCCGet, received: ThermostatSetpointCCReport) {\n // We expect a Thermostat Setpoint Report that matches the requested setpoint type\n return received.type === sent.setpointType;\n}\n// @publicAPI\nexport interface ThermostatSetpointCCGetOptions {\n setpointType: ThermostatSetpointType;\n}\n@CCCommand(ThermostatSetpointCommand.Get)\n@expectedCCResponse(ThermostatSetpointCCReport, testResponseForThermostatSetpointGet)\nexport class ThermostatSetpointCCGet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCGetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCGet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n });\n }\n public setpointType: ThermostatSetpointType;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof ThermostatSetpointCCGet\n && this.setpointType === other.setpointType) {\n return CommandRelation.Redundant;\n }\n return CommandRelation.Unrelated;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.setpointType & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCCapabilitiesReportOptions {\n type: ThermostatSetpointType;\n minValue: number;\n minValueScale: number;\n maxValue: number;\n maxValueScale: number;\n}\n@CCCommand(ThermostatSetpointCommand.CapabilitiesReport)\nexport class ThermostatSetpointCCCapabilitiesReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCCapabilitiesReportOptions>) {\n super(options);\n this.type = options.type;\n this.minValue = options.minValue;\n this.minValueScale = options.minValueScale;\n this.maxValue = options.maxValue;\n this.maxValueScale = options.maxValueScale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCCapabilitiesReport {\n validatePayload(raw.payload.length >= 1);\n const type: ThermostatSetpointType = raw.payload[0];\n // parseFloatWithScale does its own validation\n const { value: minValue, scale: minValueScale, bytesRead, } = parseFloatWithScale(raw.payload.subarray(1));\n const { value: maxValue, scale: maxValueScale } = parseFloatWithScale(raw.payload.subarray(1 + bytesRead));\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n minValue,\n minValueScale,\n maxValue,\n maxValueScale,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Predefine the metadata\n const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);\n this.setMetadata(ctx, setpointValue, {\n ...setpointValue.meta,\n min: this.minValue,\n max: this.maxValue,\n unit: getSetpointUnit(this.minValueScale)\n || getSetpointUnit(this.maxValueScale),\n });\n return true;\n }\n public type: ThermostatSetpointType;\n public minValue: number;\n public maxValue: number;\n public minValueScale: number;\n public maxValueScale: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const min = encodeFloatWithScale(this.minValue, this.minValueScale);\n const max = encodeFloatWithScale(this.maxValue, this.maxValueScale);\n this.payload = Bytes.concat([[this.type], min, max]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const minValueScale = getScale(this.minValueScale);\n const maxValueScale = getScale(this.maxValueScale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.type),\n \"min value\": `${this.minValue} ${minValueScale.unit}`,\n \"max value\": `${this.maxValue} ${maxValueScale.unit}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCCapabilitiesGetOptions {\n setpointType: ThermostatSetpointType;\n}\n@CCCommand(ThermostatSetpointCommand.CapabilitiesGet)\n@expectedCCResponse(ThermostatSetpointCCCapabilitiesReport)\nexport class ThermostatSetpointCCCapabilitiesGet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCCapabilitiesGetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCCapabilitiesGet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n });\n }\n public setpointType: ThermostatSetpointType;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.setpointType & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCSupportedReportOptions {\n supportedSetpointTypes: ThermostatSetpointType[];\n}\n@CCCommand(ThermostatSetpointCommand.SupportedReport)\n@ccValueProperty(\"supportedSetpointTypes\", ThermostatSetpointCCValues.supportedSetpointTypes)\nexport class ThermostatSetpointCCSupportedReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCSupportedReportOptions>) {\n super(options);\n if (options.supportedSetpointTypes.length === 0) {\n throw new ZWaveError(`At least one setpoint type must be supported`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.supportedSetpointTypes = options.supportedSetpointTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const bitMask = raw.payload;\n const supported = parseBitMask(bitMask, ThermostatSetpointType[\"N/A\"]);\n // We use this command only when we are sure that bitmask interpretation A is used\n // FIXME: Figure out if we can do this without the CC version\n const supportedSetpointTypes: ThermostatSetpointType[] = supported\n .map((i) => thermostatSetpointTypeMap[i])\n // Reserved bits have no mapping and must be ignored\n .filter((t) => t != undefined);\n validatePayload(supportedSetpointTypes.length > 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedSetpointTypes,\n });\n }\n public readonly supportedSetpointTypes: readonly ThermostatSetpointType[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(\n // Encode as interpretation A\n this.supportedSetpointTypes\n .map((t) => thermostatSetpointTypeMap.indexOf(t))\n .filter((t) => t !== -1), undefined, ThermostatSetpointType[\"N/A\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported setpoint types\": logList(this.supportedSetpointTypes.map((t) => getEnumMemberName(ThermostatSetpointType, t))),\n },\n };\n }\n}\n@CCCommand(ThermostatSetpointCommand.SupportedGet)\n@expectedCCResponse(ThermostatSetpointCCSupportedReport)\n/**\n * Issues a SupportedGet command to the node. Due to inconsistencies in interpretation,\n * this command should not be used for nodes with CC versions 1 or 2\n */\nexport class ThermostatSetpointCCSupportedGet extends ThermostatSetpointCC {\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAoZ;AACpZ,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAAmK;AACnK,oCAAiI;AAEjI,mBAAmE;AAanE,gCAA2C;AApB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CAAC,UAAM,iCAAkB,qCAAwB,CAAC,CAAC,CAAC;;;IAGpI;;;;IAQS,oCAAgC,MAAA;8BAN5C,yCAAU,uCAA0B,YAAY,OAChD,kDAAmB,mCAAmC,CAAC;;;;oBAKF;wDAAA,YAAoB;WAAA;;;;;;;;AAA1E,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": ["ThermostatSetpointCCSet", "ThermostatSetpointCCReport", "ThermostatSetpointCCGet"]
7
7
  }
@@ -11,6 +11,12 @@ import type { CCEncodingContext, CCParsingContext } from "../lib/traits.js";
11
11
  * credentials (biometric data, BLE/NFC/RFID identifiers, ...) as raw bytes.
12
12
  */
13
13
  export declare function normalizeCredentialData(credentialType: UserCredentialType, credentialData: Bytes): string | Bytes;
14
+ /**
15
+ * Converts a credential to the bytes transmitted to the node. Strings are
16
+ * encoded according to the credential type, the inverse of
17
+ * {@link normalizeCredentialData}.
18
+ */
19
+ export declare function encodeCredentialData(credentialType: UserCredentialType, credentialData: string | Uint8Array): Bytes;
14
20
  import { UserCredentialCCValues } from "./_CCValues.generated.js";
15
21
  export { UserCredentialCCValues };
16
22
  export declare class UserCredentialCCAPI extends PhysicalCCAPI {
@@ -61,6 +61,7 @@ __export(UserCredentialCC_exports, {
61
61
  UserCredentialCCUserReport: () => UserCredentialCCUserReport,
62
62
  UserCredentialCCUserSet: () => UserCredentialCCUserSet,
63
63
  UserCredentialCCValues: () => import_CCValues_generated.UserCredentialCCValues,
64
+ encodeCredentialData: () => encodeCredentialData,
64
65
  normalizeCredentialData: () => normalizeCredentialData
65
66
  });
66
67
  module.exports = __toCommonJS(UserCredentialCC_exports);
@@ -81,12 +82,24 @@ function credentialToLogString(credential) {
81
82
  }
82
83
  __name(credentialToLogString, "credentialToLogString");
83
84
  function normalizeCredentialData(credentialType, credentialData) {
84
- if (credentialType === import_Types.UserCredentialType.PINCode || credentialType === import_Types.UserCredentialType.Password) {
85
+ if (credentialType === import_Types.UserCredentialType.PINCode) {
85
86
  return credentialData.toString("utf8");
86
87
  }
88
+ if (credentialType === import_Types.UserCredentialType.Password) {
89
+ return (0, import_shared.uint8ArrayToStringUTF16BE)(credentialData);
90
+ }
87
91
  return credentialData;
88
92
  }
89
93
  __name(normalizeCredentialData, "normalizeCredentialData");
94
+ function encodeCredentialData(credentialType, credentialData) {
95
+ if (typeof credentialData !== "string")
96
+ return import_shared.Bytes.from(credentialData);
97
+ if (credentialType === import_Types.UserCredentialType.Password) {
98
+ return import_shared.Bytes.from((0, import_shared.stringToUint8ArrayUTF16BE)(credentialData));
99
+ }
100
+ return import_shared.Bytes.from(credentialData, "utf-8");
101
+ }
102
+ __name(encodeCredentialData, "encodeCredentialData");
90
103
  let UserCredentialCCAPI = (() => {
91
104
  let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["User Credential"])];
92
105
  let _classDescriptor;
@@ -278,6 +291,19 @@ let UserCredentialCCAPI = (() => {
278
291
  */
279
292
  async setUser(options) {
280
293
  this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserSet);
294
+ if (options.operationType !== import_Types.UserCredentialOperationType.Delete && options.nameEncoding == void 0) {
295
+ const userName = options.userName ?? "";
296
+ const supportedEncodings = this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportedUserNameEncodings.endpoint(this.endpoint.index)) ?? [
297
+ import_Types.UserCredentialNameEncoding.ASCII,
298
+ import_Types.UserCredentialNameEncoding.ExtendedASCII,
299
+ import_Types.UserCredentialNameEncoding.UTF16BE
300
+ ];
301
+ const nameEncoding = chooseNameEncoding(userName, supportedEncodings);
302
+ if (nameEncoding == void 0) {
303
+ throw new import_core.ZWaveError(`The user name "${userName}" cannot be encoded with any of the encodings supported by the node`, import_core.ZWaveErrorCodes.Argument_Invalid);
304
+ }
305
+ options = { ...options, nameEncoding };
306
+ }
281
307
  const cc = new UserCredentialCCUserSet({
282
308
  nodeId: this.endpoint.nodeId,
283
309
  endpointIndex: this.endpoint.index,
@@ -1203,6 +1229,37 @@ function testResponseForUserCredentialUserSet(sent, received) {
1203
1229
  return received.reportType !== import_Types.UserCredentialUserReportType.ResponseToGet && received.userId === sent.userId;
1204
1230
  }
1205
1231
  __name(testResponseForUserCredentialUserSet, "testResponseForUserCredentialUserSet");
1232
+ function decodeSingleByteName(data) {
1233
+ return String.fromCharCode(...data);
1234
+ }
1235
+ __name(decodeSingleByteName, "decodeSingleByteName");
1236
+ function encodeSingleByteName(name, encoding) {
1237
+ const maxCharCode = encoding === import_Types.UserCredentialNameEncoding.ExtendedASCII ? 255 : 127;
1238
+ const ret = new import_shared.Bytes(name.length);
1239
+ for (let i = 0; i < name.length; i++) {
1240
+ const code = name.charCodeAt(i);
1241
+ if (code > maxCharCode) {
1242
+ throw new import_core.ZWaveError(`The user name "${name}" cannot be encoded as ${encoding === import_Types.UserCredentialNameEncoding.ExtendedASCII ? "Extended ASCII" : "ASCII"}`, import_core.ZWaveErrorCodes.Argument_Invalid);
1243
+ }
1244
+ ret[i] = code;
1245
+ }
1246
+ return ret;
1247
+ }
1248
+ __name(encodeSingleByteName, "encodeSingleByteName");
1249
+ function chooseNameEncoding(name, supported) {
1250
+ let maxCharCode = 0;
1251
+ for (let i = 0; i < name.length; i++) {
1252
+ maxCharCode = Math.max(maxCharCode, name.charCodeAt(i));
1253
+ }
1254
+ if (maxCharCode <= 127 && supported.includes(import_Types.UserCredentialNameEncoding.ASCII)) {
1255
+ return import_Types.UserCredentialNameEncoding.ASCII;
1256
+ } else if (maxCharCode <= 255 && supported.includes(import_Types.UserCredentialNameEncoding.ExtendedASCII)) {
1257
+ return import_Types.UserCredentialNameEncoding.ExtendedASCII;
1258
+ } else if (supported.includes(import_Types.UserCredentialNameEncoding.UTF16BE)) {
1259
+ return import_Types.UserCredentialNameEncoding.UTF16BE;
1260
+ }
1261
+ }
1262
+ __name(chooseNameEncoding, "chooseNameEncoding");
1206
1263
  let UserCredentialCCUserSet = (() => {
1207
1264
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserSet), (0, import_CommandClassDecorators.expectedCCResponse)(() => UserCredentialCCUserReport, testResponseForUserCredentialUserSet)];
1208
1265
  let _classDescriptor;
@@ -1271,10 +1328,12 @@ let UserCredentialCCUserSet = (() => {
1271
1328
  (0, import_core.validatePayload)(raw.payload.length >= 10 + nameLength);
1272
1329
  let userName;
1273
1330
  if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
1331
+ (0, import_core.validatePayload)(nameLength % 2 === 0);
1274
1332
  userName = (0, import_shared.uint8ArrayToStringUTF16BE)(raw.payload.subarray(10, 10 + nameLength));
1275
1333
  } else {
1276
- userName = raw.payload.subarray(10, 10 + nameLength).toString("ascii");
1334
+ userName = decodeSingleByteName(raw.payload.subarray(10, 10 + nameLength));
1277
1335
  }
1336
+ userName = (0, import_shared.stripControlCharacters)(userName);
1278
1337
  if (userType === import_Types.UserCredentialUserType.Expiring) {
1279
1338
  return new this({
1280
1339
  nodeId: ctx.sourceNodeId,
@@ -1312,6 +1371,9 @@ let UserCredentialCCUserSet = (() => {
1312
1371
  if (this.active == void 0) {
1313
1372
  throw new import_core.ZWaveError(`${this.constructor.name}: The active flag must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
1314
1373
  }
1374
+ if (this.nameEncoding == void 0) {
1375
+ throw new import_core.ZWaveError(`${this.constructor.name}: name encoding must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
1376
+ }
1315
1377
  const credentialRule = this.credentialRule ?? import_Types.UserCredentialRule.Single;
1316
1378
  let expiringTimeoutMinutes;
1317
1379
  if (this.userType === import_Types.UserCredentialUserType.Expiring) {
@@ -1322,13 +1384,15 @@ let UserCredentialCCUserSet = (() => {
1322
1384
  } else {
1323
1385
  expiringTimeoutMinutes = 0;
1324
1386
  }
1325
- const nameEncoding = this.nameEncoding ?? import_Types.UserCredentialNameEncoding.ASCII;
1326
1387
  const userName = this.userName ?? "";
1388
+ const nameEncoding = this.nameEncoding;
1327
1389
  let nameBuffer;
1328
1390
  if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
1329
1391
  nameBuffer = (0, import_shared.stringToUint8ArrayUTF16BE)(userName);
1392
+ } else if (nameEncoding === import_Types.UserCredentialNameEncoding.ExtendedASCII) {
1393
+ nameBuffer = encodeSingleByteName(userName, import_Types.UserCredentialNameEncoding.ExtendedASCII);
1330
1394
  } else {
1331
- nameBuffer = import_shared.Bytes.from(userName, "ascii");
1395
+ nameBuffer = encodeSingleByteName(userName, import_Types.UserCredentialNameEncoding.ASCII);
1332
1396
  }
1333
1397
  this.payload = import_shared.Bytes.alloc(10 + nameBuffer.length);
1334
1398
  this.payload[0] = this.operationType & 3;
@@ -1425,10 +1489,12 @@ let UserCredentialCCUserReport = (() => {
1425
1489
  (0, import_core.validatePayload)(raw.payload.length >= 15 + nameLength);
1426
1490
  let userName;
1427
1491
  if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
1492
+ (0, import_core.validatePayload)(nameLength % 2 === 0);
1428
1493
  userName = (0, import_shared.uint8ArrayToStringUTF16BE)(raw.payload.subarray(15, 15 + nameLength));
1429
1494
  } else {
1430
- userName = raw.payload.subarray(15, 15 + nameLength).toString("ascii");
1495
+ userName = decodeSingleByteName(raw.payload.subarray(15, 15 + nameLength));
1431
1496
  }
1497
+ userName = (0, import_shared.stripControlCharacters)(userName);
1432
1498
  const common = {
1433
1499
  nodeId: ctx.sourceNodeId,
1434
1500
  modifierType,
@@ -1461,8 +1527,10 @@ let UserCredentialCCUserReport = (() => {
1461
1527
  let nameBuffer;
1462
1528
  if (this.nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
1463
1529
  nameBuffer = (0, import_shared.stringToUint8ArrayUTF16BE)(this.userName);
1530
+ } else if (this.nameEncoding === import_Types.UserCredentialNameEncoding.ExtendedASCII) {
1531
+ nameBuffer = encodeSingleByteName(this.userName, import_Types.UserCredentialNameEncoding.ExtendedASCII);
1464
1532
  } else {
1465
- nameBuffer = import_shared.Bytes.from(this.userName, "ascii");
1533
+ nameBuffer = encodeSingleByteName(this.userName, import_Types.UserCredentialNameEncoding.ASCII);
1466
1534
  }
1467
1535
  this.payload = import_shared.Bytes.alloc(15 + nameBuffer.length);
1468
1536
  this.payload[0] = this.reportType;
@@ -1684,6 +1752,7 @@ let UserCredentialCCCredentialSet = (() => {
1684
1752
  if (raw.payload.length >= 7) {
1685
1753
  const credentialLength = raw.payload[6];
1686
1754
  (0, import_core.validatePayload)(raw.payload.length >= 7 + credentialLength);
1755
+ (0, import_core.validatePayload)(credentialType !== import_Types.UserCredentialType.Password || credentialLength % 2 === 0);
1687
1756
  credentialData = import_shared.Bytes.from(raw.payload.subarray(7, 7 + credentialLength));
1688
1757
  }
1689
1758
  return new this({
@@ -1779,6 +1848,11 @@ let UserCredentialCCCredentialReport = (() => {
1779
1848
  const credentialReadBack = !!(raw.payload[6] & 128);
1780
1849
  const credentialLength = raw.payload[7];
1781
1850
  (0, import_core.validatePayload)(raw.payload.length >= 8 + credentialLength + 6);
1851
+ if (credentialType === import_Types.UserCredentialType.Password && credentialLength % 2 !== 0) {
1852
+ if (credentialReadBack) {
1853
+ import_core.validatePayload.fail("Password credentials must have an even length");
1854
+ }
1855
+ }
1782
1856
  const offset = 8 + credentialLength;
1783
1857
  const modifierType = raw.payload[offset];
1784
1858
  const modifierNodeId = raw.payload.readUInt16BE(offset + 1);
@@ -2974,6 +3048,7 @@ let UserCredentialCCKeyLockerEntryGet = (() => {
2974
3048
  UserCredentialCCUserReport,
2975
3049
  UserCredentialCCUserSet,
2976
3050
  UserCredentialCCValues,
3051
+ encodeCredentialData,
2977
3052
  normalizeCredentialData
2978
3053
  });
2979
3054
  //# sourceMappingURL=UserCredentialCC.js.map