@zwave-js/cc 15.29.0 → 15.31.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 (166) hide show
  1. package/build/cjs/cc/AlarmSensorCC.d.ts +3 -1
  2. package/build/cjs/cc/AlarmSensorCC.js +22 -2
  3. package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
  4. package/build/cjs/cc/BarrierOperatorCC.d.ts +6 -3
  5. package/build/cjs/cc/BarrierOperatorCC.js +40 -6
  6. package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
  7. package/build/cjs/cc/CentralSceneCC.d.ts +4 -1
  8. package/build/cjs/cc/CentralSceneCC.js +34 -2
  9. package/build/cjs/cc/CentralSceneCC.js.map +2 -2
  10. package/build/cjs/cc/ClimateControlScheduleCC.d.ts +6 -3
  11. package/build/cjs/cc/ClimateControlScheduleCC.js +54 -6
  12. package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
  13. package/build/cjs/cc/ClockCC.d.ts +2 -1
  14. package/build/cjs/cc/ClockCC.js +19 -2
  15. package/build/cjs/cc/ClockCC.js.map +2 -2
  16. package/build/cjs/cc/ConfigurationCC.d.ts +3 -2
  17. package/build/cjs/cc/ConfigurationCC.js +61 -4
  18. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  19. package/build/cjs/cc/DoorLockLoggingCC.d.ts +3 -1
  20. package/build/cjs/cc/DoorLockLoggingCC.js +35 -2
  21. package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
  22. package/build/cjs/cc/EntryControlCC.d.ts +5 -1
  23. package/build/cjs/cc/EntryControlCC.js +57 -2
  24. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  25. package/build/cjs/cc/HumidityControlModeCC.d.ts +3 -1
  26. package/build/cjs/cc/HumidityControlModeCC.js +14 -2
  27. package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
  28. package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +3 -1
  29. package/build/cjs/cc/HumidityControlOperatingStateCC.js +4 -0
  30. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
  31. package/build/cjs/cc/HumidityControlSetpointCC.d.ts +8 -4
  32. package/build/cjs/cc/HumidityControlSetpointCC.js +51 -8
  33. package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
  34. package/build/cjs/cc/IrrigationCC.d.ts +15 -9
  35. package/build/cjs/cc/IrrigationCC.js +260 -24
  36. package/build/cjs/cc/IrrigationCC.js.map +2 -2
  37. package/build/cjs/cc/LanguageCC.d.ts +2 -1
  38. package/build/cjs/cc/LanguageCC.js +18 -2
  39. package/build/cjs/cc/LanguageCC.js.map +2 -2
  40. package/build/cjs/cc/MultiChannelCC.d.ts +2 -1
  41. package/build/cjs/cc/MultiChannelCC.js +14 -2
  42. package/build/cjs/cc/MultiChannelCC.js.map +2 -2
  43. package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +3 -2
  44. package/build/cjs/cc/SceneActuatorConfigurationCC.js +38 -5
  45. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
  46. package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +3 -2
  47. package/build/cjs/cc/SceneControllerConfigurationCC.js +25 -4
  48. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
  49. package/build/cjs/cc/ThermostatFanModeCC.d.ts +3 -1
  50. package/build/cjs/cc/ThermostatFanModeCC.js +17 -2
  51. package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
  52. package/build/cjs/cc/ThermostatFanStateCC.d.ts +3 -1
  53. package/build/cjs/cc/ThermostatFanStateCC.js +4 -0
  54. package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
  55. package/build/cjs/cc/ThermostatModeCC.js +2 -2
  56. package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
  57. package/build/cjs/cc/TimeCC.d.ts +1 -1
  58. package/build/cjs/cc/TimeCC.js +11 -2
  59. package/build/cjs/cc/TimeCC.js.map +2 -2
  60. package/build/cjs/cc/UserCodeCC.d.ts +2 -1
  61. package/build/cjs/cc/UserCodeCC.js +31 -2
  62. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  63. package/build/cjs/cc/VersionCC.d.ts +1 -0
  64. package/build/cjs/cc/VersionCC.js +32 -0
  65. package/build/cjs/cc/VersionCC.js.map +2 -2
  66. package/build/cjs/cc/WakeUpCC.d.ts +2 -0
  67. package/build/cjs/cc/WakeUpCC.js +14 -0
  68. package/build/cjs/cc/WakeUpCC.js.map +2 -2
  69. package/build/cjs/cc/manufacturerProprietary/FibaroCC.d.ts +2 -1
  70. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +30 -2
  71. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +2 -2
  72. package/build/esm/cc/AlarmSensorCC.d.ts +3 -1
  73. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  74. package/build/esm/cc/AlarmSensorCC.js +25 -7
  75. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  76. package/build/esm/cc/BarrierOperatorCC.d.ts +6 -3
  77. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  78. package/build/esm/cc/BarrierOperatorCC.js +45 -18
  79. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  80. package/build/esm/cc/CentralSceneCC.d.ts +4 -1
  81. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  82. package/build/esm/cc/CentralSceneCC.js +35 -6
  83. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  84. package/build/esm/cc/ClimateControlScheduleCC.d.ts +6 -3
  85. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  86. package/build/esm/cc/ClimateControlScheduleCC.js +57 -16
  87. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  88. package/build/esm/cc/ClockCC.d.ts +2 -1
  89. package/build/esm/cc/ClockCC.d.ts.map +1 -1
  90. package/build/esm/cc/ClockCC.js +20 -7
  91. package/build/esm/cc/ClockCC.js.map +1 -1
  92. package/build/esm/cc/ConfigurationCC.d.ts +3 -2
  93. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  94. package/build/esm/cc/ConfigurationCC.js +63 -12
  95. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  96. package/build/esm/cc/DoorLockLoggingCC.d.ts +3 -1
  97. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  98. package/build/esm/cc/DoorLockLoggingCC.js +39 -5
  99. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  100. package/build/esm/cc/EntryControlCC.d.ts +5 -1
  101. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  102. package/build/esm/cc/EntryControlCC.js +64 -7
  103. package/build/esm/cc/EntryControlCC.js.map +1 -1
  104. package/build/esm/cc/HumidityControlModeCC.d.ts +3 -1
  105. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  106. package/build/esm/cc/HumidityControlModeCC.js +15 -7
  107. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  108. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +3 -1
  109. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  110. package/build/esm/cc/HumidityControlOperatingStateCC.js +5 -1
  111. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  112. package/build/esm/cc/HumidityControlSetpointCC.d.ts +8 -4
  113. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  114. package/build/esm/cc/HumidityControlSetpointCC.js +52 -25
  115. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  116. package/build/esm/cc/IrrigationCC.d.ts +15 -9
  117. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  118. package/build/esm/cc/IrrigationCC.js +268 -61
  119. package/build/esm/cc/IrrigationCC.js.map +1 -1
  120. package/build/esm/cc/LanguageCC.d.ts +2 -1
  121. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  122. package/build/esm/cc/LanguageCC.js +18 -6
  123. package/build/esm/cc/LanguageCC.js.map +1 -1
  124. package/build/esm/cc/MultiChannelCC.d.ts +2 -1
  125. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  126. package/build/esm/cc/MultiChannelCC.js +15 -7
  127. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  128. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +3 -2
  129. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
  130. package/build/esm/cc/SceneActuatorConfigurationCC.js +39 -13
  131. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  132. package/build/esm/cc/SceneControllerConfigurationCC.d.ts +3 -2
  133. package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  134. package/build/esm/cc/SceneControllerConfigurationCC.js +25 -12
  135. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  136. package/build/esm/cc/ThermostatFanModeCC.d.ts +3 -1
  137. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  138. package/build/esm/cc/ThermostatFanModeCC.js +18 -7
  139. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  140. package/build/esm/cc/ThermostatFanStateCC.d.ts +3 -1
  141. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  142. package/build/esm/cc/ThermostatFanStateCC.js +5 -1
  143. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  144. package/build/esm/cc/ThermostatModeCC.js +2 -2
  145. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  146. package/build/esm/cc/TimeCC.d.ts +1 -1
  147. package/build/esm/cc/TimeCC.d.ts.map +1 -1
  148. package/build/esm/cc/TimeCC.js +12 -7
  149. package/build/esm/cc/TimeCC.js.map +1 -1
  150. package/build/esm/cc/UserCodeCC.d.ts +2 -1
  151. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  152. package/build/esm/cc/UserCodeCC.js +31 -6
  153. package/build/esm/cc/UserCodeCC.js.map +1 -1
  154. package/build/esm/cc/VersionCC.d.ts +1 -0
  155. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  156. package/build/esm/cc/VersionCC.js +34 -0
  157. package/build/esm/cc/VersionCC.js.map +1 -1
  158. package/build/esm/cc/WakeUpCC.d.ts +2 -0
  159. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  160. package/build/esm/cc/WakeUpCC.js +14 -0
  161. package/build/esm/cc/WakeUpCC.js.map +1 -1
  162. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts +2 -1
  163. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
  164. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +34 -4
  165. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  166. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/SceneActuatorConfigurationCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./SceneActuatorConfigurationCC._validateArgs.js\";\nconst { validateArgs_SceneActuatorConfigurationCCAPI_set, validateArgs_SceneActuatorConfigurationCCAPI_get } = __validateArgs;\nimport { CommandClasses, Duration, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, getCCName, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { SceneActuatorConfigurationCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { SceneActuatorConfigurationCCValues } from \"./_CCValues.generated.js\";\nexport { SceneActuatorConfigurationCCValues };\n@API(CommandClasses[\"Scene Actuator Configuration\"])\nexport class SceneActuatorConfigurationCCAPI extends CCAPI {\n public supportsCommand(cmd: SceneActuatorConfigurationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case SceneActuatorConfigurationCommand.Get:\n return this.isSinglecast();\n case SceneActuatorConfigurationCommand.Set:\n return true;\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: SceneActuatorConfigurationCCAPI, { property, propertyKey }, value, options) {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n if (property === \"level\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // We need to set the dimming duration along with the level.\n // Dimming duration is chosen with the following precedence:\n // 1. options.transitionDuration\n // 2. current stored value\n // 3. default\n const dimmingDuration = Duration.from(options?.transitionDuration)\n ?? this.tryGetValueDB()?.getValue<Duration>(SceneActuatorConfigurationCCValues.dimmingDuration(propertyKey).endpoint(this.endpoint.index));\n return this.set(propertyKey, dimmingDuration, value);\n }\n else if (property === \"dimmingDuration\") {\n if (typeof value !== \"string\" && !Duration.isDuration(value)) {\n throwWrongValueType(this.ccId, property, \"duration\", typeof value);\n }\n const dimmingDuration = Duration.from(value);\n if (dimmingDuration == undefined) {\n throw new ZWaveError(`${getCCName(this.ccId)}: \"${property}\" could not be set. ${JSON.stringify(value)} is not a valid duration.`, ZWaveErrorCodes.Argument_Invalid);\n }\n // Must set the level along with the dimmingDuration,\n // Use saved value, if it's defined. Otherwise the default\n // will be used.\n const level = this.tryGetValueDB()?.getValue<number>(SceneActuatorConfigurationCCValues.level(propertyKey).endpoint(this.endpoint.index));\n return this.set(propertyKey, dimmingDuration, level);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: SceneActuatorConfigurationCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"level\":\n case \"dimmingDuration\": {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n return (await this.get(propertyKey))?.[property];\n }\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_SceneActuatorConfigurationCCAPI_set()\n public async set(sceneId: number, dimmingDuration?: Duration | string, level?: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneActuatorConfigurationCommand, SceneActuatorConfigurationCommand.Set);\n // Undefined `dimmingDuration` defaults to 0 seconds to simplify the call\n // for actuators that don't support non-instant `dimmingDuration`\n // Undefined `level` uses the actuator's current value (override = 0).\n const cc = new SceneActuatorConfigurationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n sceneId,\n dimmingDuration: Duration.from(dimmingDuration) ?? new Duration(0, \"seconds\"),\n level,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getActive(): Promise<MaybeNotKnown<Pick<SceneActuatorConfigurationCCReport, \"sceneId\" | \"level\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneActuatorConfigurationCommand, SceneActuatorConfigurationCommand.Get);\n const cc = new SceneActuatorConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n sceneId: 0,\n });\n const response = await this.host.sendCommand<SceneActuatorConfigurationCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"sceneId\", \"level\", \"dimmingDuration\"]);\n }\n }\n @validateArgs_SceneActuatorConfigurationCCAPI_get()\n public async get(sceneId: number): Promise<MaybeNotKnown<Pick<SceneActuatorConfigurationCCReport, \"level\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneActuatorConfigurationCommand, SceneActuatorConfigurationCommand.Get);\n if (sceneId === 0) {\n throw new ZWaveError(`Invalid scene ID 0. To get the currently active scene, use getActive() instead.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneActuatorConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n sceneId: sceneId,\n });\n const response = await this.host.sendCommand<SceneActuatorConfigurationCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"level\", \"dimmingDuration\"]);\n }\n }\n}\n@commandClass(CommandClasses[\"Scene Actuator Configuration\"])\n@implementedVersion(1)\n@ccValues(SceneActuatorConfigurationCCValues)\nexport class SceneActuatorConfigurationCC extends CommandClass {\n declare ccCommand: SceneActuatorConfigurationCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n message: `${this.constructor.name}: setting metadata`,\n direction: \"none\",\n });\n // Create Metadata for all scenes\n for (let sceneId = 1; sceneId <= 255; sceneId++) {\n const levelValue = SceneActuatorConfigurationCCValues.level(sceneId);\n this.ensureMetadata(ctx, levelValue);\n const dimmingDurationValue = SceneActuatorConfigurationCCValues.dimmingDuration(sceneId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n }\n this.setInterviewComplete(ctx, true);\n }\n}\n// @publicAPI\nexport interface SceneActuatorConfigurationCCSetOptions {\n sceneId: number;\n dimmingDuration: Duration;\n level?: number;\n}\n@CCCommand(SceneActuatorConfigurationCommand.Set)\n@useSupervision()\nexport class SceneActuatorConfigurationCCSet extends SceneActuatorConfigurationCC {\n public constructor(options: WithAddress<SceneActuatorConfigurationCCSetOptions>) {\n super(options);\n if (options.sceneId < 1 || options.sceneId > 255) {\n throw new ZWaveError(`The scene id ${options.sceneId} must be between 1 and 255!`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.sceneId = options.sceneId;\n this.dimmingDuration = options.dimmingDuration;\n this.level = options.level;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): SceneActuatorConfigurationCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new SceneActuatorConfigurationCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public sceneId: number;\n public dimmingDuration: Duration;\n public level?: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.sceneId,\n this.dimmingDuration.serializeSet(),\n this.level != undefined ? 128 : 0,\n this.level ?? 0xff,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n sceneId: this.sceneId,\n dimmingDuration: this.dimmingDuration.toString(),\n };\n if (this.level != undefined) {\n message.level = this.level;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface SceneActuatorConfigurationCCReportOptions {\n sceneId: number;\n level?: number;\n dimmingDuration?: Duration;\n}\n@CCCommand(SceneActuatorConfigurationCommand.Report)\nexport class SceneActuatorConfigurationCCReport extends SceneActuatorConfigurationCC {\n public constructor(options: WithAddress<SceneActuatorConfigurationCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sceneId = options.sceneId;\n this.level = options.level;\n this.dimmingDuration = options.dimmingDuration;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneActuatorConfigurationCCReport {\n validatePayload(raw.payload.length >= 3);\n const sceneId = raw.payload[0];\n let level: number | undefined;\n let dimmingDuration: Duration | undefined;\n if (sceneId !== 0) {\n level = raw.payload[1];\n dimmingDuration =\n Duration.parseReport(raw.payload[2]) ?? Duration.unknown();\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sceneId,\n level,\n dimmingDuration,\n });\n }\n public readonly sceneId: number;\n public readonly level?: number;\n public readonly dimmingDuration?: Duration;\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Do not persist values for an inactive scene\n if (this.sceneId === 0\n || this.level == undefined\n || this.dimmingDuration == undefined) {\n return false;\n }\n const levelValue = SceneActuatorConfigurationCCValues.level(this.sceneId);\n this.ensureMetadata(ctx, levelValue);\n const dimmingDurationValue = SceneActuatorConfigurationCCValues.dimmingDuration(this.sceneId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n this.setValue(ctx, levelValue, this.level);\n this.setValue(ctx, dimmingDurationValue, this.dimmingDuration);\n return true;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n sceneId: this.sceneId,\n };\n if (this.dimmingDuration != undefined) {\n message.dimmingDuration = this.dimmingDuration.toString();\n }\n if (this.level != undefined) {\n message.level = this.level;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\nfunction testResponseForSceneActuatorConfigurationGet(sent: SceneActuatorConfigurationCCGet, received: SceneActuatorConfigurationCCReport) {\n // We expect a Scene Actuator Configuration Report that matches\n // the requested sceneId, unless groupId 0 was requested\n return sent.sceneId === 0 || received.sceneId === sent.sceneId;\n}\n// @publicAPI\nexport interface SceneActuatorConfigurationCCGetOptions {\n sceneId: number;\n}\n@CCCommand(SceneActuatorConfigurationCommand.Get)\n@expectedCCResponse(SceneActuatorConfigurationCCReport, testResponseForSceneActuatorConfigurationGet)\nexport class SceneActuatorConfigurationCCGet extends SceneActuatorConfigurationCC {\n public constructor(options: WithAddress<SceneActuatorConfigurationCCGetOptions>) {\n super(options);\n this.sceneId = options.sceneId;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): SceneActuatorConfigurationCCGet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new SceneActuatorConfigurationCCGet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public sceneId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.sceneId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"scene id\": this.sceneId },\n };\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAA+O;AAC/O,oBAA4B;AAC5B,iBAA8M;AAC9M,0BAA4F;AAC5F,oCAAgH;AAEhH,mBAAkD;AAElD,gCAAmD;AATnD,MAAM,EAAE,kDAAkD,iDAAgD,IAAK;IAYlG,mCAA+B,MAAA;8BAD3C,mCAAI,2BAAe,8BAA8B,CAAC,CAAC;;;;oBACC;;;;uDAAA,YAAK;WAAA;;;;;;;;yBAoErD,iDAAgD,CAAE;yBA2BlD,iDAAgD,CAAE;AA1BnD,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;AA2BhB,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;AAhGpB,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAAsC;AACzD,cAAQ,KAAK;QACT,KAAK,+CAAkC;AACnC,iBAAO,KAAK,aAAY;QAC5B,KAAK,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AAK,IAAI,qCAAqC,4BAAgB,8BAA8B;IAIxH;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,OAAO,CAAC;AACxC,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,YAAY,KAAK,QAAO;;IAE3C;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./SceneActuatorConfigurationCC._validateArgs.js\";\nconst { validateArgs_SceneActuatorConfigurationCCAPI_set, validateArgs_SceneActuatorConfigurationCCAPI_get } = __validateArgs;\nimport { CommandClasses, Duration, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, getCCName, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { SceneActuatorConfigurationCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { SceneActuatorConfigurationCCValues } from \"./_CCValues.generated.js\";\nexport { SceneActuatorConfigurationCCValues };\n@API(CommandClasses[\"Scene Actuator Configuration\"])\nexport class SceneActuatorConfigurationCCAPI extends CCAPI {\n public supportsCommand(cmd: SceneActuatorConfigurationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case SceneActuatorConfigurationCommand.Get:\n return this.isSinglecast();\n case SceneActuatorConfigurationCommand.Set:\n return true;\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: SceneActuatorConfigurationCCAPI, { property, propertyKey }, value, options) {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n if (property === \"level\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // We need to set the dimming duration along with the level.\n // Dimming duration is chosen with the following precedence:\n // 1. options.transitionDuration\n // 2. current stored value\n // 3. default\n const dimmingDuration = Duration.from(options?.transitionDuration)\n ?? this.tryGetValueDB()?.getValue<Duration>(SceneActuatorConfigurationCCValues.dimmingDuration(propertyKey).endpoint(this.endpoint.index));\n return this.set(propertyKey, dimmingDuration, value);\n }\n else if (property === \"dimmingDuration\") {\n if (typeof value !== \"string\" && !Duration.isDuration(value)) {\n throwWrongValueType(this.ccId, property, \"duration\", typeof value);\n }\n const dimmingDuration = Duration.from(value);\n if (dimmingDuration == undefined) {\n throw new ZWaveError(`${getCCName(this.ccId)}: \"${property}\" could not be set. ${JSON.stringify(value)} is not a valid duration.`, ZWaveErrorCodes.Argument_Invalid);\n }\n // Must set the level along with the dimmingDuration,\n // Use saved value, if it's defined. Otherwise the default\n // will be used.\n const level = this.tryGetValueDB()?.getValue<number>(SceneActuatorConfigurationCCValues.level(propertyKey).endpoint(this.endpoint.index));\n return this.set(propertyKey, dimmingDuration, level);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: SceneActuatorConfigurationCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"level\":\n case \"dimmingDuration\": {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n return (await this.get(propertyKey))?.[property];\n }\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_SceneActuatorConfigurationCCAPI_set()\n public async set(sceneId: number, dimmingDuration?: Duration | string, level?: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneActuatorConfigurationCommand, SceneActuatorConfigurationCommand.Set);\n // Undefined `dimmingDuration` defaults to 0 seconds to simplify the call\n // for actuators that don't support non-instant `dimmingDuration`\n // Undefined `level` uses the actuator's current value (override = 0).\n const cc = new SceneActuatorConfigurationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n sceneId,\n dimmingDuration: Duration.from(dimmingDuration) ?? new Duration(0, \"seconds\"),\n level,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getActive(): Promise<MaybeNotKnown<Pick<SceneActuatorConfigurationCCReport, \"sceneId\" | \"level\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneActuatorConfigurationCommand, SceneActuatorConfigurationCommand.Get);\n const cc = new SceneActuatorConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n sceneId: 0,\n });\n const response = await this.host.sendCommand<SceneActuatorConfigurationCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"sceneId\", \"level\", \"dimmingDuration\"]);\n }\n }\n @validateArgs_SceneActuatorConfigurationCCAPI_get()\n public async get(sceneId: number): Promise<MaybeNotKnown<Pick<SceneActuatorConfigurationCCReport, \"level\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneActuatorConfigurationCommand, SceneActuatorConfigurationCommand.Get);\n if (sceneId === 0) {\n throw new ZWaveError(`Invalid scene ID 0. To get the currently active scene, use getActive() instead.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneActuatorConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n sceneId: sceneId,\n });\n const response = await this.host.sendCommand<SceneActuatorConfigurationCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"level\", \"dimmingDuration\"]);\n }\n }\n}\n@commandClass(CommandClasses[\"Scene Actuator Configuration\"])\n@implementedVersion(1)\n@ccValues(SceneActuatorConfigurationCCValues)\nexport class SceneActuatorConfigurationCC extends CommandClass {\n declare ccCommand: SceneActuatorConfigurationCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n message: `${this.constructor.name}: setting metadata`,\n direction: \"none\",\n });\n // Create Metadata for all scenes\n for (let sceneId = 1; sceneId <= 255; sceneId++) {\n const levelValue = SceneActuatorConfigurationCCValues.level(sceneId);\n this.ensureMetadata(ctx, levelValue);\n const dimmingDurationValue = SceneActuatorConfigurationCCValues.dimmingDuration(sceneId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n }\n this.setInterviewComplete(ctx, true);\n }\n}\n// @publicAPI\nexport interface SceneActuatorConfigurationCCSetOptions {\n sceneId: number;\n dimmingDuration: Duration;\n level?: number;\n}\n@CCCommand(SceneActuatorConfigurationCommand.Set)\n@useSupervision()\nexport class SceneActuatorConfigurationCCSet extends SceneActuatorConfigurationCC {\n public constructor(options: WithAddress<SceneActuatorConfigurationCCSetOptions>) {\n super(options);\n if (options.sceneId < 1 || options.sceneId > 255) {\n throw new ZWaveError(`The scene id ${options.sceneId} must be between 1 and 255!`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.sceneId = options.sceneId;\n this.dimmingDuration = options.dimmingDuration;\n this.level = options.level;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneActuatorConfigurationCCSet {\n validatePayload(raw.payload.length >= 4);\n validatePayload(raw.payload[0] >= 1);\n const sceneId = raw.payload[0];\n const dimmingDuration = Duration.parseSet(raw.payload[1])!;\n let level: number | undefined;\n if (raw.payload[2] & 128) {\n level = raw.payload[3];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sceneId,\n dimmingDuration,\n level,\n });\n }\n public sceneId: number;\n public dimmingDuration: Duration;\n public level?: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n let overrideByte = 0;\n if (this.level != undefined) {\n overrideByte = 128;\n }\n this.payload = Bytes.from([\n this.sceneId,\n this.dimmingDuration.serializeSet(),\n overrideByte,\n this.level ?? 0xff,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n sceneId: this.sceneId,\n dimmingDuration: this.dimmingDuration.toString(),\n };\n if (this.level != undefined) {\n message.level = this.level;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface SceneActuatorConfigurationCCReportOptions {\n sceneId: number;\n level?: number;\n dimmingDuration?: Duration;\n}\n@CCCommand(SceneActuatorConfigurationCommand.Report)\nexport class SceneActuatorConfigurationCCReport extends SceneActuatorConfigurationCC {\n public constructor(options: WithAddress<SceneActuatorConfigurationCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sceneId = options.sceneId;\n this.level = options.level;\n this.dimmingDuration = options.dimmingDuration;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneActuatorConfigurationCCReport {\n validatePayload(raw.payload.length >= 3);\n const sceneId = raw.payload[0];\n let level: number | undefined;\n let dimmingDuration: Duration | undefined;\n if (sceneId !== 0) {\n level = raw.payload[1];\n dimmingDuration =\n Duration.parseReport(raw.payload[2]) ?? Duration.unknown();\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sceneId,\n level,\n dimmingDuration,\n });\n }\n public readonly sceneId: number;\n public readonly level?: number;\n public readonly dimmingDuration?: Duration;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (this.sceneId === 0) {\n this.payload = Bytes.from([0, 0, 0]);\n }\n else {\n this.payload = Bytes.from([\n this.sceneId,\n this.level ?? 0xff,\n (this.dimmingDuration ?? Duration.unknown()).serializeReport(),\n ]);\n }\n return super.serialize(ctx);\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Do not persist values for an inactive scene\n if (this.sceneId === 0\n || this.level == undefined\n || this.dimmingDuration == undefined) {\n return false;\n }\n const levelValue = SceneActuatorConfigurationCCValues.level(this.sceneId);\n this.ensureMetadata(ctx, levelValue);\n const dimmingDurationValue = SceneActuatorConfigurationCCValues.dimmingDuration(this.sceneId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n this.setValue(ctx, levelValue, this.level);\n this.setValue(ctx, dimmingDurationValue, this.dimmingDuration);\n return true;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n sceneId: this.sceneId,\n };\n if (this.dimmingDuration != undefined) {\n message.dimmingDuration = this.dimmingDuration.toString();\n }\n if (this.level != undefined) {\n message.level = this.level;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\nfunction testResponseForSceneActuatorConfigurationGet(sent: SceneActuatorConfigurationCCGet, received: SceneActuatorConfigurationCCReport) {\n // We expect a Scene Actuator Configuration Report that matches\n // the requested sceneId, unless groupId 0 was requested\n return sent.sceneId === 0 || received.sceneId === sent.sceneId;\n}\n// @publicAPI\nexport interface SceneActuatorConfigurationCCGetOptions {\n sceneId: number;\n}\n@CCCommand(SceneActuatorConfigurationCommand.Get)\n@expectedCCResponse(SceneActuatorConfigurationCCReport, testResponseForSceneActuatorConfigurationGet)\nexport class SceneActuatorConfigurationCCGet extends SceneActuatorConfigurationCC {\n public constructor(options: WithAddress<SceneActuatorConfigurationCCGetOptions>) {\n super(options);\n this.sceneId = options.sceneId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneActuatorConfigurationCCGet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n sceneId: raw.payload[0],\n });\n }\n public sceneId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.sceneId]);\n return super.serialize(ctx);\n }\n public toLogE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AA4C;AAGrI,SAAO,KAAK,YAAY,KAAK,SAAS,YAAY,KAAK;AAC3D;AAJS;IAWI,mCAA+B,MAAA;8BAF3C,yCAAU,+CAAkC,GAAG,OAC/C,kDAAmB,oCAAoC,4CAA4C,CAAC;;;;oBAChD;uDAAA,YAA4B;WAAA;;;;;;;;AAAjF,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAA4D;AAC3E,YAAM,OAAO;AACb,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ,SAAS,IAAI,QAAQ,CAAC;OACzB;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,OAAO,CAAC;AACxC,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,YAAY,KAAK,QAAO;;IAE3C;;;;",
6
6
  "names": []
7
7
  }
@@ -35,7 +35,7 @@ export interface SceneControllerConfigurationCCSetOptions {
35
35
  }
36
36
  export declare class SceneControllerConfigurationCCSet extends SceneControllerConfigurationCC {
37
37
  constructor(options: WithAddress<SceneControllerConfigurationCCSetOptions>);
38
- static from(_raw: CCRaw, _ctx: CCParsingContext): SceneControllerConfigurationCCSet;
38
+ static from(raw: CCRaw, ctx: CCParsingContext): SceneControllerConfigurationCCSet;
39
39
  groupId: number;
40
40
  sceneId: number;
41
41
  dimmingDuration: Duration;
@@ -53,6 +53,7 @@ export declare class SceneControllerConfigurationCCReport extends SceneControlle
53
53
  readonly groupId: number;
54
54
  readonly sceneId: number;
55
55
  readonly dimmingDuration: Duration;
56
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
56
57
  persistValues(ctx: PersistValuesContext): boolean;
57
58
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
58
59
  }
@@ -61,7 +62,7 @@ export interface SceneControllerConfigurationCCGetOptions {
61
62
  }
62
63
  export declare class SceneControllerConfigurationCCGet extends SceneControllerConfigurationCC {
63
64
  constructor(options: WithAddress<SceneControllerConfigurationCCGetOptions>);
64
- static from(_raw: CCRaw, _ctx: CCParsingContext): SceneControllerConfigurationCCGet;
65
+ static from(raw: CCRaw, ctx: CCParsingContext): SceneControllerConfigurationCCGet;
65
66
  groupId: number;
66
67
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
67
68
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
@@ -324,8 +324,17 @@ let SceneControllerConfigurationCCSet = (() => {
324
324
  this.sceneId = options.sceneId;
325
325
  this.dimmingDuration = import_core.Duration.from(options.dimmingDuration) ?? import_core.Duration.default();
326
326
  }
327
- static from(_raw, _ctx) {
328
- throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
327
+ static from(raw, ctx) {
328
+ (0, import_core.validatePayload)(raw.payload.length >= 3);
329
+ const groupId = raw.payload[0];
330
+ const sceneId = raw.payload[1];
331
+ const dimmingDuration = import_core.Duration.parseSet(raw.payload[2]);
332
+ return new this({
333
+ nodeId: ctx.sourceNodeId,
334
+ groupId,
335
+ sceneId,
336
+ dimmingDuration
337
+ });
329
338
  }
330
339
  groupId;
331
340
  sceneId;
@@ -392,6 +401,14 @@ let SceneControllerConfigurationCCReport = (() => {
392
401
  groupId;
393
402
  sceneId;
394
403
  dimmingDuration;
404
+ serialize(ctx) {
405
+ this.payload = import_shared.Bytes.from([
406
+ this.groupId,
407
+ this.sceneId,
408
+ this.dimmingDuration.serializeReport()
409
+ ]);
410
+ return super.serialize(ctx);
411
+ }
395
412
  persistValues(ctx) {
396
413
  if (!super.persistValues(ctx))
397
414
  return false;
@@ -446,8 +463,12 @@ let SceneControllerConfigurationCCGet = (() => {
446
463
  super(options);
447
464
  this.groupId = options.groupId;
448
465
  }
449
- static from(_raw, _ctx) {
450
- throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
466
+ static from(raw, ctx) {
467
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
468
+ return new this({
469
+ nodeId: ctx.sourceNodeId,
470
+ groupId: raw.payload[0]
471
+ });
451
472
  }
452
473
  groupId;
453
474
  serialize(ctx) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/SceneControllerConfigurationCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./SceneControllerConfigurationCC._validateArgs.js\";\nconst { validateArgs_SceneControllerConfigurationCCAPI_disable, validateArgs_SceneControllerConfigurationCCAPI_set, validateArgs_SceneControllerConfigurationCCAPI_get } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, Duration, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, getCCName, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { SceneControllerConfigurationCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { AssociationCC } from \"./AssociationCC.js\";\nimport { SceneControllerConfigurationCCValues } from \"./_CCValues.generated.js\";\nexport { SceneControllerConfigurationCCValues };\n@API(CommandClasses[\"Scene Controller Configuration\"])\nexport class SceneControllerConfigurationCCAPI extends CCAPI {\n public supportsCommand(cmd: SceneControllerConfigurationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case SceneControllerConfigurationCommand.Get:\n return this.isSinglecast();\n case SceneControllerConfigurationCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: SceneControllerConfigurationCCAPI, { property, propertyKey }, value, options) {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n if (property === \"sceneId\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n if (value === 0) {\n // Disable Group ID / Scene ID\n return this.disable(propertyKey);\n }\n else {\n // We need to set the dimming duration along with the scene ID\n // Dimming duration is chosen with the following precedence:\n // 1. options.transitionDuration\n // 2. current stored value\n // 3. default value\n const dimmingDuration = Duration.from(options?.transitionDuration)\n ?? this.tryGetValueDB()?.getValue<Duration>(SceneControllerConfigurationCCValues.dimmingDuration(propertyKey).endpoint(this.endpoint.index))\n ?? Duration.default();\n return this.set(propertyKey, value, dimmingDuration);\n }\n }\n else if (property === \"dimmingDuration\") {\n if (typeof value !== \"string\" && !Duration.isDuration(value)) {\n throwWrongValueType(this.ccId, property, \"duration\", typeof value);\n }\n const dimmingDuration = Duration.from(value);\n if (dimmingDuration == undefined) {\n throw new ZWaveError(`${getCCName(this.ccId)}: \"${property}\" could not be set. ${JSON.stringify(value)} is not a valid duration.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const valueDB = this.tryGetValueDB();\n const sceneId = valueDB?.getValue<number>(SceneControllerConfigurationCCValues.sceneId(propertyKey).endpoint(this.endpoint.index));\n if (sceneId == undefined || sceneId === 0) {\n if (valueDB) {\n // Can't actually send dimmingDuration without valid sceneId\n // So we save it in the valueDB without sending it to the node\n const dimmingDurationValueId = SceneControllerConfigurationCCValues.dimmingDuration(propertyKey).endpoint(this.endpoint.index);\n valueDB.setValue(dimmingDurationValueId, dimmingDuration);\n }\n return;\n }\n return this.set(propertyKey, sceneId, dimmingDuration);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: SceneControllerConfigurationCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"sceneId\":\n case \"dimmingDuration\": {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n return (await this.get(propertyKey))?.[property];\n }\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_SceneControllerConfigurationCCAPI_disable()\n public async disable(groupId: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Set);\n return this.set(groupId, 0, new Duration(0, \"seconds\"));\n }\n @validateArgs_SceneControllerConfigurationCCAPI_set()\n public async set(groupId: number, sceneId: number, dimmingDuration?: Duration | string): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Set);\n if (!this.endpoint.virtual) {\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(this.host, this.endpoint);\n // The client SHOULD NOT specify group 1 (the life-line group).\n // We don't block it here, because the specs don't forbid it,\n // and it may be needed for some devices.\n if (groupId < 1 || groupId > groupCount) {\n throw new ZWaveError(`${this.constructor.name}: The group ID must be between 1 and the number of supported groups ${groupCount}.`, ZWaveErrorCodes.Argument_Invalid);\n }\n }\n else if (groupId < 1) {\n throw new ZWaveError(`The group ID must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneControllerConfigurationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n sceneId,\n dimmingDuration,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getLastActivated(): Promise<MaybeNotKnown<Pick<SceneControllerConfigurationCCReport, \"groupId\" | \"sceneId\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Get);\n const cc = new SceneControllerConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId: 0,\n });\n const response = await this.host.sendCommand<SceneControllerConfigurationCCReport>(cc, this.commandOptions);\n // Return value includes \"groupId\", because\n // the returned report will include the actual groupId of the\n // last activated groupId / sceneId\n if (response) {\n return pick(response, [\"groupId\", \"sceneId\", \"dimmingDuration\"]);\n }\n }\n @validateArgs_SceneControllerConfigurationCCAPI_get()\n public async get(groupId: number): Promise<MaybeNotKnown<Pick<SceneControllerConfigurationCCReport, \"sceneId\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Get);\n if (groupId === 0) {\n throw new ZWaveError(`Invalid group ID 0. To get the last activated group / scene, use getLastActivated() instead.`, ZWaveErrorCodes.Argument_Invalid);\n }\n else if (groupId < 0) {\n throw new ZWaveError(`The group ID must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneControllerConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n });\n const response = await this.host.sendCommand<SceneControllerConfigurationCCReport>(cc, this.commandOptions);\n // Since groupId is not allowed to be 0, only Reports with\n // groupId equal to the requested groupId will be accepted,\n // so we can omit groupId from the return.\n if (response) {\n return pick(response, [\"sceneId\", \"dimmingDuration\"]);\n }\n }\n}\n@commandClass(CommandClasses[\"Scene Controller Configuration\"])\n@implementedVersion(1)\n@ccValues(SceneControllerConfigurationCCValues)\nexport class SceneControllerConfigurationCC extends CommandClass {\n declare ccCommand: SceneControllerConfigurationCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n // AssociationCC is required and MUST be interviewed\n // before SceneControllerConfigurationCC to supply groupCount\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n ];\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(ctx, endpoint);\n if (groupCount === 0) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `skipping Scene Controller Configuration interview because Association group count is unknown`,\n direction: \"none\",\n level: \"warn\",\n });\n return;\n }\n // Create metadata for each scene, but don't query their actual configuration\n // since some devices only support setting scenes\n for (let groupId = 1; groupId <= groupCount; groupId++) {\n const sceneIdValue = SceneControllerConfigurationCCValues.sceneId(groupId);\n this.ensureMetadata(ctx, sceneIdValue);\n const dimmingDurationValue = SceneControllerConfigurationCCValues.dimmingDuration(groupId);\n this.ensureMetadata(ctx, dimmingDurationValue);\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[\"Scene Controller Configuration\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(ctx, endpoint);\n ctx.logNode(node.id, {\n message: \"querying all scene controller configurations...\",\n direction: \"outbound\",\n });\n for (let groupId = 1; groupId <= groupCount; groupId++) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying scene configuration for group #${groupId}...`,\n direction: \"outbound\",\n });\n const group = await api.get(groupId);\n if (group != undefined) {\n const logMessage = `received scene configuration for group #${groupId}:\nscene ID: ${group.sceneId}\ndimming duration: ${group.dimmingDuration.toString()}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n options?.onProgress?.(groupId, groupCount);\n }\n }\n /**\n * Returns the number of association groups reported by the node.\n * This only works AFTER the node has been interviewed by this CC\n * or the AssociationCC.\n */\n public static getGroupCountCached(ctx: GetValueDB & GetDeviceConfig, endpoint: EndpointId): number {\n return (ctx.getDeviceConfig?.(endpoint.nodeId)?.compat\n ?.forceSceneControllerGroupCount\n ?? AssociationCC.getGroupCountCached(ctx, endpoint)\n ?? 0);\n }\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCSetOptions {\n groupId: number;\n sceneId: number;\n dimmingDuration?: Duration | string;\n}\n@CCCommand(SceneControllerConfigurationCommand.Set)\n@useSupervision()\nexport class SceneControllerConfigurationCCSet extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCSetOptions>) {\n super(options);\n this.groupId = options.groupId;\n this.sceneId = options.sceneId;\n // if dimmingDuration was missing, use default duration.\n this.dimmingDuration =\n Duration.from(options.dimmingDuration) ?? Duration.default();\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): SceneControllerConfigurationCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new SceneControllerConfigurationCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public groupId: number;\n public sceneId: number;\n public dimmingDuration: Duration;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.groupId,\n this.sceneId,\n this.dimmingDuration.serializeSet(),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"scene id\": this.sceneId,\n \"dimming duration\": this.dimmingDuration.toString(),\n },\n };\n }\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCReportOptions {\n groupId: number;\n sceneId: number;\n dimmingDuration: Duration;\n}\n@CCCommand(SceneControllerConfigurationCommand.Report)\nexport class SceneControllerConfigurationCCReport extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.groupId = options.groupId;\n this.sceneId = options.sceneId;\n this.dimmingDuration = options.dimmingDuration;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneControllerConfigurationCCReport {\n validatePayload(raw.payload.length >= 3);\n const groupId = raw.payload[0];\n const sceneId = raw.payload[1];\n const dimmingDuration: Duration = Duration.parseReport(raw.payload[2]) ?? Duration.unknown();\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n sceneId,\n dimmingDuration,\n });\n }\n public readonly groupId: number;\n public readonly sceneId: number;\n public readonly dimmingDuration: Duration;\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // If groupId = 0, values are meaningless\n if (this.groupId === 0)\n return false;\n const sceneIdValue = SceneControllerConfigurationCCValues.sceneId(this.groupId);\n this.ensureMetadata(ctx, sceneIdValue);\n const dimmingDurationValue = SceneControllerConfigurationCCValues.dimmingDuration(this.groupId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n this.setValue(ctx, sceneIdValue, this.sceneId);\n this.setValue(ctx, dimmingDurationValue, this.dimmingDuration);\n return true;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"scene id\": this.sceneId,\n \"dimming duration\": this.dimmingDuration.toString(),\n },\n };\n }\n}\nfunction testResponseForSceneControllerConfigurationGet(sent: SceneControllerConfigurationCCGet, received: SceneControllerConfigurationCCReport) {\n // We expect a Scene Controller Configuration Report that matches\n // the requested groupId, unless groupId 0 was requested\n return sent.groupId === 0 || received.groupId === sent.groupId;\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCGetOptions {\n groupId: number;\n}\n@CCCommand(SceneControllerConfigurationCommand.Get)\n@expectedCCResponse(SceneControllerConfigurationCCReport, testResponseForSceneControllerConfigurationGet)\nexport class SceneControllerConfigurationCCGet extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCGetOptions>) {\n super(options);\n this.groupId = options.groupId;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): SceneControllerConfigurationCCGet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new SceneControllerConfigurationCCGet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public groupId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.groupId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"group id\": this.groupId },\n };\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAA6P;AAC7P,oBAA4B;AAC5B,iBAA8M;AAC9M,0BAAkJ;AAClJ,oCAAgH;AAEhH,mBAAoD;AAEpD,2BAA8B;AAC9B,gCAAqD;AAXrD,MAAM,EAAE,wDAAwD,oDAAoD,mDAAkD,IAAK;IAc9J,qCAAiC,MAAA;8BAD7C,mCAAI,2BAAe,gCAAgC,CAAC,CAAC;;;;oBACC;;;;;yDAAA,YAAK;WAAA;;;;;;;;6BAkFvD,uDAAsD,CAAE;yBAKxD,mDAAkD,CAAE;yBAuCpD,mDAAkD,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AA8B;IAIxH;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,OAAO,CAAC;AACxC,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,YAAY,KAAK,QAAO;;IAE3C;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./SceneControllerConfigurationCC._validateArgs.js\";\nconst { validateArgs_SceneControllerConfigurationCCAPI_disable, validateArgs_SceneControllerConfigurationCCAPI_set, validateArgs_SceneControllerConfigurationCCAPI_get } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, Duration, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, getCCName, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { SceneControllerConfigurationCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { AssociationCC } from \"./AssociationCC.js\";\nimport { SceneControllerConfigurationCCValues } from \"./_CCValues.generated.js\";\nexport { SceneControllerConfigurationCCValues };\n@API(CommandClasses[\"Scene Controller Configuration\"])\nexport class SceneControllerConfigurationCCAPI extends CCAPI {\n public supportsCommand(cmd: SceneControllerConfigurationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case SceneControllerConfigurationCommand.Get:\n return this.isSinglecast();\n case SceneControllerConfigurationCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: SceneControllerConfigurationCCAPI, { property, propertyKey }, value, options) {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n if (property === \"sceneId\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n if (value === 0) {\n // Disable Group ID / Scene ID\n return this.disable(propertyKey);\n }\n else {\n // We need to set the dimming duration along with the scene ID\n // Dimming duration is chosen with the following precedence:\n // 1. options.transitionDuration\n // 2. current stored value\n // 3. default value\n const dimmingDuration = Duration.from(options?.transitionDuration)\n ?? this.tryGetValueDB()?.getValue<Duration>(SceneControllerConfigurationCCValues.dimmingDuration(propertyKey).endpoint(this.endpoint.index))\n ?? Duration.default();\n return this.set(propertyKey, value, dimmingDuration);\n }\n }\n else if (property === \"dimmingDuration\") {\n if (typeof value !== \"string\" && !Duration.isDuration(value)) {\n throwWrongValueType(this.ccId, property, \"duration\", typeof value);\n }\n const dimmingDuration = Duration.from(value);\n if (dimmingDuration == undefined) {\n throw new ZWaveError(`${getCCName(this.ccId)}: \"${property}\" could not be set. ${JSON.stringify(value)} is not a valid duration.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const valueDB = this.tryGetValueDB();\n const sceneId = valueDB?.getValue<number>(SceneControllerConfigurationCCValues.sceneId(propertyKey).endpoint(this.endpoint.index));\n if (sceneId == undefined || sceneId === 0) {\n if (valueDB) {\n // Can't actually send dimmingDuration without valid sceneId\n // So we save it in the valueDB without sending it to the node\n const dimmingDurationValueId = SceneControllerConfigurationCCValues.dimmingDuration(propertyKey).endpoint(this.endpoint.index);\n valueDB.setValue(dimmingDurationValueId, dimmingDuration);\n }\n return;\n }\n return this.set(propertyKey, sceneId, dimmingDuration);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: SceneControllerConfigurationCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"sceneId\":\n case \"dimmingDuration\": {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n return (await this.get(propertyKey))?.[property];\n }\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_SceneControllerConfigurationCCAPI_disable()\n public async disable(groupId: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Set);\n return this.set(groupId, 0, new Duration(0, \"seconds\"));\n }\n @validateArgs_SceneControllerConfigurationCCAPI_set()\n public async set(groupId: number, sceneId: number, dimmingDuration?: Duration | string): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Set);\n if (!this.endpoint.virtual) {\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(this.host, this.endpoint);\n // The client SHOULD NOT specify group 1 (the life-line group).\n // We don't block it here, because the specs don't forbid it,\n // and it may be needed for some devices.\n if (groupId < 1 || groupId > groupCount) {\n throw new ZWaveError(`${this.constructor.name}: The group ID must be between 1 and the number of supported groups ${groupCount}.`, ZWaveErrorCodes.Argument_Invalid);\n }\n }\n else if (groupId < 1) {\n throw new ZWaveError(`The group ID must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneControllerConfigurationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n sceneId,\n dimmingDuration,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getLastActivated(): Promise<MaybeNotKnown<Pick<SceneControllerConfigurationCCReport, \"groupId\" | \"sceneId\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Get);\n const cc = new SceneControllerConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId: 0,\n });\n const response = await this.host.sendCommand<SceneControllerConfigurationCCReport>(cc, this.commandOptions);\n // Return value includes \"groupId\", because\n // the returned report will include the actual groupId of the\n // last activated groupId / sceneId\n if (response) {\n return pick(response, [\"groupId\", \"sceneId\", \"dimmingDuration\"]);\n }\n }\n @validateArgs_SceneControllerConfigurationCCAPI_get()\n public async get(groupId: number): Promise<MaybeNotKnown<Pick<SceneControllerConfigurationCCReport, \"sceneId\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Get);\n if (groupId === 0) {\n throw new ZWaveError(`Invalid group ID 0. To get the last activated group / scene, use getLastActivated() instead.`, ZWaveErrorCodes.Argument_Invalid);\n }\n else if (groupId < 0) {\n throw new ZWaveError(`The group ID must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneControllerConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n });\n const response = await this.host.sendCommand<SceneControllerConfigurationCCReport>(cc, this.commandOptions);\n // Since groupId is not allowed to be 0, only Reports with\n // groupId equal to the requested groupId will be accepted,\n // so we can omit groupId from the return.\n if (response) {\n return pick(response, [\"sceneId\", \"dimmingDuration\"]);\n }\n }\n}\n@commandClass(CommandClasses[\"Scene Controller Configuration\"])\n@implementedVersion(1)\n@ccValues(SceneControllerConfigurationCCValues)\nexport class SceneControllerConfigurationCC extends CommandClass {\n declare ccCommand: SceneControllerConfigurationCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n // AssociationCC is required and MUST be interviewed\n // before SceneControllerConfigurationCC to supply groupCount\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n ];\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(ctx, endpoint);\n if (groupCount === 0) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `skipping Scene Controller Configuration interview because Association group count is unknown`,\n direction: \"none\",\n level: \"warn\",\n });\n return;\n }\n // Create metadata for each scene, but don't query their actual configuration\n // since some devices only support setting scenes\n for (let groupId = 1; groupId <= groupCount; groupId++) {\n const sceneIdValue = SceneControllerConfigurationCCValues.sceneId(groupId);\n this.ensureMetadata(ctx, sceneIdValue);\n const dimmingDurationValue = SceneControllerConfigurationCCValues.dimmingDuration(groupId);\n this.ensureMetadata(ctx, dimmingDurationValue);\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[\"Scene Controller Configuration\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(ctx, endpoint);\n ctx.logNode(node.id, {\n message: \"querying all scene controller configurations...\",\n direction: \"outbound\",\n });\n for (let groupId = 1; groupId <= groupCount; groupId++) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying scene configuration for group #${groupId}...`,\n direction: \"outbound\",\n });\n const group = await api.get(groupId);\n if (group != undefined) {\n const logMessage = `received scene configuration for group #${groupId}:\nscene ID: ${group.sceneId}\ndimming duration: ${group.dimmingDuration.toString()}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n options?.onProgress?.(groupId, groupCount);\n }\n }\n /**\n * Returns the number of association groups reported by the node.\n * This only works AFTER the node has been interviewed by this CC\n * or the AssociationCC.\n */\n public static getGroupCountCached(ctx: GetValueDB & GetDeviceConfig, endpoint: EndpointId): number {\n return (ctx.getDeviceConfig?.(endpoint.nodeId)?.compat\n ?.forceSceneControllerGroupCount\n ?? AssociationCC.getGroupCountCached(ctx, endpoint)\n ?? 0);\n }\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCSetOptions {\n groupId: number;\n sceneId: number;\n dimmingDuration?: Duration | string;\n}\n@CCCommand(SceneControllerConfigurationCommand.Set)\n@useSupervision()\nexport class SceneControllerConfigurationCCSet extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCSetOptions>) {\n super(options);\n this.groupId = options.groupId;\n this.sceneId = options.sceneId;\n // if dimmingDuration was missing, use default duration.\n this.dimmingDuration =\n Duration.from(options.dimmingDuration) ?? Duration.default();\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneControllerConfigurationCCSet {\n validatePayload(raw.payload.length >= 3);\n const groupId = raw.payload[0];\n const sceneId = raw.payload[1];\n const dimmingDuration = Duration.parseSet(raw.payload[2]);\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n sceneId,\n dimmingDuration,\n });\n }\n public groupId: number;\n public sceneId: number;\n public dimmingDuration: Duration;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.groupId,\n this.sceneId,\n this.dimmingDuration.serializeSet(),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"scene id\": this.sceneId,\n \"dimming duration\": this.dimmingDuration.toString(),\n },\n };\n }\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCReportOptions {\n groupId: number;\n sceneId: number;\n dimmingDuration: Duration;\n}\n@CCCommand(SceneControllerConfigurationCommand.Report)\nexport class SceneControllerConfigurationCCReport extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.groupId = options.groupId;\n this.sceneId = options.sceneId;\n this.dimmingDuration = options.dimmingDuration;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneControllerConfigurationCCReport {\n validatePayload(raw.payload.length >= 3);\n const groupId = raw.payload[0];\n const sceneId = raw.payload[1];\n const dimmingDuration: Duration = Duration.parseReport(raw.payload[2]) ?? Duration.unknown();\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n sceneId,\n dimmingDuration,\n });\n }\n public readonly groupId: number;\n public readonly sceneId: number;\n public readonly dimmingDuration: Duration;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.groupId,\n this.sceneId,\n this.dimmingDuration.serializeReport(),\n ]);\n return super.serialize(ctx);\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // If groupId = 0, values are meaningless\n if (this.groupId === 0)\n return false;\n const sceneIdValue = SceneControllerConfigurationCCValues.sceneId(this.groupId);\n this.ensureMetadata(ctx, sceneIdValue);\n const dimmingDurationValue = SceneControllerConfigurationCCValues.dimmingDuration(this.groupId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n this.setValue(ctx, sceneIdValue, this.sceneId);\n this.setValue(ctx, dimmingDurationValue, this.dimmingDuration);\n return true;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"scene id\": this.sceneId,\n \"dimming duration\": this.dimmingDuration.toString(),\n },\n };\n }\n}\nfunction testResponseForSceneControllerConfigurationGet(sent: SceneControllerConfigurationCCGet, received: SceneControllerConfigurationCCReport) {\n // We expect a Scene Controller Configuration Report that matches\n // the requested groupId, unless groupId 0 was requested\n return sent.groupId === 0 || received.groupId === sent.groupId;\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCGetOptions {\n groupId: number;\n}\n@CCCommand(SceneControllerConfigurationCommand.Get)\n@expectedCCResponse(SceneControllerConfigurationCCReport, testResponseForSceneControllerConfigurationGet)\nexport class SceneControllerConfigurationCCGet extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCGetOptions>) {\n super(options);\n this.groupId = options.groupId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneControllerConfigurationCCGet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId: raw.payload[0],\n });\n }\n public groupId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.groupId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"group id\": this.groupId },\n };\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAA6P;AAC7P,oBAA4B;AAC5B,iBAA8M;AAC9M,0BAAkJ;AAClJ,oCAAgH;AAEhH,mBAAoD;AAEpD,2BAA8B;AAC9B,gCAAqD;AAXrD,MAAM,EAAE,wDAAwD,oDAAoD,mDAAkD,IAAK;IAc9J,qCAAiC,MAAA;8BAD7C,mCAAI,2BAAe,gCAAgC,CAAC,CAAC;;;;oBACC;;;;;yDAAA,YAAK;WAAA;;;;;;;;6BAkFvD,uDAAsD,CAAE;yBAKxD,mDAAkD,CAAE;yBAuCpD,mDAAkD,CAAE;AA3CrD,qCAAA,MAAA,MAAA,qBAAA,EAAA,MAAA,UAAA,MAAA,WAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,aAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,SAAb,OA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AAC7E,YAAM,OAAO;AACb,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ,SAAS,IAAI,QAAQ,CAAC;OACzB;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,OAAO,CAAC;AACxC,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,YAAY,KAAK,QAAO;;IAE3C;;;;",
6
6
  "names": ["SceneControllerConfigurationCC"]
7
7
  }
@@ -25,7 +25,7 @@ export interface ThermostatFanModeCCSetOptions {
25
25
  }
26
26
  export declare class ThermostatFanModeCCSet extends ThermostatFanModeCC {
27
27
  constructor(options: WithAddress<ThermostatFanModeCCSetOptions>);
28
- static from(_raw: CCRaw, _ctx: CCParsingContext): ThermostatFanModeCCSet;
28
+ static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCSet;
29
29
  mode: ThermostatFanMode;
30
30
  off: boolean | undefined;
31
31
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
@@ -40,6 +40,7 @@ export declare class ThermostatFanModeCCReport extends ThermostatFanModeCC {
40
40
  static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCReport;
41
41
  readonly mode: ThermostatFanMode;
42
42
  readonly off: boolean | undefined;
43
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
43
44
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
44
45
  }
45
46
  export declare class ThermostatFanModeCCGet extends ThermostatFanModeCC {
@@ -52,6 +53,7 @@ export declare class ThermostatFanModeCCSupportedReport extends ThermostatFanMod
52
53
  static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCSupportedReport;
53
54
  persistValues(ctx: PersistValuesContext): boolean;
54
55
  readonly supportedModes: ThermostatFanMode[];
56
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
55
57
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
56
58
  }
57
59
  export declare class ThermostatFanModeCCSupportedGet extends ThermostatFanModeCC {
@@ -270,8 +270,13 @@ let ThermostatFanModeCCSet = (() => {
270
270
  this.mode = options.mode;
271
271
  this.off = options.off;
272
272
  }
273
- static from(_raw, _ctx) {
274
- throw new import_core.ZWaveError(`${this.name}: deserialization not implemented`, import_core.ZWaveErrorCodes.Deserialization_NotImplemented);
273
+ static from(raw, ctx) {
274
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
275
+ return new this({
276
+ nodeId: ctx.sourceNodeId,
277
+ mode: raw.payload[0] & 15,
278
+ off: !!(raw.payload[0] & 128)
279
+ });
275
280
  }
276
281
  mode;
277
282
  off;
@@ -330,6 +335,12 @@ let ThermostatFanModeCCReport = (() => {
330
335
  }
331
336
  mode;
332
337
  off;
338
+ serialize(ctx) {
339
+ this.payload = import_shared.Bytes.from([
340
+ (this.off ? 128 : 0) | this.mode & 15
341
+ ]);
342
+ return super.serialize(ctx);
343
+ }
333
344
  toLogEntry(ctx) {
334
345
  const message = {
335
346
  mode: (0, import_shared.getEnumMemberName)(import_Types.ThermostatFanMode, this.mode)
@@ -410,6 +421,10 @@ let ThermostatFanModeCCSupportedReport = (() => {
410
421
  return true;
411
422
  }
412
423
  supportedModes;
424
+ serialize(ctx) {
425
+ this.payload = (0, import_core.encodeBitMask)(this.supportedModes, void 0, import_Types.ThermostatFanMode["Auto low"]);
426
+ return super.serialize(ctx);
427
+ }
413
428
  toLogEntry(ctx) {
414
429
  return {
415
430
  ...super.toLogEntry(ctx),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/ThermostatFanModeCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./ThermostatFanModeCC._validateArgs.js\";\nconst { validateArgs_ThermostatFanModeCCAPI_set } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, enumValuesToMetadataStates, logList, logText, parseBitMask, 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, 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 { ThermostatFanMode, ThermostatFanModeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatFanModeCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatFanModeCCValues };\n@API(CommandClasses[\"Thermostat Fan Mode\"])\nexport class ThermostatFanModeCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatFanModeCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatFanModeCommand.Get:\n case ThermostatFanModeCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatFanModeCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatFanModeCCAPI, { property }, value) {\n const valueDB = this.getValueDB();\n let result: SupervisionResult | undefined;\n if (property === \"mode\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // Preserve the value of the \"off\" flag\n const off = valueDB.getValue<boolean>(ThermostatFanModeCCValues.turnedOff.endpoint(this.endpoint.index));\n result = await this.set(value, off);\n }\n else if (property === \"off\") {\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n const mode = valueDB.getValue<ThermostatFanMode>(ThermostatFanModeCCValues.fanMode.endpoint(this.endpoint.index));\n if (mode == undefined) {\n throw new ZWaveError(`The \"off\" property cannot be changed before the fan mode is known!`, ZWaveErrorCodes.Argument_Invalid);\n }\n result = await this.set(mode, value);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\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 }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatFanModeCCAPI, { property }) {\n switch (property) {\n case \"mode\":\n case \"off\":\n return (await this.get())?.[property];\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.Get);\n const cc = new ThermostatFanModeCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanModeCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"mode\", \"off\"]);\n }\n }\n @validateArgs_ThermostatFanModeCCAPI_set()\n public async set(mode: ThermostatFanMode, off?: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.Set);\n const cc = new ThermostatFanModeCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n mode,\n off,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getSupportedModes(): Promise<MaybeNotKnown<readonly ThermostatFanMode[]>> {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.SupportedGet);\n const cc = new ThermostatFanModeCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanModeCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedModes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Fan Mode\"])\n@implementedVersion(5)\n@ccValues(ThermostatFanModeCCValues)\nexport class ThermostatFanModeCC extends CommandClass {\n declare ccCommand: ThermostatFanModeCommand;\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 Fan Mode\"], 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 // First query the possible modes to set the metadata\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported thermostat fan modes...\",\n direction: \"outbound\",\n });\n const supportedModes = await api.getSupportedModes();\n if (supportedModes) {\n const logMessage = logText(\"received supported thermostat fan modes:\", {\n nested: logList(supportedModes.map((mode) => getEnumMemberName(ThermostatFanMode, mode))),\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 thermostat fan modes timed out, skipping interview...\",\n });\n return;\n }\n await this.refreshValues(ctx, { tag: \"interview\" });\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 Fan Mode\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying current thermostat fan mode...\",\n direction: \"outbound\",\n });\n const currentStatus = await api.get();\n if (currentStatus) {\n let logMessage = `received current thermostat fan mode: ${getEnumMemberName(ThermostatFanMode, currentStatus.mode)}`;\n if (currentStatus.off != undefined) {\n logMessage += ` (turned off)`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ThermostatFanModeCCSetOptions {\n mode: ThermostatFanMode;\n off?: boolean;\n}\n@CCCommand(ThermostatFanModeCommand.Set)\n@useSupervision()\nexport class ThermostatFanModeCCSet extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCSetOptions>) {\n super(options);\n this.mode = options.mode;\n this.off = options.off;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ThermostatFanModeCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ThermostatFanModeCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public mode: ThermostatFanMode;\n public off: boolean | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n (this.off ? 128 : 0) | (this.mode & 0b1111),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatFanMode, this.mode),\n };\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ThermostatFanModeCCReportOptions {\n mode: ThermostatFanMode;\n off?: boolean;\n}\n@CCCommand(ThermostatFanModeCommand.Report)\n@ccValueProperty(\"mode\", ThermostatFanModeCCValues.fanMode)\n@ccValueProperty(\"off\", ThermostatFanModeCCValues.turnedOff)\nexport class ThermostatFanModeCCReport extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.mode = options.mode;\n this.off = options.off;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCReport {\n validatePayload(raw.payload.length >= 1);\n const mode: ThermostatFanMode = raw.payload[0] & 0b1111;\n // V3+\n const off = !!(raw.payload[0] & 128);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n off,\n });\n }\n public readonly mode: ThermostatFanMode;\n public readonly off: boolean | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatFanMode, this.mode),\n };\n if (this.off != undefined) {\n message.off = this.off;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ThermostatFanModeCommand.Get)\n@expectedCCResponse(ThermostatFanModeCCReport)\nexport class ThermostatFanModeCCGet extends ThermostatFanModeCC {\n}\n// @publicAPI\nexport interface ThermostatFanModeCCSupportedReportOptions {\n supportedModes: ThermostatFanMode[];\n}\n@CCCommand(ThermostatFanModeCommand.SupportedReport)\n@ccValueProperty(\"supportedModes\", ThermostatFanModeCCValues.supportedFanModes)\nexport class ThermostatFanModeCCSupportedReport extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.supportedModes = options.supportedModes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCSupportedReport {\n const supportedModes: ThermostatFanMode[] = parseBitMask(raw.payload, ThermostatFanMode[\"Auto low\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedModes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Remember which fan modes are supported\n const fanModeValue = ThermostatFanModeCCValues.fanMode;\n this.setMetadata(ctx, fanModeValue, {\n ...fanModeValue.meta,\n states: enumValuesToMetadataStates(ThermostatFanMode, this.supportedModes),\n });\n return true;\n }\n public readonly supportedModes: ThermostatFanMode[];\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported modes\": logList(this.supportedModes.map((mode) => getEnumMemberName(ThermostatFanMode, mode))),\n },\n };\n }\n}\n@CCCommand(ThermostatFanModeCommand.SupportedGet)\n@expectedCCResponse(ThermostatFanModeCCSupportedReport)\nexport class ThermostatFanModeCCSupportedGet extends ThermostatFanModeCC {\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAmU;AACnU,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAAkJ;AAClJ,oCAAiI;AAEjI,mBAA4D;AAE5D,gCAA0C;AAT1C,MAAM,EAAE,wCAAuC,IAAK;IAYvC,0BAAsB,MAAA;8BADlC,mCAAI,2BAAe,qBAAqB,CAAC,CAAC;;;;oBACC;;;8CAAA,YAAK;WAAA;;;;;;;;yBAoE5C,wCAAuC,CAAE;AAC1C,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;AArEpB,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAA6B;AAChD,cAAQ,KAAK;QACT,KAAK,sCAAyB;QAC9B,KAAK,sCAAyB;AAC1B,iBAAO,KAAK,aAAY;QAC5B,KAAK,sCAAyB;AAC1B,iBAAO;MACf;AACA,aAA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AAO;IACX;IACgB;IACT,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,uBAAmB,qBAAQ,KAAK,eAAe,IAAI,CAAC,aAAS,iCAAkB,gCAAmB,IAAI,CAAC,CAAC;;;IAGpH;;;;IAIS,mCAA+B,MAAA;8BAF3C,yCAAU,sCAAyB,YAAY,OAC/C,kDAAmB,kCAAkC,CAAC;;;;oBACF;uDAAA,YAAmB;WAAA;;;;;;;;AAAxE,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 \"./ThermostatFanModeCC._validateArgs.js\";\nconst { validateArgs_ThermostatFanModeCCAPI_set } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, enumValuesToMetadataStates, logList, logText, parseBitMask, 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, 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 { ThermostatFanMode, ThermostatFanModeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatFanModeCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatFanModeCCValues };\n@API(CommandClasses[\"Thermostat Fan Mode\"])\nexport class ThermostatFanModeCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatFanModeCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatFanModeCommand.Get:\n case ThermostatFanModeCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatFanModeCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatFanModeCCAPI, { property }, value) {\n const valueDB = this.getValueDB();\n let result: SupervisionResult | undefined;\n if (property === \"mode\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // Preserve the value of the \"off\" flag\n const off = valueDB.getValue<boolean>(ThermostatFanModeCCValues.turnedOff.endpoint(this.endpoint.index));\n result = await this.set(value, off);\n }\n else if (property === \"off\") {\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n const mode = valueDB.getValue<ThermostatFanMode>(ThermostatFanModeCCValues.fanMode.endpoint(this.endpoint.index));\n if (mode == undefined) {\n throw new ZWaveError(`The \"off\" property cannot be changed before the fan mode is known!`, ZWaveErrorCodes.Argument_Invalid);\n }\n result = await this.set(mode, value);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\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 }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatFanModeCCAPI, { property }) {\n switch (property) {\n case \"mode\":\n case \"off\":\n return (await this.get())?.[property];\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.Get);\n const cc = new ThermostatFanModeCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanModeCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"mode\", \"off\"]);\n }\n }\n @validateArgs_ThermostatFanModeCCAPI_set()\n public async set(mode: ThermostatFanMode, off?: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.Set);\n const cc = new ThermostatFanModeCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n mode,\n off,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getSupportedModes(): Promise<MaybeNotKnown<readonly ThermostatFanMode[]>> {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.SupportedGet);\n const cc = new ThermostatFanModeCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanModeCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedModes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Fan Mode\"])\n@implementedVersion(5)\n@ccValues(ThermostatFanModeCCValues)\nexport class ThermostatFanModeCC extends CommandClass {\n declare ccCommand: ThermostatFanModeCommand;\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 Fan Mode\"], 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 // First query the possible modes to set the metadata\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported thermostat fan modes...\",\n direction: \"outbound\",\n });\n const supportedModes = await api.getSupportedModes();\n if (supportedModes) {\n const logMessage = logText(\"received supported thermostat fan modes:\", {\n nested: logList(supportedModes.map((mode) => getEnumMemberName(ThermostatFanMode, mode))),\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 thermostat fan modes timed out, skipping interview...\",\n });\n return;\n }\n await this.refreshValues(ctx, { tag: \"interview\" });\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 Fan Mode\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying current thermostat fan mode...\",\n direction: \"outbound\",\n });\n const currentStatus = await api.get();\n if (currentStatus) {\n let logMessage = `received current thermostat fan mode: ${getEnumMemberName(ThermostatFanMode, currentStatus.mode)}`;\n if (currentStatus.off != undefined) {\n logMessage += ` (turned off)`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ThermostatFanModeCCSetOptions {\n mode: ThermostatFanMode;\n off?: boolean;\n}\n@CCCommand(ThermostatFanModeCommand.Set)\n@useSupervision()\nexport class ThermostatFanModeCCSet extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCSetOptions>) {\n super(options);\n this.mode = options.mode;\n this.off = options.off;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCSet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode: raw.payload[0] & 0b1111,\n off: !!(raw.payload[0] & 128),\n });\n }\n public mode: ThermostatFanMode;\n public off: boolean | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n (this.off ? 128 : 0) | (this.mode & 0b1111),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatFanMode, this.mode),\n };\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ThermostatFanModeCCReportOptions {\n mode: ThermostatFanMode;\n off?: boolean;\n}\n@CCCommand(ThermostatFanModeCommand.Report)\n@ccValueProperty(\"mode\", ThermostatFanModeCCValues.fanMode)\n@ccValueProperty(\"off\", ThermostatFanModeCCValues.turnedOff)\nexport class ThermostatFanModeCCReport extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.mode = options.mode;\n this.off = options.off;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCReport {\n validatePayload(raw.payload.length >= 1);\n const mode: ThermostatFanMode = raw.payload[0] & 0b1111;\n // V3+\n const off = !!(raw.payload[0] & 128);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n off,\n });\n }\n public readonly mode: ThermostatFanMode;\n public readonly off: boolean | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n (this.off ? 128 : 0) | (this.mode & 0b1111),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatFanMode, this.mode),\n };\n if (this.off != undefined) {\n message.off = this.off;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ThermostatFanModeCommand.Get)\n@expectedCCResponse(ThermostatFanModeCCReport)\nexport class ThermostatFanModeCCGet extends ThermostatFanModeCC {\n}\n// @publicAPI\nexport interface ThermostatFanModeCCSupportedReportOptions {\n supportedModes: ThermostatFanMode[];\n}\n@CCCommand(ThermostatFanModeCommand.SupportedReport)\n@ccValueProperty(\"supportedModes\", ThermostatFanModeCCValues.supportedFanModes)\nexport class ThermostatFanModeCCSupportedReport extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.supportedModes = options.supportedModes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCSupportedReport {\n const supportedModes: ThermostatFanMode[] = parseBitMask(raw.payload, ThermostatFanMode[\"Auto low\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedModes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Remember which fan modes are supported\n const fanModeValue = ThermostatFanModeCCValues.fanMode;\n this.setMetadata(ctx, fanModeValue, {\n ...fanModeValue.meta,\n states: enumValuesToMetadataStates(ThermostatFanMode, this.supportedModes),\n });\n return true;\n }\n public readonly supportedModes: ThermostatFanMode[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(this.supportedModes, undefined, ThermostatFanMode[\"Auto low\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported modes\": logList(this.supportedModes.map((mode) => getEnumMemberName(ThermostatFanMode, mode))),\n },\n };\n }\n}\n@CCCommand(ThermostatFanModeCommand.SupportedGet)\n@expectedCCResponse(ThermostatFanModeCCSupportedReport)\nexport class ThermostatFanModeCCSupportedGet extends ThermostatFanModeCC {\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAkV;AAClV,oBAA+C;AAC/C,iBAAwJ;AACxJ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AS,iCAAkB,gCAAmB,IAAI,CAAC,CAAC;;;IAGpH;;;;IAIS,mCAA+B,MAAA;8BAF3C,yCAAU,sCAAyB,YAAY,OAC/C,kDAAmB,kCAAkC,CAAC;;;;oBACF;uDAAA,YAAmB;WAAA;;;;;;;;AAAxE,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": []
7
7
  }
@@ -1,8 +1,9 @@
1
1
  import { type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type WithAddress } from "@zwave-js/core";
2
+ import { Bytes } from "@zwave-js/shared";
2
3
  import { CCAPI, POLL_VALUE, type PollValueImplementation } from "../lib/API.js";
3
4
  import { type CCRaw, CommandClass, type InterviewContext, type RefreshValuesContext, type RefreshValuesOptions } from "../lib/CommandClass.js";
4
5
  import { ThermostatFanState, ThermostatFanStateCommand } from "../lib/_Types.js";
5
- import type { CCParsingContext } from "../lib/traits.js";
6
+ import type { CCEncodingContext, CCParsingContext } from "../lib/traits.js";
6
7
  import { ThermostatFanStateCCValues } from "./_CCValues.generated.js";
7
8
  export { ThermostatFanStateCCValues };
8
9
  export declare class ThermostatFanStateCCAPI extends CCAPI {
@@ -22,6 +23,7 @@ export declare class ThermostatFanStateCCReport extends ThermostatFanStateCC {
22
23
  constructor(options: WithAddress<ThermostatFanStateCCReportOptions>);
23
24
  static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanStateCCReport;
24
25
  readonly state: ThermostatFanState;
26
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
25
27
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
26
28
  }
27
29
  export declare class ThermostatFanStateCCGet extends ThermostatFanStateCC {
@@ -173,6 +173,10 @@ let ThermostatFanStateCCReport = (() => {
173
173
  });
174
174
  }
175
175
  state;
176
+ serialize(ctx) {
177
+ this.payload = import_shared.Bytes.from([this.state & 15]);
178
+ return super.serialize(ctx);
179
+ }
176
180
  toLogEntry(ctx) {
177
181
  const message = {
178
182
  state: (0, import_shared.getEnumMemberName)(import_Types.ThermostatFanState, this.state)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/ThermostatFanStateCC.ts"],
4
- "sourcesContent": ["import { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, ValueMetadata, type WithAddress, enumValuesToMetadataStates, validatePayload, } from \"@zwave-js/core\";\nimport { getEnumMemberName } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, throwUnsupportedProperty, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatFanState, ThermostatFanStateCommand, } from \"../lib/_Types.js\";\nimport type { CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatFanStateCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatFanStateCCValues };\n@API(CommandClasses[\"Thermostat Fan State\"])\nexport class ThermostatFanStateCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatFanStateCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatFanStateCommand.Get:\n return this.isSinglecast();\n }\n return super.supportsCommand(cmd);\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatFanStateCCAPI, { property }) {\n switch (property) {\n case \"state\":\n return this.get();\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ThermostatFanStateCommand, ThermostatFanStateCommand.Get);\n const cc = new ThermostatFanStateCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanStateCCReport>(cc, this.commandOptions);\n if (response) {\n return response?.state;\n }\n }\n}\n@commandClass(CommandClasses[\"Thermostat Fan State\"])\n@implementedVersion(2)\n@ccValues(ThermostatFanStateCCValues)\nexport class ThermostatFanStateCC extends CommandClass {\n declare ccCommand: ThermostatFanStateCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n await this.refreshValues(ctx, { tag: \"interview\" });\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 Fan State\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying current thermostat fan state...\",\n direction: \"outbound\",\n });\n const currentStatus = await api.get();\n if (currentStatus) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"received current thermostat fan state: \"\n + getEnumMemberName(ThermostatFanState, currentStatus),\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ThermostatFanStateCCReportOptions {\n state: ThermostatFanState;\n}\n@CCCommand(ThermostatFanStateCommand.Report)\n@ccValueProperty(\"state\", ThermostatFanStateCCValues.fanState)\nexport class ThermostatFanStateCCReport extends ThermostatFanStateCC {\n public constructor(options: WithAddress<ThermostatFanStateCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.state = options.state;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanStateCCReport {\n validatePayload(raw.payload.length == 1);\n const state: ThermostatFanState = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n state,\n });\n }\n public readonly state: ThermostatFanState;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n state: getEnumMemberName(ThermostatFanState, this.state),\n };\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ThermostatFanStateCommand.Get)\n@expectedCCResponse(ThermostatFanStateCCReport)\nexport class ThermostatFanStateCCGet extends ThermostatFanStateCC {\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkN;AAClN,oBAAkC;AAClC,iBAA2F;AAC3F,0BAAuH;AACvH,oCAAiH;AAEjH,mBAA+D;AAE/D,gCAA2C;IAG9B,2BAAuB,MAAA;8BADnC,mCAAI,2BAAe,sBAAsB,CAAC,CAAC;;;;oBACC;+CAAA,YAAK;WAAA;;;;;;;;AAAlD,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAA8B;AACjD,cAAQ,KAAK;QACT,KAAK,uCAA0B;AAC3B,iBAAO,KAAK,aAAY;MAChC;AACA,aAAO,MAAM,gBAAgB,GAAG;IACpC;IACA,KAAe,qBAAU,IAAC;AACtB,aAAO,eAA+C,EAAE,SAAQ,GAAE;AAC9D,gBAAQ,UAAU;UACd,KAAK;AACD,mBAAO,KAAK,IAAG;UACnB;AACI,qDAAyB,KAAK,MAAM,QAAQ;QACpD;MACJ;IACJ;;IAEO,MAAM,MAAG;AACZ,WAAK,sBAAsB,wCAA2B,uCAA0B,GAAG;AACnF,YAAM,KAAK,IAAI,wBAAwB;QACnC,QAAQ,KAAK,SAAS;QACtB,eAAe,KAAK,SAAS;OAChC;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B,QAAQ,CAAC;;;;oBACd;kDAAA,YAAoB;WAAA;;;;;;;;AAApE,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAAuD;AACtE,YAAM,OAAO;AAEb,WAAK,QAAQ,QAAQ;IACzB;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,QAA4B,IAAI,QAAQ,CAAC,IAAI;AACnD,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACgB;IACT,WAAW,KAAgB;AAC9B,YAAM,UAAyB;QAC3B,WAAO,iCAAkB,iCAAoB,KAAK,KAAK;;AAE3D,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB;;IAER;;;;IAIS,2BAAuB,MAAA;8BAFnC,yCAAU,uCAA0B,GAAG,OACvC,kDAAmB,0BAA0B,CAAC;;;;oBACF;+CAAA,YAAoB;WAAA;;;;;;;;AAAjE,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 { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, ValueMetadata, type WithAddress, enumValuesToMetadataStates, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, throwUnsupportedProperty, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatFanState, ThermostatFanStateCommand, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatFanStateCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatFanStateCCValues };\n@API(CommandClasses[\"Thermostat Fan State\"])\nexport class ThermostatFanStateCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatFanStateCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatFanStateCommand.Get:\n return this.isSinglecast();\n }\n return super.supportsCommand(cmd);\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatFanStateCCAPI, { property }) {\n switch (property) {\n case \"state\":\n return this.get();\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ThermostatFanStateCommand, ThermostatFanStateCommand.Get);\n const cc = new ThermostatFanStateCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanStateCCReport>(cc, this.commandOptions);\n if (response) {\n return response?.state;\n }\n }\n}\n@commandClass(CommandClasses[\"Thermostat Fan State\"])\n@implementedVersion(2)\n@ccValues(ThermostatFanStateCCValues)\nexport class ThermostatFanStateCC extends CommandClass {\n declare ccCommand: ThermostatFanStateCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n await this.refreshValues(ctx, { tag: \"interview\" });\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 Fan State\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying current thermostat fan state...\",\n direction: \"outbound\",\n });\n const currentStatus = await api.get();\n if (currentStatus) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"received current thermostat fan state: \"\n + getEnumMemberName(ThermostatFanState, currentStatus),\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ThermostatFanStateCCReportOptions {\n state: ThermostatFanState;\n}\n@CCCommand(ThermostatFanStateCommand.Report)\n@ccValueProperty(\"state\", ThermostatFanStateCCValues.fanState)\nexport class ThermostatFanStateCCReport extends ThermostatFanStateCC {\n public constructor(options: WithAddress<ThermostatFanStateCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.state = options.state;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanStateCCReport {\n validatePayload(raw.payload.length == 1);\n const state: ThermostatFanState = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n state,\n });\n }\n public readonly state: ThermostatFanState;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.state & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n state: getEnumMemberName(ThermostatFanState, this.state),\n };\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ThermostatFanStateCommand.Get)\n@expectedCCResponse(ThermostatFanStateCCReport)\nexport class ThermostatFanStateCCGet extends ThermostatFanStateCC {\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkN;AAClN,oBAAyC;AACzC,iBAA2F;AAC3F,0BAAuH;AACvH,oCAAiH;AAEjH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oBAAM,KAAK,CAAC,KAAK,QAAQ,EAAM,CAAC;AAC/C,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,YAAM,UAAyB;QAC3B,WAAO,iCAAkB,iCAAoB,KAAK,KAAK;;AAE3D,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB;;IAER;;;;IAIS,2BAAuB,MAAA;8BAFnC,yCAAU,uCAA0B,GAAG,OACvC,kDAAmB,0BAA0B,CAAC;;;;oBACF;+CAAA,YAAoB;WAAA;;;;;;;;AAAjE,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": []
7
7
  }
@@ -282,10 +282,10 @@ let ThermostatModeCCSet = (() => {
282
282
  mode;
283
283
  manufacturerData;
284
284
  serialize(ctx) {
285
- const manufacturerData = this.mode === import_Types.ThermostatMode["Manufacturer specific"] && this.manufacturerData ? this.manufacturerData : new Uint8Array();
285
+ const manufacturerData = this.mode === import_Types.ThermostatMode["Manufacturer specific"] && this.manufacturerData ? this.manufacturerData.subarray(0, 7) : new Uint8Array();
286
286
  const manufacturerDataLength = manufacturerData.length;
287
287
  this.payload = import_shared.Bytes.concat([
288
- [((manufacturerDataLength & 7) << 5) + (this.mode & 31)],
288
+ [(manufacturerDataLength << 5) + (this.mode & 31)],
289
289
  manufacturerData
290
290
  ]);
291
291
  return super.serialize(ctx);