@zwave-js/cc 15.19.0 → 15.20.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.
- package/build/cjs/cc/AssociationGroupInfoCC.js +1 -1
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BatteryCC.js +2 -2
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/BinarySwitchCC.js +2 -2
- package/build/cjs/cc/BinarySwitchCC.js.map +2 -2
- package/build/cjs/cc/ClimateControlScheduleCC.js +1 -1
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.js +2 -2
- package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
- package/build/cjs/cc/ConfigurationCC.js +2 -1
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/EnergyProductionCC.js +1 -1
- package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlSetpointCC.js +1 -1
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.js +3 -3
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.js +6 -6
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.js +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.js +6 -6
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.js +4 -4
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.js +6 -6
- package/build/cjs/cc/MultiChannelCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSensorCC.js +2 -2
- package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.js +3 -3
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.js +4 -4
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.js +7 -7
- package/build/cjs/cc/Security2CC.js.map +2 -2
- package/build/cjs/cc/SecurityCC.js +5 -5
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC.d.ts +11 -1
- package/build/cjs/cc/SoundSwitchCC.js +26 -1
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/SupervisionCC.js +5 -5
- package/build/cjs/cc/SupervisionCC.js.map +2 -2
- package/build/cjs/cc/ThermostatModeCC.js +2 -2
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetpointCC.js +3 -3
- package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
- package/build/cjs/cc/TimeCC.js +4 -4
- package/build/cjs/cc/TimeCC.js.map +2 -2
- package/build/cjs/cc/TransportServiceCC.js +2 -2
- package/build/cjs/cc/TransportServiceCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC.js +10 -10
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/WindowCoveringCC.js +1 -1
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWaveProtocolCC.js +8 -8
- package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
- package/build/cjs/cc/index.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +2 -2
- package/build/cjs/lib/CommandClass.js +2 -2
- package/build/cjs/lib/CommandClass.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.js +2 -2
- package/build/cjs/lib/Security2/Extension.js.map +2 -2
- package/build/cjs/lib/Values.js.map +1 -1
- package/build/cjs/lib/traits.d.ts +9 -0
- package/build/esm/cc/AssociationGroupInfoCC.js +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.js +2 -2
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +2 -2
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +2 -2
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +2 -1
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +1 -1
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.js +3 -3
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.js +6 -6
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +2 -2
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/MeterCC.js +6 -6
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +4 -4
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +6 -6
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +2 -2
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.js +3 -3
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +4 -4
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.js +7 -7
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.js +5 -5
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts +11 -1
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +26 -1
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.js +5 -5
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +2 -2
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +3 -3
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.js +4 -4
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +2 -2
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.js +10 -10
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +1 -1
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +8 -8
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/index.d.ts.map +1 -1
- package/build/esm/cc/index.js +0 -1
- package/build/esm/cc/index.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/CommandClass.js +2 -2
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/Security2/Extension.js +2 -2
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/build/esm/lib/Values.js +1 -1
- package/build/esm/lib/Values.js.map +1 -1
- package/build/esm/lib/traits.d.ts +9 -0
- package/build/esm/lib/traits.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/ClimateControlScheduleCC.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tenumValuesToMetadataStates,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\tClimateControlScheduleCommand,\n\tScheduleOverrideType,\n\ttype SetbackState,\n\ttype Switchpoint,\n\tWeekday,\n} from \"../lib/_Types.js\";\nimport {\n\tdecodeSetbackState,\n\tdecodeSwitchpoint,\n\tencodeSetbackState,\n\tencodeSwitchpoint,\n} from \"../lib/serializers.js\";\n\nexport const ClimateControlScheduleCCValues = V.defineCCValues(\n\tCommandClasses[\"Climate Control Schedule\"],\n\t{\n\t\t...V.staticProperty(\n\t\t\t\"overrideType\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Number,\n\t\t\t\tlabel: \"Override type\",\n\t\t\t\tstates: enumValuesToMetadataStates(ScheduleOverrideType),\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"overrideState\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Number,\n\t\t\t\tlabel: \"Override state\",\n\t\t\t\tmin: -12.8,\n\t\t\t} as const,\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"schedule\",\n\t\t\t\"schedule\",\n\t\t\t(weekday: Weekday) => weekday,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"switchPoints\"\n\t\t\t\t&& typeof propertyKey === \"number\"\n\t\t\t\t&& propertyKey >= Weekday.Monday\n\t\t\t\t&& propertyKey <= Weekday.Sunday,\n\t\t\t(weekday: Weekday) => ({\n\t\t\t\t...ValueMetadata.Any,\n\t\t\t\tlabel: `Schedule (${getEnumMemberName(Weekday, weekday)})`,\n\t\t\t} as const),\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Climate Control Schedule\"])\nexport class ClimateControlScheduleCCAPI extends CCAPI {\n\tpublic supportsCommand(\n\t\tcmd: ClimateControlScheduleCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase ClimateControlScheduleCommand.Set:\n\t\t\tcase ClimateControlScheduleCommand.OverrideSet:\n\t\t\t\treturn true; // mandatory\n\t\t\tcase ClimateControlScheduleCommand.Get:\n\t\t\tcase ClimateControlScheduleCommand.ChangedGet:\n\t\t\tcase ClimateControlScheduleCommand.OverrideGet:\n\t\t\t\treturn this.isSinglecast();\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async set(\n\t\tweekday: Weekday,\n\t\tswitchPoints: Switchpoint[],\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.Set,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tweekday,\n\t\t\tswitchPoints,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async get(\n\t\tweekday: Weekday,\n\t): Promise<MaybeNotKnown<readonly Switchpoint[]>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.Get,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tweekday,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tClimateControlScheduleCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.schedule;\n\t}\n\n\tpublic async getChangeCounter(): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.ChangedGet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCChangedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tClimateControlScheduleCCChangedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.changeCounter;\n\t}\n\n\t// oxlint-disable-next-line typescript/explicit-module-boundary-types\n\tpublic async getOverride() {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.OverrideGet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCOverrideGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tClimateControlScheduleCCOverrideReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\ttype: response.overrideType,\n\t\t\t\tstate: response.overrideState,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async setOverride(\n\t\ttype: ScheduleOverrideType,\n\t\tstate: SetbackState,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.OverrideSet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCOverrideSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\toverrideType: type,\n\t\t\toverrideState: state,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses[\"Climate Control Schedule\"])\n@implementedVersion(1)\n@ccValues(ClimateControlScheduleCCValues)\nexport class ClimateControlScheduleCC extends CommandClass {\n\tdeclare ccCommand: ClimateControlScheduleCommand;\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCSetOptions {\n\tweekday: Weekday;\n\tswitchPoints: Switchpoint[];\n}\n\n@CCCommand(ClimateControlScheduleCommand.Set)\n@useSupervision()\nexport class ClimateControlScheduleCCSet extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.switchPoints = options.switchPoints;\n\t\tthis.weekday = options.weekday;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic switchPoints: Switchpoint[];\n\tpublic weekday: Weekday;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\t// Make sure we have exactly 9 entries\n\t\tconst allSwitchPoints = this.switchPoints.slice(0, 9); // maximum 9\n\t\twhile (allSwitchPoints.length < 9) {\n\t\t\tallSwitchPoints.push({\n\t\t\t\thour: 0,\n\t\t\t\tminute: 0,\n\t\t\t\tstate: \"Unused\",\n\t\t\t});\n\t\t}\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.weekday & 0b111]),\n\t\t\t...allSwitchPoints.map((sp) => encodeSwitchpoint(sp)),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\tweekday: getEnumMemberName(Weekday, this.weekday),\n\t\t\t\tswitchpoints: this.switchPoints\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${\n\t\t\t\t\t\t\tsp.minute.toString().padStart(\n\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\"0\",\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} --> ${sp.state}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCReportOptions {\n\tweekday: Weekday;\n\tschedule: Switchpoint[];\n}\n\n@CCCommand(ClimateControlScheduleCommand.Report)\n@ccValueProperty(\n\t\"schedule\",\n\tClimateControlScheduleCCValues.schedule,\n\t(self) => [self.weekday],\n)\nexport class ClimateControlScheduleCCReport extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.weekday = options.weekday;\n\t\tthis.schedule = options.schedule;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCReport {\n\t\tvalidatePayload(raw.payload.length >= 28);\n\t\tconst weekday: Weekday = raw.payload[0] & 0b111;\n\t\tconst allSwitchpoints: Switchpoint[] = [];\n\t\tfor (let i = 0; i <= 8; i++) {\n\t\t\tallSwitchpoints.push(\n\t\t\t\tdecodeSwitchpoint(raw.payload.subarray(1 + 3 * i)),\n\t\t\t);\n\t\t}\n\n\t\tconst schedule: Switchpoint[] = allSwitchpoints.filter((sp) =>\n\t\t\tsp.state !== \"Unused\"\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tweekday,\n\t\t\tschedule,\n\t\t});\n\t}\n\n\tpublic readonly weekday: Weekday;\n\n\tpublic readonly schedule: readonly Switchpoint[];\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\tweekday: getEnumMemberName(Weekday, this.weekday),\n\t\t\t\tschedule: this.schedule\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${\n\t\t\t\t\t\t\tsp.minute.toString().padStart(\n\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\"0\",\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} --> ${sp.state}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCGetOptions {\n\tweekday: Weekday;\n}\n\n@CCCommand(ClimateControlScheduleCommand.Get)\n@expectedCCResponse(ClimateControlScheduleCCReport)\nexport class ClimateControlScheduleCCGet extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.weekday = options.weekday;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCGet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCGet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic weekday: Weekday;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.weekday & 0b111]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { weekday: getEnumMemberName(Weekday, this.weekday) },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCChangedReportOptions {\n\tchangeCounter: number;\n}\n\n@CCCommand(ClimateControlScheduleCommand.ChangedReport)\nexport class ClimateControlScheduleCCChangedReport\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCChangedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.changeCounter = options.changeCounter;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCChangedReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst changeCounter = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tchangeCounter,\n\t\t});\n\t}\n\n\tpublic readonly changeCounter: number;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"change counter\": this.changeCounter },\n\t\t};\n\t}\n}\n\n@CCCommand(ClimateControlScheduleCommand.ChangedGet)\n@expectedCCResponse(ClimateControlScheduleCCChangedReport)\nexport class ClimateControlScheduleCCChangedGet\n\textends ClimateControlScheduleCC\n{}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideReportOptions {\n\toverrideType: ScheduleOverrideType;\n\toverrideState: SetbackState;\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideReport)\n@ccValueProperty(\"overrideType\", ClimateControlScheduleCCValues.overrideType)\n@ccValueProperty(\"overrideState\", ClimateControlScheduleCCValues.overrideState)\nexport class ClimateControlScheduleCCOverrideReport\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCOverrideReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.overrideType = options.overrideType;\n\t\tthis.overrideState = options.overrideState;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCOverrideReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst overrideType: ScheduleOverrideType = raw.payload[0] & 0b11;\n\t\tconst overrideState: SetbackState = decodeSetbackState(raw.payload, 1)\n\t\t\t// If we receive an unknown setback state, return the raw value\n\t\t\t|| raw.payload.readInt8(1);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\toverrideType,\n\t\t\toverrideState,\n\t\t});\n\t}\n\n\tpublic readonly overrideType: ScheduleOverrideType;\n\n\tpublic readonly overrideState: SetbackState;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"override type\": getEnumMemberName(\n\t\t\t\t\tScheduleOverrideType,\n\t\t\t\t\tthis.overrideType,\n\t\t\t\t),\n\t\t\t\t\"override state\": this.overrideState,\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideGet)\n@expectedCCResponse(ClimateControlScheduleCCOverrideReport)\nexport class ClimateControlScheduleCCOverrideGet\n\textends ClimateControlScheduleCC\n{}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideSetOptions {\n\toverrideType: ScheduleOverrideType;\n\toverrideState: SetbackState;\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideSet)\n@useSupervision()\nexport class ClimateControlScheduleCCOverrideSet\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCOverrideSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.overrideType = options.overrideType;\n\t\tthis.overrideState = options.overrideState;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCOverrideSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCOverrideSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic overrideType: ScheduleOverrideType;\n\tpublic overrideState: SetbackState;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.overrideType & 0b11],\n\t\t\tencodeSetbackState(this.overrideState),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"override type\": getEnumMemberName(\n\t\t\t\t\tScheduleOverrideType,\n\t\t\t\t\tthis.overrideType,\n\t\t\t\t),\n\t\t\t\t\"override state\": this.overrideState,\n\t\t\t},\n\t\t};\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAYO;AACP,oBAAyC;AAEzC,iBAAsB;AACtB,0BAAyC;AACzC,oCASO;A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essageOrCCLogEntry,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tenumValuesToMetadataStates,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\tClimateControlScheduleCommand,\n\tScheduleOverrideType,\n\ttype SetbackState,\n\ttype Switchpoint,\n\tWeekday,\n} from \"../lib/_Types.js\";\nimport {\n\tdecodeSetbackState,\n\tdecodeSwitchpoint,\n\tencodeSetbackState,\n\tencodeSwitchpoint,\n} from \"../lib/serializers.js\";\n\nexport const ClimateControlScheduleCCValues = V.defineCCValues(\n\tCommandClasses[\"Climate Control Schedule\"],\n\t{\n\t\t...V.staticProperty(\n\t\t\t\"overrideType\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Number,\n\t\t\t\tlabel: \"Override type\",\n\t\t\t\tstates: enumValuesToMetadataStates(ScheduleOverrideType),\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"overrideState\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Number,\n\t\t\t\tlabel: \"Override state\",\n\t\t\t\tmin: -12.8,\n\t\t\t} as const,\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"schedule\",\n\t\t\t\"schedule\",\n\t\t\t(weekday: Weekday) => weekday,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"switchPoints\"\n\t\t\t\t&& typeof propertyKey === \"number\"\n\t\t\t\t&& propertyKey >= Weekday.Monday\n\t\t\t\t&& propertyKey <= Weekday.Sunday,\n\t\t\t(weekday: Weekday) => ({\n\t\t\t\t...ValueMetadata.Any,\n\t\t\t\tlabel: `Schedule (${getEnumMemberName(Weekday, weekday)})`,\n\t\t\t} as const),\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Climate Control Schedule\"])\nexport class ClimateControlScheduleCCAPI extends CCAPI {\n\tpublic supportsCommand(\n\t\tcmd: ClimateControlScheduleCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase ClimateControlScheduleCommand.Set:\n\t\t\tcase ClimateControlScheduleCommand.OverrideSet:\n\t\t\t\treturn true; // mandatory\n\t\t\tcase ClimateControlScheduleCommand.Get:\n\t\t\tcase ClimateControlScheduleCommand.ChangedGet:\n\t\t\tcase ClimateControlScheduleCommand.OverrideGet:\n\t\t\t\treturn this.isSinglecast();\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async set(\n\t\tweekday: Weekday,\n\t\tswitchPoints: Switchpoint[],\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.Set,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tweekday,\n\t\t\tswitchPoints,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async get(\n\t\tweekday: Weekday,\n\t): Promise<MaybeNotKnown<readonly Switchpoint[]>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.Get,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tweekday,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tClimateControlScheduleCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.schedule;\n\t}\n\n\tpublic async getChangeCounter(): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.ChangedGet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCChangedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tClimateControlScheduleCCChangedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.changeCounter;\n\t}\n\n\t// oxlint-disable-next-line typescript/explicit-module-boundary-types\n\tpublic async getOverride() {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.OverrideGet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCOverrideGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tClimateControlScheduleCCOverrideReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\ttype: response.overrideType,\n\t\t\t\tstate: response.overrideState,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async setOverride(\n\t\ttype: ScheduleOverrideType,\n\t\tstate: SetbackState,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.OverrideSet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCOverrideSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\toverrideType: type,\n\t\t\toverrideState: state,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses[\"Climate Control Schedule\"])\n@implementedVersion(1)\n@ccValues(ClimateControlScheduleCCValues)\nexport class ClimateControlScheduleCC extends CommandClass {\n\tdeclare ccCommand: ClimateControlScheduleCommand;\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCSetOptions {\n\tweekday: Weekday;\n\tswitchPoints: Switchpoint[];\n}\n\n@CCCommand(ClimateControlScheduleCommand.Set)\n@useSupervision()\nexport class ClimateControlScheduleCCSet extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.switchPoints = options.switchPoints;\n\t\tthis.weekday = options.weekday;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic switchPoints: Switchpoint[];\n\tpublic weekday: Weekday;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\t// Make sure we have exactly 9 entries\n\t\tconst allSwitchPoints = this.switchPoints.slice(0, 9); // maximum 9\n\t\twhile (allSwitchPoints.length < 9) {\n\t\t\tallSwitchPoints.push({\n\t\t\t\thour: 0,\n\t\t\t\tminute: 0,\n\t\t\t\tstate: \"Unused\",\n\t\t\t});\n\t\t}\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.weekday & 0b111],\n\t\t\t...allSwitchPoints.map((sp) => encodeSwitchpoint(sp)),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\tweekday: getEnumMemberName(Weekday, this.weekday),\n\t\t\t\tswitchpoints: this.switchPoints\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${\n\t\t\t\t\t\t\tsp.minute.toString().padStart(\n\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\"0\",\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} --> ${sp.state}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCReportOptions {\n\tweekday: Weekday;\n\tschedule: Switchpoint[];\n}\n\n@CCCommand(ClimateControlScheduleCommand.Report)\n@ccValueProperty(\n\t\"schedule\",\n\tClimateControlScheduleCCValues.schedule,\n\t(self) => [self.weekday],\n)\nexport class ClimateControlScheduleCCReport extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.weekday = options.weekday;\n\t\tthis.schedule = options.schedule;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCReport {\n\t\tvalidatePayload(raw.payload.length >= 28);\n\t\tconst weekday: Weekday = raw.payload[0] & 0b111;\n\t\tconst allSwitchpoints: Switchpoint[] = [];\n\t\tfor (let i = 0; i <= 8; i++) {\n\t\t\tallSwitchpoints.push(\n\t\t\t\tdecodeSwitchpoint(raw.payload.subarray(1 + 3 * i)),\n\t\t\t);\n\t\t}\n\n\t\tconst schedule: Switchpoint[] = allSwitchpoints.filter((sp) =>\n\t\t\tsp.state !== \"Unused\"\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tweekday,\n\t\t\tschedule,\n\t\t});\n\t}\n\n\tpublic readonly weekday: Weekday;\n\n\tpublic readonly schedule: readonly Switchpoint[];\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\tweekday: getEnumMemberName(Weekday, this.weekday),\n\t\t\t\tschedule: this.schedule\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${\n\t\t\t\t\t\t\tsp.minute.toString().padStart(\n\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\"0\",\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} --> ${sp.state}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCGetOptions {\n\tweekday: Weekday;\n}\n\n@CCCommand(ClimateControlScheduleCommand.Get)\n@expectedCCResponse(ClimateControlScheduleCCReport)\nexport class ClimateControlScheduleCCGet extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.weekday = options.weekday;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCGet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCGet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic weekday: Weekday;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.weekday & 0b111]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { weekday: getEnumMemberName(Weekday, this.weekday) },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCChangedReportOptions {\n\tchangeCounter: number;\n}\n\n@CCCommand(ClimateControlScheduleCommand.ChangedReport)\nexport class ClimateControlScheduleCCChangedReport\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCChangedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.changeCounter = options.changeCounter;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCChangedReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst changeCounter = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tchangeCounter,\n\t\t});\n\t}\n\n\tpublic readonly changeCounter: number;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"change counter\": this.changeCounter },\n\t\t};\n\t}\n}\n\n@CCCommand(ClimateControlScheduleCommand.ChangedGet)\n@expectedCCResponse(ClimateControlScheduleCCChangedReport)\nexport class ClimateControlScheduleCCChangedGet\n\textends ClimateControlScheduleCC\n{}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideReportOptions {\n\toverrideType: ScheduleOverrideType;\n\toverrideState: SetbackState;\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideReport)\n@ccValueProperty(\"overrideType\", ClimateControlScheduleCCValues.overrideType)\n@ccValueProperty(\"overrideState\", ClimateControlScheduleCCValues.overrideState)\nexport class ClimateControlScheduleCCOverrideReport\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCOverrideReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.overrideType = options.overrideType;\n\t\tthis.overrideState = options.overrideState;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCOverrideReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst overrideType: ScheduleOverrideType = raw.payload[0] & 0b11;\n\t\tconst overrideState: SetbackState = decodeSetbackState(raw.payload, 1)\n\t\t\t// If we receive an unknown setback state, return the raw value\n\t\t\t|| raw.payload.readInt8(1);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\toverrideType,\n\t\t\toverrideState,\n\t\t});\n\t}\n\n\tpublic readonly overrideType: ScheduleOverrideType;\n\n\tpublic readonly overrideState: SetbackState;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"override type\": getEnumMemberName(\n\t\t\t\t\tScheduleOverrideType,\n\t\t\t\t\tthis.overrideType,\n\t\t\t\t),\n\t\t\t\t\"override state\": this.overrideState,\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideGet)\n@expectedCCResponse(ClimateControlScheduleCCOverrideReport)\nexport class ClimateControlScheduleCCOverrideGet\n\textends ClimateControlScheduleCC\n{}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideSetOptions {\n\toverrideType: ScheduleOverrideType;\n\toverrideState: SetbackState;\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideSet)\n@useSupervision()\nexport class ClimateControlScheduleCCOverrideSet\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCOverrideSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.overrideType = options.overrideType;\n\t\tthis.overrideState = options.overrideState;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCOverrideSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCOverrideSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic overrideType: ScheduleOverrideType;\n\tpublic overrideState: SetbackState;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.overrideType & 0b11],\n\t\t\tencodeSetbackState(this.overrideState),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"override type\": getEnumMemberName(\n\t\t\t\t\tScheduleOverrideType,\n\t\t\t\t\tthis.overrideType,\n\t\t\t\t),\n\t\t\t\t\"override state\": this.overrideState,\n\t\t\t},\n\t\t};\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAYO;AACP,oBAAyC;AAEzC,iBAAsB;AACtB,0BAAyC;AACzC,oCASO;AACP,oBAAkB;AAClB,mBAMO;AACP,yBAKO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuCM,+BAA2B,MAAA;8BADvC,mCAAI,2BAAe,0BAA0B,CAAC,CAAC;;;;oBACC;;;;;mDAAA,YAAK;WAAA;;;;;;;;yBAgBpD,6CAAa,EAAE,aAAa,KAAI,CAAE,CAAC;yBA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AmB,sCAAsC,CAAC;;;;oBAElD;2DAAA,YAAwB;WAAA;;;;;;;;AADjC,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;IAYA,uCAAmC,MAAA;8BAF/C,yCAAU,2CAA8B,WAAW,OACnD,8CAAc,CAAE;;;;oBAER;2DAAA,YAAwB;WAAA;;;;;;;;AADjC,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IAGZ,YACC,SAAgE;AAEhE,YAAM,OAAO;AACb,WAAK,eAAe,QAAQ;AAC5B,WAAK,gBAAgB,QAAQ;IAC9B;IAEO,OAAO,KACb,MACA,MAAsB;AAEtB,YAAM,IAAI,uBACT,GAAG,KAAK,IAAI,qCACZ,4BAAgB,8BAA8B;IAMhD;IAEO;IACA;IAEA,UAAU,KAAsB;AACtC,WAAK,UAAU,oBAAM,OAAO;QAC3B,CAAC,KAAK,eAAe,CAAI;YACzB,uCAAmB,KAAK,aAAa;OACrC;AACD,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACR,qBAAiB,iCAChB,mCACA,KAAK,YAAY;UAElB,kBAAkB,KAAK;;;IAG1B;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -597,10 +597,10 @@ let ColorSwitchCCReport = (() => {
|
|
|
597
597
|
if (this.targetValue != void 0 && this.duration != void 0) {
|
|
598
598
|
this.payload = import_shared.Bytes.concat([
|
|
599
599
|
this.payload,
|
|
600
|
-
|
|
600
|
+
[
|
|
601
601
|
this.targetValue ?? 254,
|
|
602
602
|
(this.duration ?? import_core.Duration.default()).serializeReport()
|
|
603
|
-
]
|
|
603
|
+
]
|
|
604
604
|
]);
|
|
605
605
|
}
|
|
606
606
|
return super.serialize(ctx);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/ColorSwitchCC.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\tDuration,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\ttype ValueDB,\n\ttype ValueID,\n\tValueMetadata,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tencodeBitMask,\n\tisUnsupervisedOrSucceeded,\n\tparseBitMask,\n\tsupervisedCommandSucceeded,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport {\n\tBytes,\n\tgetEnumMemberName,\n\tisEnumMember,\n\tkeysOf,\n\tpick,\n} from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { clamp } from \"alcalzone-shared/math\";\nimport { isObject } from \"alcalzone-shared/typeguards\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\ttype SetValueImplementation,\n\tthrowMissingPropertyKey,\n\tthrowUnsupportedProperty,\n\tthrowUnsupportedPropertyKey,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\tColorComponent,\n\tColorComponentMap,\n\ttype ColorKey,\n\tColorSwitchCommand,\n\ttype ColorTable,\n\tLevelChangeDirection,\n} from \"../lib/_Types.js\";\n\nconst hexColorRegex =\n\t/^#?(?<red>[0-9a-f]{2})(?<green>[0-9a-f]{2})(?<blue>[0-9a-f]{2})$/i;\n\nconst colorTableKeys = [\n\t...keysOf(ColorComponent),\n\t...keysOf(ColorComponentMap),\n];\n\nfunction colorTableKeyToComponent(key: string): ColorComponent {\n\tif (/^\\d+$/.test(key)) {\n\t\treturn parseInt(key, 10);\n\t} else if (key in ColorComponentMap) {\n\t\treturn (ColorComponentMap as any)[key];\n\t} else if (key in ColorComponent) {\n\t\treturn (ColorComponent as any)[key];\n\t}\n\tthrow new ZWaveError(\n\t\t`Invalid color key ${key}!`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nfunction colorComponentToTableKey(\n\tcomponent: ColorComponent,\n): ColorKey | undefined {\n\tfor (const [key, comp] of Object.entries(ColorComponentMap)) {\n\t\tif (comp === component) return key as any;\n\t}\n}\n\nexport const ColorSwitchCCValues = V.defineCCValues(\n\tCommandClasses[\"Color Switch\"],\n\t{\n\t\t...V.staticProperty(\"supportedColorComponents\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t\t...V.staticProperty(\"supportsHexColor\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"currentColor\",\n\t\t\t\"currentColor\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnly,\n\t\t\t\tlabel: `Current color`,\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"targetColor\",\n\t\t\t\"targetColor\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Any,\n\t\t\t\tlabel: `Target color`,\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"duration\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyDuration,\n\t\t\t\tlabel: \"Remaining duration\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"hexColor\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Color,\n\t\t\t\tminLength: 6,\n\t\t\t\tmaxLength: 7, // to allow #rrggbb\n\t\t\t\tlabel: `RGB Color`,\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"currentColorChannel\",\n\t\t\t\"currentColor\",\n\t\t\t(component: ColorComponent) => component,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"currentColor\" && typeof propertyKey === \"number\",\n\t\t\t(component: ColorComponent) => {\n\t\t\t\tconst colorName = getEnumMemberName(ColorComponent, component);\n\t\t\t\treturn {\n\t\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\t\tlabel: `Current value (${colorName})`,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t`The current value of the ${colorName} channel.`,\n\t\t\t\t} as const;\n\t\t\t},\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"targetColorChannel\",\n\t\t\t\"targetColor\",\n\t\t\t(component: ColorComponent) => component,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"targetColor\" && typeof propertyKey === \"number\",\n\t\t\t(component: ColorComponent) => {\n\t\t\t\tconst colorName = getEnumMemberName(ColorComponent, component);\n\t\t\t\treturn {\n\t\t\t\t\t...ValueMetadata.UInt8,\n\t\t\t\t\tlabel: `Target value (${colorName})`,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t`The target value of the ${colorName} channel.`,\n\t\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t\t} as const;\n\t\t\t},\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Color Switch\"])\nexport class ColorSwitchCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: ColorSwitchCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase ColorSwitchCommand.SupportedGet:\n\t\t\tcase ColorSwitchCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase ColorSwitchCommand.Set:\n\t\t\tcase ColorSwitchCommand.StartLevelChange:\n\t\t\tcase ColorSwitchCommand.StopLevelChange:\n\t\t\t\treturn true; // These are mandatory\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\tpublic async getSupported(): Promise<\n\t\tMaybeNotKnown<readonly ColorComponent[]>\n\t> {\n\t\tthis.assertSupportsCommand(\n\t\t\tColorSwitchCommand,\n\t\t\tColorSwitchCommand.SupportedGet,\n\t\t);\n\n\t\tconst cc = new ColorSwitchCCSupportedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tColorSwitchCCSupportedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.supportedColorComponents;\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\t// oxlint-disable-next-line typescript/explicit-module-boundary-types\n\tpublic async get(component: ColorComponent) {\n\t\tthis.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Get);\n\n\t\tconst cc = new ColorSwitchCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tcolorComponent: component,\n\t\t});\n\t\tconst response = await this.host.sendCommand<ColorSwitchCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"currentValue\", \"targetValue\", \"duration\"]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async set(\n\t\toptions: ColorSwitchCCSetOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Set);\n\n\t\tconst cc = new ColorSwitchCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\n\t\tconst result = await this.host.sendCommand(cc, this.commandOptions);\n\n\t\tif (isUnsupervisedOrSucceeded(result)) {\n\t\t\t// If the command did not fail, assume that it succeeded and update the values accordingly\n\t\t\t// TODO: The API methods should not modify the value DB directly, but to do so\n\t\t\t// this requires a nicer way of synchronizing hexColor with the others\n\t\t\tif (this.isSinglecast()) {\n\t\t\t\t// Update each color component separately and record the changes to the compound value\n\t\t\t\tthis.updateCurrentColor(this.getValueDB(), cc.colorTable);\n\t\t\t} else if (this.isMulticast()) {\n\t\t\t\t// Figure out which nodes were affected by this command\n\t\t\t\tconst affectedNodes = this.endpoint.node.physicalNodes.filter(\n\t\t\t\t\t(node) =>\n\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t\t?.supportsCC(this.ccId),\n\t\t\t\t);\n\t\t\t\t// and optimistically update the currentColor\n\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\tconst valueDB = this.host.tryGetValueDB(node.id);\n\t\t\t\t\tif (valueDB) {\n\t\t\t\t\t\tthis.updateCurrentColor(valueDB, cc.colorTable);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** Updates the current color for a given node by merging in the given changes */\n\tprivate updateCurrentColor(valueDB: ValueDB, colorTable: ColorTable) {\n\t\tlet updatedRGB = false;\n\t\tconst currentColorValueId = ColorSwitchCCValues.currentColor.endpoint(\n\t\t\tthis.endpoint.index,\n\t\t);\n\t\tconst targetColorValueId = ColorSwitchCCValues.targetColor.endpoint(\n\t\t\tthis.endpoint.index,\n\t\t);\n\t\tconst currentCompoundColor =\n\t\t\tvalueDB.getValue<Partial<Record<ColorKey, number>>>(\n\t\t\t\tcurrentColorValueId,\n\t\t\t) ?? {};\n\t\tconst targetCompoundColor =\n\t\t\tvalueDB.getValue<Partial<Record<ColorKey, number>>>(\n\t\t\t\ttargetColorValueId,\n\t\t\t) ?? {};\n\n\t\tfor (const [key, value] of Object.entries(colorTable)) {\n\t\t\tconst component = colorTableKeyToComponent(key);\n\t\t\tif (\n\t\t\t\tcomponent === ColorComponent.Red\n\t\t\t\t|| component === ColorComponent.Green\n\t\t\t\t|| component === ColorComponent.Blue\n\t\t\t) {\n\t\t\t\tupdatedRGB = true;\n\t\t\t}\n\n\t\t\tvalueDB.setValue(\n\t\t\t\tColorSwitchCCValues.currentColorChannel(component).endpoint(\n\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t),\n\t\t\t\tvalue,\n\t\t\t);\n\n\t\t\t// Update the compound value\n\t\t\tif (key in ColorComponentMap) {\n\t\t\t\tcurrentCompoundColor[key as ColorKey] = value;\n\t\t\t\ttargetCompoundColor[key as ColorKey] = value;\n\t\t\t}\n\t\t}\n\t\t// And store the updated compound values\n\t\tvalueDB.setValue(currentColorValueId, currentCompoundColor);\n\t\tvalueDB.setValue(targetColorValueId, targetCompoundColor);\n\n\t\t// and hex color if necessary\n\t\tconst supportsHex = valueDB.getValue<boolean>(\n\t\t\tColorSwitchCCValues.supportsHexColor.endpoint(this.endpoint.index),\n\t\t);\n\t\tif (supportsHex && updatedRGB) {\n\t\t\tconst hexValueId = ColorSwitchCCValues.hexColor.endpoint(\n\t\t\t\tthis.endpoint.index,\n\t\t\t);\n\t\t\tconst [r, g, b] = [\n\t\t\t\tColorComponent.Red,\n\t\t\t\tColorComponent.Green,\n\t\t\t\tColorComponent.Blue,\n\t\t\t].map(\n\t\t\t\t(c) =>\n\t\t\t\t\tvalueDB.getValue<number>(\n\t\t\t\t\t\tColorSwitchCCValues.currentColorChannel(c).endpoint(\n\t\t\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t\t\t),\n\t\t\t\t\t) ?? 0,\n\t\t\t);\n\t\t\tconst hexValue = (r << 16) | (g << 8) | b;\n\t\t\tvalueDB.setValue(\n\t\t\t\thexValueId,\n\t\t\t\thexValue.toString(16).padStart(6, \"0\"),\n\t\t\t);\n\t\t}\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async startLevelChange(\n\t\toptions: ColorSwitchCCStartLevelChangeOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tColorSwitchCommand,\n\t\t\tColorSwitchCommand.StartLevelChange,\n\t\t);\n\n\t\tconst cc = new ColorSwitchCCStartLevelChange({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async stopLevelChange(\n\t\tcolorComponent: ColorComponent,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tColorSwitchCommand,\n\t\t\tColorSwitchCommand.StopLevelChange,\n\t\t);\n\n\t\tconst cc = new ColorSwitchCCStopLevelChange({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tcolorComponent,\n\t\t});\n\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: ColorSwitchCCAPI,\n\t\t\t{ property, propertyKey },\n\t\t\tvalue,\n\t\t\toptions,\n\t\t) {\n\t\t\tif (property === \"targetColor\") {\n\t\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\t\tif (propertyKey != undefined) {\n\t\t\t\t\t// Single color component, only accepts numbers\n\t\t\t\t\tif (typeof propertyKey !== \"number\") {\n\t\t\t\t\t\tthrowUnsupportedPropertyKey(\n\t\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (typeof value !== \"number\") {\n\t\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\ttypeof value,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst result = await this.set({\n\t\t\t\t\t\t[propertyKey]: value,\n\t\t\t\t\t\tduration,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.isSinglecast()\n\t\t\t\t\t\t&& !supervisedCommandSucceeded(result)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Verify the current value after a (short) delay, unless the command was supervised and successful\n\t\t\t\t\t\tthis.schedulePoll({ property, propertyKey }, value, {\n\t\t\t\t\t\t\tduration,\n\t\t\t\t\t\t\ttransition: \"fast\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\t// Set the compound color object\n\n\t\t\t\t\t// Ensure the value is an object with only valid keys\n\t\t\t\t\tif (\n\t\t\t\t\t\t!isObject(value)\n\t\t\t\t\t\t|| !Object.keys(value).every(\n\t\t\t\t\t\t\t(key) => key in ColorComponentMap,\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\t\t`${\n\t\t\t\t\t\t\t\tCommandClasses[this.ccId]\n\t\t\t\t\t\t\t}: \"${property}\" must be set to an object which specifies each color channel`,\n\t\t\t\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Ensure that each property is numeric\n\t\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\t\tif (typeof val !== \"number\") {\n\t\t\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\t\t\t`${property}.${key}`,\n\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\ttypeof val,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// GH#2527: strip unsupported color components, because some devices don't react otherwise\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\tconst supportedColors = this.tryGetValueDB()?.getValue<\n\t\t\t\t\t\t\treadonly ColorComponent[]\n\t\t\t\t\t\t>(\n\t\t\t\t\t\t\tColorSwitchCCValues.supportedColorComponents\n\t\t\t\t\t\t\t\t.endpoint(\n\t\t\t\t\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (supportedColors) {\n\t\t\t\t\t\t\tvalue = pick(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tsupportedColors\n\t\t\t\t\t\t\t\t\t.map((c) => colorComponentToTableKey(c))\n\t\t\t\t\t\t\t\t\t.filter((c) => !!c),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Avoid sending empty commands\n\t\t\t\t\tif (Object.keys(value as any).length === 0) return;\n\n\t\t\t\t\treturn this.set({ ...(value as ColorTable), duration });\n\n\t\t\t\t\t// We're not going to poll each color component separately\n\t\t\t\t}\n\t\t\t} else if (property === \"hexColor\") {\n\t\t\t\t// No property key, this is the hex color #rrggbb\n\t\t\t\tif (typeof value !== \"string\") {\n\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\"string\",\n\t\t\t\t\t\ttypeof value,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\t\treturn this.set({ hexColor: value, duration });\n\t\t\t} else {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic isSetValueOptimistic(_valueId: ValueID): boolean {\n\t\treturn false; // Color Switch CC handles updating the value DB itself\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(\n\t\t\tthis: ColorSwitchCCAPI,\n\t\t\t{ property, propertyKey },\n\t\t) {\n\t\t\tif (propertyKey == undefined) {\n\t\t\t\tthrowMissingPropertyKey(this.ccId, property);\n\t\t\t} else if (typeof propertyKey !== \"number\") {\n\t\t\t\tthrowUnsupportedPropertyKey(this.ccId, property, propertyKey);\n\t\t\t}\n\n\t\t\tswitch (property) {\n\t\t\t\tcase \"currentColor\":\n\t\t\t\t\treturn (await this.get(propertyKey))?.currentValue;\n\t\t\t\tcase \"targetColor\":\n\t\t\t\t\treturn (await this.get(propertyKey))?.targetValue;\n\t\t\t\tcase \"duration\":\n\t\t\t\t\treturn (await this.get(propertyKey))?.duration;\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Color Switch\"])\n@implementedVersion(3)\n@ccValues(ColorSwitchCCValues)\nexport class ColorSwitchCC extends CommandClass {\n\tdeclare ccCommand: ColorSwitchCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Color Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying supported colors...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst supportedColors = await api.getSupported();\n\t\tif (!supportedColors) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t\"Querying supported colors timed out, skipping interview...\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `received supported colors:${\n\t\t\t\tsupportedColors\n\t\t\t\t\t.map((c) => `\\n\u00B7 ${getEnumMemberName(ColorComponent, c)}`)\n\t\t\t\t\t.join(\"\")\n\t\t\t}`,\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\t// Create metadata for the separate color channels\n\t\tfor (const color of supportedColors) {\n\t\t\tconst currentColorChannelValue = ColorSwitchCCValues\n\t\t\t\t.currentColorChannel(color);\n\t\t\tthis.setMetadata(ctx, currentColorChannelValue);\n\n\t\t\tconst targetColorChannelValue = ColorSwitchCCValues\n\t\t\t\t.targetColorChannel(color);\n\t\t\tthis.setMetadata(ctx, targetColorChannelValue);\n\t\t}\n\t\t// And the compound one\n\t\tconst currentColorValue = ColorSwitchCCValues.currentColor;\n\t\tthis.setMetadata(ctx, currentColorValue);\n\t\tconst targetColorValue = ColorSwitchCCValues.targetColor;\n\t\tthis.setMetadata(ctx, targetColorValue);\n\n\t\t// Create the collective HEX color values\n\t\tconst supportsHex = [\n\t\t\tColorComponent.Red,\n\t\t\tColorComponent.Green,\n\t\t\tColorComponent.Blue,\n\t\t].every((c) => supportedColors.includes(c));\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tColorSwitchCCValues.supportsHexColor,\n\t\t\tsupportsHex,\n\t\t);\n\t\tif (supportsHex) {\n\t\t\tconst hexColorValue = ColorSwitchCCValues.hexColor;\n\t\t\tthis.setMetadata(ctx, hexColorValue);\n\t\t}\n\n\t\t// Query all color components\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Color Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tconst supportedColors: readonly ColorComponent[] = this.getValue(\n\t\t\tctx,\n\t\t\tColorSwitchCCValues.supportedColorComponents,\n\t\t) ?? [];\n\n\t\tfor (const color of supportedColors) {\n\t\t\t// Some devices report invalid colors, but the CC API checks\n\t\t\t// for valid values and throws otherwise.\n\t\t\tif (!isEnumMember(ColorComponent, color)) continue;\n\n\t\t\tconst colorName = getEnumMemberName(ColorComponent, color);\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `querying current color state (${colorName})`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tawait api.get(color);\n\t\t}\n\t}\n\n\tpublic translatePropertyKey(\n\t\tctx: GetValueDB,\n\t\tproperty: string | number,\n\t\tpropertyKey: string | number,\n\t): string | undefined {\n\t\tif (\n\t\t\t(property === \"currentColor\" || property === \"targetColor\")\n\t\t\t&& typeof propertyKey === \"number\"\n\t\t) {\n\t\t\tconst translated = ColorComponent[propertyKey];\n\t\t\tif (translated) return translated;\n\t\t}\n\t\treturn super.translatePropertyKey(ctx, property, propertyKey);\n\t}\n}\n\n// @publicAPI\nexport interface ColorSwitchCCSupportedReportOptions {\n\tsupportedColorComponents: readonly ColorComponent[];\n}\n\n@CCCommand(ColorSwitchCommand.SupportedReport)\n@ccValueProperty(\n\t\"supportedColorComponents\",\n\tColorSwitchCCValues.supportedColorComponents,\n)\nexport class ColorSwitchCCSupportedReport extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.supportedColorComponents = options.supportedColorComponents;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ColorSwitchCCSupportedReport {\n\t\t// Docs say 'variable length', but the table shows 2 bytes.\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst supportedColorComponents: ColorComponent[] = parseBitMask(\n\t\t\traw.payload.subarray(0, 2),\n\t\t\tColorComponent[\"Warm White\"],\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsupportedColorComponents,\n\t\t});\n\t}\n\n\tpublic readonly supportedColorComponents: readonly ColorComponent[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = encodeBitMask(\n\t\t\tthis.supportedColorComponents,\n\t\t\t15, // fixed 2 bytes\n\t\t\tColorComponent[\"Warm White\"],\n\t\t);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"supported color components\": this.supportedColorComponents\n\t\t\t\t\t.map((c) => `\\n\u00B7 ${getEnumMemberName(ColorComponent, c)}`)\n\t\t\t\t\t.join(\"\"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(ColorSwitchCommand.SupportedGet)\n@expectedCCResponse(ColorSwitchCCSupportedReport)\nexport class ColorSwitchCCSupportedGet extends ColorSwitchCC {}\n\n// @publicAPI\nexport interface ColorSwitchCCReportOptions {\n\tcolorComponent: ColorComponent;\n\tcurrentValue: number;\n\ttargetValue?: number;\n\tduration?: Duration | string;\n}\n\n@CCCommand(ColorSwitchCommand.Report)\n@ccValueProperty(\n\t\"currentValue\",\n\tColorSwitchCCValues.currentColorChannel,\n\t(self) => [self.colorComponent],\n)\n@ccValueProperty(\n\t\"targetValue\",\n\tColorSwitchCCValues.targetColorChannel,\n\t(self) => [self.colorComponent],\n)\n@ccValueProperty(\"duration\", ColorSwitchCCValues.duration)\nexport class ColorSwitchCCReport extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.colorComponent = options.colorComponent;\n\t\tthis.currentValue = options.currentValue;\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst colorComponent: ColorComponent = raw.payload[0];\n\t\tconst currentValue = raw.payload[1];\n\t\tlet targetValue: number | undefined;\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 4) {\n\t\t\ttargetValue = raw.payload[2];\n\t\t\tduration = Duration.parseReport(raw.payload[3]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcolorComponent,\n\t\t\tcurrentValue,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\t// Duration is stored globally instead of per component\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Update compound current value\n\t\tconst colorTableKey = colorComponentToTableKey(this.colorComponent);\n\t\tif (colorTableKey) {\n\t\t\tconst compoundCurrentColorValue = ColorSwitchCCValues.currentColor;\n\t\t\tconst compoundCurrentColor: Partial<Record<ColorKey, number>> =\n\t\t\t\tthis.getValue(ctx, compoundCurrentColorValue) ?? {};\n\t\t\tcompoundCurrentColor[colorTableKey] = this.currentValue;\n\t\t\tthis.setValue(\n\t\t\t\tctx,\n\t\t\t\tcompoundCurrentColorValue,\n\t\t\t\tcompoundCurrentColor,\n\t\t\t);\n\n\t\t\t// and target value\n\t\t\tif (this.targetValue != undefined) {\n\t\t\t\tconst compoundTargetColorValue =\n\t\t\t\t\tColorSwitchCCValues.targetColor;\n\t\t\t\tconst compoundTargetColor: Partial<Record<ColorKey, number>> =\n\t\t\t\t\tthis.getValue(ctx, compoundTargetColorValue) ?? {};\n\t\t\t\tcompoundTargetColor[colorTableKey] = this.targetValue;\n\t\t\t\tthis.setValue(\n\t\t\t\t\tctx,\n\t\t\t\t\tcompoundTargetColorValue,\n\t\t\t\t\tcompoundTargetColor,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Update collective hex value if required\n\t\tconst supportsHex = !!this.getValue(\n\t\t\tctx,\n\t\t\tColorSwitchCCValues.supportsHexColor,\n\t\t);\n\t\tif (\n\t\t\tsupportsHex\n\t\t\t&& (this.colorComponent === ColorComponent.Red\n\t\t\t\t|| this.colorComponent === ColorComponent.Green\n\t\t\t\t|| this.colorComponent === ColorComponent.Blue)\n\t\t) {\n\t\t\tconst hexColorValue = ColorSwitchCCValues.hexColor;\n\n\t\t\tconst hexValue: string = this.getValue(ctx, hexColorValue)\n\t\t\t\t?? \"000000\";\n\t\t\tconst byteOffset = ColorComponent.Blue - this.colorComponent;\n\t\t\tconst byteMask = 0xff << (byteOffset * 8);\n\t\t\tlet hexValueNumeric = parseInt(hexValue, 16);\n\t\t\thexValueNumeric = (hexValueNumeric & ~byteMask)\n\t\t\t\t| (this.currentValue << (byteOffset * 8));\n\t\t\tthis.setValue(\n\t\t\t\tctx,\n\t\t\t\thexColorValue,\n\t\t\t\thexValueNumeric.toString(16).padStart(6, \"0\"),\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic readonly colorComponent: ColorComponent;\n\n\tpublic readonly currentValue: number;\n\n\tpublic readonly targetValue: number | undefined;\n\n\tpublic readonly duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.colorComponent,\n\t\t\tthis.currentValue,\n\t\t]);\n\t\tif (this.targetValue != undefined && this.duration != undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([\n\t\t\t\t\tthis.targetValue ?? 0xfe,\n\t\t\t\t\t(this.duration ?? Duration.default()).serializeReport(),\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"color component\": getEnumMemberName(\n\t\t\t\tColorComponent,\n\t\t\t\tthis.colorComponent,\n\t\t\t),\n\t\t\t\"current value\": this.currentValue,\n\t\t};\n\t\tif (this.targetValue != undefined) {\n\t\t\tmessage[\"target value\"] = this.targetValue;\n\t\t}\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ColorSwitchCCGetOptions {\n\tcolorComponent: ColorComponent;\n}\n\nfunction testResponseForColorSwitchGet(\n\tsent: ColorSwitchCCGet,\n\treceived: ColorSwitchCCReport,\n) {\n\treturn sent.colorComponent === received.colorComponent;\n}\n\n@CCCommand(ColorSwitchCommand.Get)\n@expectedCCResponse(ColorSwitchCCReport, testResponseForColorSwitchGet)\nexport class ColorSwitchCCGet extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis._colorComponent = options.colorComponent;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCGet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst colorComponent: ColorComponent = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcolorComponent,\n\t\t});\n\t}\n\n\tprivate _colorComponent: ColorComponent;\n\tpublic get colorComponent(): ColorComponent {\n\t\treturn this._colorComponent;\n\t}\n\tpublic set colorComponent(value: ColorComponent) {\n\t\tif (!ColorComponent[value]) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"colorComponent must be a valid color component index.\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis._colorComponent = value;\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this._colorComponent]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"color component\": getEnumMemberName(\n\t\t\t\t\tColorComponent,\n\t\t\t\t\tthis.colorComponent,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport type ColorSwitchCCSetOptions = (ColorTable | { hexColor: string }) & {\n\tduration?: Duration | string;\n};\n\n@CCCommand(ColorSwitchCommand.Set)\n@useSupervision()\nexport class ColorSwitchCCSet extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\t// Populate properties from options object\n\t\tif (\"hexColor\" in options) {\n\t\t\tconst match = hexColorRegex.exec(options.hexColor);\n\t\t\tif (!match) {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t`${options.hexColor} is not a valid HEX color string`,\n\t\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.colorTable = {\n\t\t\t\tred: parseInt(match.groups!.red, 16),\n\t\t\t\tgreen: parseInt(match.groups!.green, 16),\n\t\t\t\tblue: parseInt(match.groups!.blue, 16),\n\t\t\t};\n\t\t} else {\n\t\t\tthis.colorTable = pick(options, colorTableKeys as any[]);\n\t\t}\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst populatedColorCount = raw.payload[0] & 0b11111;\n\n\t\tvalidatePayload(raw.payload.length >= 1 + populatedColorCount * 2);\n\t\tconst colorTable: ColorTable = {};\n\t\tlet offset = 1;\n\t\tfor (let color = 0; color < populatedColorCount; color++) {\n\t\t\tconst component = raw.payload[offset];\n\t\t\tconst value = raw.payload[offset + 1];\n\t\t\tconst key = colorComponentToTableKey(component);\n\t\t\t// @ts-expect-error\n\t\t\tif (key) this.colorTable[key] = value;\n\t\t\toffset += 2;\n\t\t}\n\n\t\tlet duration: Duration | undefined;\n\t\tif (raw.payload.length > offset) {\n\t\t\tduration = Duration.parseSet(raw.payload[offset]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t...colorTable,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic colorTable: ColorTable;\n\tpublic duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst populatedColorCount = Object.keys(this.colorTable).length;\n\t\tthis.payload = new Bytes(\n\t\t\t1 + populatedColorCount * 2 + 1,\n\t\t);\n\t\tthis.payload[0] = populatedColorCount & 0b11111;\n\t\tlet i = 1;\n\t\tfor (const [key, value] of Object.entries(this.colorTable)) {\n\t\t\tconst component = colorTableKeyToComponent(key);\n\t\t\tthis.payload[i] = component;\n\t\t\tthis.payload[i + 1] = clamp(value, 0, 0xff);\n\t\t\ti += 2;\n\t\t}\n\t\tthis.payload[i] = (\n\t\t\tthis.duration ?? Duration.default()\n\t\t).serializeSet();\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, omit the duration byte\n\t\t\tthis.payload = this.payload.subarray(0, -1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {};\n\t\tfor (const [key, value] of Object.entries(this.colorTable)) {\n\t\t\tconst realKey: string = key in ColorComponentMap\n\t\t\t\t? (ColorComponent as any)[(ColorComponentMap as any)[key]]\n\t\t\t\t: (ColorComponent as any)[key];\n\t\t\tmessage[realKey] = value;\n\t\t}\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport type ColorSwitchCCStartLevelChangeOptions =\n\t& {\n\t\tcolorComponent: ColorComponent;\n\t\tdirection: keyof typeof LevelChangeDirection;\n\t}\n\t& (\n\t\t| {\n\t\t\tignoreStartLevel: true;\n\t\t\tstartLevel?: number;\n\t\t}\n\t\t| {\n\t\t\tignoreStartLevel: false;\n\t\t\tstartLevel: number;\n\t\t}\n\t)\n\t& {\n\t\t// Version >= 3:\n\t\tduration?: Duration | string;\n\t};\n\n@CCCommand(ColorSwitchCommand.StartLevelChange)\n@useSupervision()\nexport class ColorSwitchCCStartLevelChange extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCStartLevelChangeOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.duration = Duration.from(options.duration);\n\t\tthis.ignoreStartLevel = options.ignoreStartLevel;\n\t\tthis.startLevel = options.startLevel ?? 0;\n\t\tthis.direction = options.direction;\n\t\tthis.colorComponent = options.colorComponent;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ColorSwitchCCStartLevelChange {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst ignoreStartLevel = !!((raw.payload[0] & 0b0_0_1_00000) >>> 5);\n\t\tconst direction = ((raw.payload[0] & 0b0_1_0_00000) >>> 6)\n\t\t\t? \"down\"\n\t\t\t: \"up\";\n\t\tconst colorComponent: ColorComponent = raw.payload[1];\n\t\tconst startLevel = raw.payload[2];\n\t\tlet duration: Duration | undefined;\n\t\tif (raw.payload.length >= 4) {\n\t\t\tduration = Duration.parseSet(raw.payload[3]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tignoreStartLevel,\n\t\t\tdirection,\n\t\t\tcolorComponent,\n\t\t\tstartLevel,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic duration: Duration | undefined;\n\tpublic startLevel: number;\n\tpublic ignoreStartLevel: boolean;\n\tpublic direction: keyof typeof LevelChangeDirection;\n\tpublic colorComponent: ColorComponent;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst controlByte = (LevelChangeDirection[this.direction] << 6)\n\t\t\t| (this.ignoreStartLevel ? 0b0010_0000 : 0);\n\t\tthis.payload = Bytes.from([\n\t\t\tcontrolByte,\n\t\t\tthis.colorComponent,\n\t\t\tthis.startLevel,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 3 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1 or 2, omit the duration byte\n\t\t\tthis.payload = this.payload.subarray(0, -1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"color component\": getEnumMemberName(\n\t\t\t\tColorComponent,\n\t\t\t\tthis.colorComponent,\n\t\t\t),\n\t\t\t\"start level\": `${this.startLevel}${\n\t\t\t\tthis.ignoreStartLevel ? \" (ignored)\" : \"\"\n\t\t\t}`,\n\t\t\tdirection: this.direction,\n\t\t};\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ColorSwitchCCStopLevelChangeOptions {\n\tcolorComponent: ColorComponent;\n}\n\n@CCCommand(ColorSwitchCommand.StopLevelChange)\n@useSupervision()\nexport class ColorSwitchCCStopLevelChange extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCStopLevelChangeOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.colorComponent = options.colorComponent;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ColorSwitchCCStopLevelChange {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst colorComponent: ColorComponent = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcolorComponent,\n\t\t});\n\t}\n\n\tpublic readonly colorComponent: ColorComponent;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.colorComponent]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"color component\": getEnumMemberName(\n\t\t\t\t\tColorComponent,\n\t\t\t\t\tthis.colorComponent,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAoBO;AACP,oBAMO;AAEP,kBAAsB;AACtB,wBAAyB;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AAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IACZ,YACC,SAAyD;AAEzD,YAAM,OAAO;AACb,WAAK,iBAAiB,QAAQ;IAC/B;IAEO,OAAO,KACb,KACA,KAAqB;AAErB,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,iBAAiC,IAAI,QAAQ,CAAC;AAEpD,aAAO,IAAI,KAAK;QACf,QAAQ,IAAI;QACZ;OACA;IACF;IAEgB;IAET,UAAU,KAAsB;AACtC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,cAAc,CAAC;AAC/C,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACR,uBAAmB,iCAClB,6BACA,KAAK,cAAc;;;IAIvB;;;;",
|
|
4
|
+
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\tDuration,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\ttype ValueDB,\n\ttype ValueID,\n\tValueMetadata,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tencodeBitMask,\n\tisUnsupervisedOrSucceeded,\n\tparseBitMask,\n\tsupervisedCommandSucceeded,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport {\n\tBytes,\n\tgetEnumMemberName,\n\tisEnumMember,\n\tkeysOf,\n\tpick,\n} from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { clamp } from \"alcalzone-shared/math\";\nimport { isObject } from \"alcalzone-shared/typeguards\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\ttype SetValueImplementation,\n\tthrowMissingPropertyKey,\n\tthrowUnsupportedProperty,\n\tthrowUnsupportedPropertyKey,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\tColorComponent,\n\tColorComponentMap,\n\ttype ColorKey,\n\tColorSwitchCommand,\n\ttype ColorTable,\n\tLevelChangeDirection,\n} from \"../lib/_Types.js\";\n\nconst hexColorRegex =\n\t/^#?(?<red>[0-9a-f]{2})(?<green>[0-9a-f]{2})(?<blue>[0-9a-f]{2})$/i;\n\nconst colorTableKeys = [\n\t...keysOf(ColorComponent),\n\t...keysOf(ColorComponentMap),\n];\n\nfunction colorTableKeyToComponent(key: string): ColorComponent {\n\tif (/^\\d+$/.test(key)) {\n\t\treturn parseInt(key, 10);\n\t} else if (key in ColorComponentMap) {\n\t\treturn (ColorComponentMap as any)[key];\n\t} else if (key in ColorComponent) {\n\t\treturn (ColorComponent as any)[key];\n\t}\n\tthrow new ZWaveError(\n\t\t`Invalid color key ${key}!`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nfunction colorComponentToTableKey(\n\tcomponent: ColorComponent,\n): ColorKey | undefined {\n\tfor (const [key, comp] of Object.entries(ColorComponentMap)) {\n\t\tif (comp === component) return key as any;\n\t}\n}\n\nexport const ColorSwitchCCValues = V.defineCCValues(\n\tCommandClasses[\"Color Switch\"],\n\t{\n\t\t...V.staticProperty(\"supportedColorComponents\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t\t...V.staticProperty(\"supportsHexColor\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"currentColor\",\n\t\t\t\"currentColor\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnly,\n\t\t\t\tlabel: `Current color`,\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"targetColor\",\n\t\t\t\"targetColor\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Any,\n\t\t\t\tlabel: `Target color`,\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"duration\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyDuration,\n\t\t\t\tlabel: \"Remaining duration\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"hexColor\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Color,\n\t\t\t\tminLength: 6,\n\t\t\t\tmaxLength: 7, // to allow #rrggbb\n\t\t\t\tlabel: `RGB Color`,\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"currentColorChannel\",\n\t\t\t\"currentColor\",\n\t\t\t(component: ColorComponent) => component,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"currentColor\" && typeof propertyKey === \"number\",\n\t\t\t(component: ColorComponent) => {\n\t\t\t\tconst colorName = getEnumMemberName(ColorComponent, component);\n\t\t\t\treturn {\n\t\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\t\tlabel: `Current value (${colorName})`,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t`The current value of the ${colorName} channel.`,\n\t\t\t\t} as const;\n\t\t\t},\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"targetColorChannel\",\n\t\t\t\"targetColor\",\n\t\t\t(component: ColorComponent) => component,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"targetColor\" && typeof propertyKey === \"number\",\n\t\t\t(component: ColorComponent) => {\n\t\t\t\tconst colorName = getEnumMemberName(ColorComponent, component);\n\t\t\t\treturn {\n\t\t\t\t\t...ValueMetadata.UInt8,\n\t\t\t\t\tlabel: `Target value (${colorName})`,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t`The target value of the ${colorName} channel.`,\n\t\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t\t} as const;\n\t\t\t},\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Color Switch\"])\nexport class ColorSwitchCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: ColorSwitchCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase ColorSwitchCommand.SupportedGet:\n\t\t\tcase ColorSwitchCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase ColorSwitchCommand.Set:\n\t\t\tcase ColorSwitchCommand.StartLevelChange:\n\t\t\tcase ColorSwitchCommand.StopLevelChange:\n\t\t\t\treturn true; // These are mandatory\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\tpublic async getSupported(): Promise<\n\t\tMaybeNotKnown<readonly ColorComponent[]>\n\t> {\n\t\tthis.assertSupportsCommand(\n\t\t\tColorSwitchCommand,\n\t\t\tColorSwitchCommand.SupportedGet,\n\t\t);\n\n\t\tconst cc = new ColorSwitchCCSupportedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tColorSwitchCCSupportedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.supportedColorComponents;\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\t// oxlint-disable-next-line typescript/explicit-module-boundary-types\n\tpublic async get(component: ColorComponent) {\n\t\tthis.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Get);\n\n\t\tconst cc = new ColorSwitchCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tcolorComponent: component,\n\t\t});\n\t\tconst response = await this.host.sendCommand<ColorSwitchCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"currentValue\", \"targetValue\", \"duration\"]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async set(\n\t\toptions: ColorSwitchCCSetOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Set);\n\n\t\tconst cc = new ColorSwitchCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\n\t\tconst result = await this.host.sendCommand(cc, this.commandOptions);\n\n\t\tif (isUnsupervisedOrSucceeded(result)) {\n\t\t\t// If the command did not fail, assume that it succeeded and update the values accordingly\n\t\t\t// TODO: The API methods should not modify the value DB directly, but to do so\n\t\t\t// this requires a nicer way of synchronizing hexColor with the others\n\t\t\tif (this.isSinglecast()) {\n\t\t\t\t// Update each color component separately and record the changes to the compound value\n\t\t\t\tthis.updateCurrentColor(this.getValueDB(), cc.colorTable);\n\t\t\t} else if (this.isMulticast()) {\n\t\t\t\t// Figure out which nodes were affected by this command\n\t\t\t\tconst affectedNodes = this.endpoint.node.physicalNodes.filter(\n\t\t\t\t\t(node) =>\n\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t\t?.supportsCC(this.ccId),\n\t\t\t\t);\n\t\t\t\t// and optimistically update the currentColor\n\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\tconst valueDB = this.host.tryGetValueDB(node.id);\n\t\t\t\t\tif (valueDB) {\n\t\t\t\t\t\tthis.updateCurrentColor(valueDB, cc.colorTable);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** Updates the current color for a given node by merging in the given changes */\n\tprivate updateCurrentColor(valueDB: ValueDB, colorTable: ColorTable) {\n\t\tlet updatedRGB = false;\n\t\tconst currentColorValueId = ColorSwitchCCValues.currentColor.endpoint(\n\t\t\tthis.endpoint.index,\n\t\t);\n\t\tconst targetColorValueId = ColorSwitchCCValues.targetColor.endpoint(\n\t\t\tthis.endpoint.index,\n\t\t);\n\t\tconst currentCompoundColor =\n\t\t\tvalueDB.getValue<Partial<Record<ColorKey, number>>>(\n\t\t\t\tcurrentColorValueId,\n\t\t\t) ?? {};\n\t\tconst targetCompoundColor =\n\t\t\tvalueDB.getValue<Partial<Record<ColorKey, number>>>(\n\t\t\t\ttargetColorValueId,\n\t\t\t) ?? {};\n\n\t\tfor (const [key, value] of Object.entries(colorTable)) {\n\t\t\tconst component = colorTableKeyToComponent(key);\n\t\t\tif (\n\t\t\t\tcomponent === ColorComponent.Red\n\t\t\t\t|| component === ColorComponent.Green\n\t\t\t\t|| component === ColorComponent.Blue\n\t\t\t) {\n\t\t\t\tupdatedRGB = true;\n\t\t\t}\n\n\t\t\tvalueDB.setValue(\n\t\t\t\tColorSwitchCCValues.currentColorChannel(component).endpoint(\n\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t),\n\t\t\t\tvalue,\n\t\t\t);\n\n\t\t\t// Update the compound value\n\t\t\tif (key in ColorComponentMap) {\n\t\t\t\tcurrentCompoundColor[key as ColorKey] = value;\n\t\t\t\ttargetCompoundColor[key as ColorKey] = value;\n\t\t\t}\n\t\t}\n\t\t// And store the updated compound values\n\t\tvalueDB.setValue(currentColorValueId, currentCompoundColor);\n\t\tvalueDB.setValue(targetColorValueId, targetCompoundColor);\n\n\t\t// and hex color if necessary\n\t\tconst supportsHex = valueDB.getValue<boolean>(\n\t\t\tColorSwitchCCValues.supportsHexColor.endpoint(this.endpoint.index),\n\t\t);\n\t\tif (supportsHex && updatedRGB) {\n\t\t\tconst hexValueId = ColorSwitchCCValues.hexColor.endpoint(\n\t\t\t\tthis.endpoint.index,\n\t\t\t);\n\t\t\tconst [r, g, b] = [\n\t\t\t\tColorComponent.Red,\n\t\t\t\tColorComponent.Green,\n\t\t\t\tColorComponent.Blue,\n\t\t\t].map(\n\t\t\t\t(c) =>\n\t\t\t\t\tvalueDB.getValue<number>(\n\t\t\t\t\t\tColorSwitchCCValues.currentColorChannel(c).endpoint(\n\t\t\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t\t\t),\n\t\t\t\t\t) ?? 0,\n\t\t\t);\n\t\t\tconst hexValue = (r << 16) | (g << 8) | b;\n\t\t\tvalueDB.setValue(\n\t\t\t\thexValueId,\n\t\t\t\thexValue.toString(16).padStart(6, \"0\"),\n\t\t\t);\n\t\t}\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async startLevelChange(\n\t\toptions: ColorSwitchCCStartLevelChangeOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tColorSwitchCommand,\n\t\t\tColorSwitchCommand.StartLevelChange,\n\t\t);\n\n\t\tconst cc = new ColorSwitchCCStartLevelChange({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async stopLevelChange(\n\t\tcolorComponent: ColorComponent,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tColorSwitchCommand,\n\t\t\tColorSwitchCommand.StopLevelChange,\n\t\t);\n\n\t\tconst cc = new ColorSwitchCCStopLevelChange({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tcolorComponent,\n\t\t});\n\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: ColorSwitchCCAPI,\n\t\t\t{ property, propertyKey },\n\t\t\tvalue,\n\t\t\toptions,\n\t\t) {\n\t\t\tif (property === \"targetColor\") {\n\t\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\t\tif (propertyKey != undefined) {\n\t\t\t\t\t// Single color component, only accepts numbers\n\t\t\t\t\tif (typeof propertyKey !== \"number\") {\n\t\t\t\t\t\tthrowUnsupportedPropertyKey(\n\t\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (typeof value !== \"number\") {\n\t\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\ttypeof value,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst result = await this.set({\n\t\t\t\t\t\t[propertyKey]: value,\n\t\t\t\t\t\tduration,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.isSinglecast()\n\t\t\t\t\t\t&& !supervisedCommandSucceeded(result)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Verify the current value after a (short) delay, unless the command was supervised and successful\n\t\t\t\t\t\tthis.schedulePoll({ property, propertyKey }, value, {\n\t\t\t\t\t\t\tduration,\n\t\t\t\t\t\t\ttransition: \"fast\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\t// Set the compound color object\n\n\t\t\t\t\t// Ensure the value is an object with only valid keys\n\t\t\t\t\tif (\n\t\t\t\t\t\t!isObject(value)\n\t\t\t\t\t\t|| !Object.keys(value).every(\n\t\t\t\t\t\t\t(key) => key in ColorComponentMap,\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\t\t`${\n\t\t\t\t\t\t\t\tCommandClasses[this.ccId]\n\t\t\t\t\t\t\t}: \"${property}\" must be set to an object which specifies each color channel`,\n\t\t\t\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Ensure that each property is numeric\n\t\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\t\tif (typeof val !== \"number\") {\n\t\t\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\t\t\t`${property}.${key}`,\n\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\ttypeof val,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// GH#2527: strip unsupported color components, because some devices don't react otherwise\n\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\tconst supportedColors = this.tryGetValueDB()?.getValue<\n\t\t\t\t\t\t\treadonly ColorComponent[]\n\t\t\t\t\t\t>(\n\t\t\t\t\t\t\tColorSwitchCCValues.supportedColorComponents\n\t\t\t\t\t\t\t\t.endpoint(\n\t\t\t\t\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (supportedColors) {\n\t\t\t\t\t\t\tvalue = pick(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tsupportedColors\n\t\t\t\t\t\t\t\t\t.map((c) => colorComponentToTableKey(c))\n\t\t\t\t\t\t\t\t\t.filter((c) => !!c),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Avoid sending empty commands\n\t\t\t\t\tif (Object.keys(value as any).length === 0) return;\n\n\t\t\t\t\treturn this.set({ ...(value as ColorTable), duration });\n\n\t\t\t\t\t// We're not going to poll each color component separately\n\t\t\t\t}\n\t\t\t} else if (property === \"hexColor\") {\n\t\t\t\t// No property key, this is the hex color #rrggbb\n\t\t\t\tif (typeof value !== \"string\") {\n\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\"string\",\n\t\t\t\t\t\ttypeof value,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\t\treturn this.set({ hexColor: value, duration });\n\t\t\t} else {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic isSetValueOptimistic(_valueId: ValueID): boolean {\n\t\treturn false; // Color Switch CC handles updating the value DB itself\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(\n\t\t\tthis: ColorSwitchCCAPI,\n\t\t\t{ property, propertyKey },\n\t\t) {\n\t\t\tif (propertyKey == undefined) {\n\t\t\t\tthrowMissingPropertyKey(this.ccId, property);\n\t\t\t} else if (typeof propertyKey !== \"number\") {\n\t\t\t\tthrowUnsupportedPropertyKey(this.ccId, property, propertyKey);\n\t\t\t}\n\n\t\t\tswitch (property) {\n\t\t\t\tcase \"currentColor\":\n\t\t\t\t\treturn (await this.get(propertyKey))?.currentValue;\n\t\t\t\tcase \"targetColor\":\n\t\t\t\t\treturn (await this.get(propertyKey))?.targetValue;\n\t\t\t\tcase \"duration\":\n\t\t\t\t\treturn (await this.get(propertyKey))?.duration;\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Color Switch\"])\n@implementedVersion(3)\n@ccValues(ColorSwitchCCValues)\nexport class ColorSwitchCC extends CommandClass {\n\tdeclare ccCommand: ColorSwitchCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Color Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying supported colors...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst supportedColors = await api.getSupported();\n\t\tif (!supportedColors) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t\"Querying supported colors timed out, skipping interview...\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `received supported colors:${\n\t\t\t\tsupportedColors\n\t\t\t\t\t.map((c) => `\\n\u00B7 ${getEnumMemberName(ColorComponent, c)}`)\n\t\t\t\t\t.join(\"\")\n\t\t\t}`,\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\t// Create metadata for the separate color channels\n\t\tfor (const color of supportedColors) {\n\t\t\tconst currentColorChannelValue = ColorSwitchCCValues\n\t\t\t\t.currentColorChannel(color);\n\t\t\tthis.setMetadata(ctx, currentColorChannelValue);\n\n\t\t\tconst targetColorChannelValue = ColorSwitchCCValues\n\t\t\t\t.targetColorChannel(color);\n\t\t\tthis.setMetadata(ctx, targetColorChannelValue);\n\t\t}\n\t\t// And the compound one\n\t\tconst currentColorValue = ColorSwitchCCValues.currentColor;\n\t\tthis.setMetadata(ctx, currentColorValue);\n\t\tconst targetColorValue = ColorSwitchCCValues.targetColor;\n\t\tthis.setMetadata(ctx, targetColorValue);\n\n\t\t// Create the collective HEX color values\n\t\tconst supportsHex = [\n\t\t\tColorComponent.Red,\n\t\t\tColorComponent.Green,\n\t\t\tColorComponent.Blue,\n\t\t].every((c) => supportedColors.includes(c));\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tColorSwitchCCValues.supportsHexColor,\n\t\t\tsupportsHex,\n\t\t);\n\t\tif (supportsHex) {\n\t\t\tconst hexColorValue = ColorSwitchCCValues.hexColor;\n\t\t\tthis.setMetadata(ctx, hexColorValue);\n\t\t}\n\n\t\t// Query all color components\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Color Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tconst supportedColors: readonly ColorComponent[] = this.getValue(\n\t\t\tctx,\n\t\t\tColorSwitchCCValues.supportedColorComponents,\n\t\t) ?? [];\n\n\t\tfor (const color of supportedColors) {\n\t\t\t// Some devices report invalid colors, but the CC API checks\n\t\t\t// for valid values and throws otherwise.\n\t\t\tif (!isEnumMember(ColorComponent, color)) continue;\n\n\t\t\tconst colorName = getEnumMemberName(ColorComponent, color);\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `querying current color state (${colorName})`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tawait api.get(color);\n\t\t}\n\t}\n\n\tpublic translatePropertyKey(\n\t\tctx: GetValueDB,\n\t\tproperty: string | number,\n\t\tpropertyKey: string | number,\n\t): string | undefined {\n\t\tif (\n\t\t\t(property === \"currentColor\" || property === \"targetColor\")\n\t\t\t&& typeof propertyKey === \"number\"\n\t\t) {\n\t\t\tconst translated = ColorComponent[propertyKey];\n\t\t\tif (translated) return translated;\n\t\t}\n\t\treturn super.translatePropertyKey(ctx, property, propertyKey);\n\t}\n}\n\n// @publicAPI\nexport interface ColorSwitchCCSupportedReportOptions {\n\tsupportedColorComponents: readonly ColorComponent[];\n}\n\n@CCCommand(ColorSwitchCommand.SupportedReport)\n@ccValueProperty(\n\t\"supportedColorComponents\",\n\tColorSwitchCCValues.supportedColorComponents,\n)\nexport class ColorSwitchCCSupportedReport extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.supportedColorComponents = options.supportedColorComponents;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ColorSwitchCCSupportedReport {\n\t\t// Docs say 'variable length', but the table shows 2 bytes.\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst supportedColorComponents: ColorComponent[] = parseBitMask(\n\t\t\traw.payload.subarray(0, 2),\n\t\t\tColorComponent[\"Warm White\"],\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsupportedColorComponents,\n\t\t});\n\t}\n\n\tpublic readonly supportedColorComponents: readonly ColorComponent[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = encodeBitMask(\n\t\t\tthis.supportedColorComponents,\n\t\t\t15, // fixed 2 bytes\n\t\t\tColorComponent[\"Warm White\"],\n\t\t);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"supported color components\": this.supportedColorComponents\n\t\t\t\t\t.map((c) => `\\n\u00B7 ${getEnumMemberName(ColorComponent, c)}`)\n\t\t\t\t\t.join(\"\"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(ColorSwitchCommand.SupportedGet)\n@expectedCCResponse(ColorSwitchCCSupportedReport)\nexport class ColorSwitchCCSupportedGet extends ColorSwitchCC {}\n\n// @publicAPI\nexport interface ColorSwitchCCReportOptions {\n\tcolorComponent: ColorComponent;\n\tcurrentValue: number;\n\ttargetValue?: number;\n\tduration?: Duration | string;\n}\n\n@CCCommand(ColorSwitchCommand.Report)\n@ccValueProperty(\n\t\"currentValue\",\n\tColorSwitchCCValues.currentColorChannel,\n\t(self) => [self.colorComponent],\n)\n@ccValueProperty(\n\t\"targetValue\",\n\tColorSwitchCCValues.targetColorChannel,\n\t(self) => [self.colorComponent],\n)\n@ccValueProperty(\"duration\", ColorSwitchCCValues.duration)\nexport class ColorSwitchCCReport extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.colorComponent = options.colorComponent;\n\t\tthis.currentValue = options.currentValue;\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst colorComponent: ColorComponent = raw.payload[0];\n\t\tconst currentValue = raw.payload[1];\n\t\tlet targetValue: number | undefined;\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 4) {\n\t\t\ttargetValue = raw.payload[2];\n\t\t\tduration = Duration.parseReport(raw.payload[3]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcolorComponent,\n\t\t\tcurrentValue,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\t// Duration is stored globally instead of per component\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Update compound current value\n\t\tconst colorTableKey = colorComponentToTableKey(this.colorComponent);\n\t\tif (colorTableKey) {\n\t\t\tconst compoundCurrentColorValue = ColorSwitchCCValues.currentColor;\n\t\t\tconst compoundCurrentColor: Partial<Record<ColorKey, number>> =\n\t\t\t\tthis.getValue(ctx, compoundCurrentColorValue) ?? {};\n\t\t\tcompoundCurrentColor[colorTableKey] = this.currentValue;\n\t\t\tthis.setValue(\n\t\t\t\tctx,\n\t\t\t\tcompoundCurrentColorValue,\n\t\t\t\tcompoundCurrentColor,\n\t\t\t);\n\n\t\t\t// and target value\n\t\t\tif (this.targetValue != undefined) {\n\t\t\t\tconst compoundTargetColorValue =\n\t\t\t\t\tColorSwitchCCValues.targetColor;\n\t\t\t\tconst compoundTargetColor: Partial<Record<ColorKey, number>> =\n\t\t\t\t\tthis.getValue(ctx, compoundTargetColorValue) ?? {};\n\t\t\t\tcompoundTargetColor[colorTableKey] = this.targetValue;\n\t\t\t\tthis.setValue(\n\t\t\t\t\tctx,\n\t\t\t\t\tcompoundTargetColorValue,\n\t\t\t\t\tcompoundTargetColor,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Update collective hex value if required\n\t\tconst supportsHex = !!this.getValue(\n\t\t\tctx,\n\t\t\tColorSwitchCCValues.supportsHexColor,\n\t\t);\n\t\tif (\n\t\t\tsupportsHex\n\t\t\t&& (this.colorComponent === ColorComponent.Red\n\t\t\t\t|| this.colorComponent === ColorComponent.Green\n\t\t\t\t|| this.colorComponent === ColorComponent.Blue)\n\t\t) {\n\t\t\tconst hexColorValue = ColorSwitchCCValues.hexColor;\n\n\t\t\tconst hexValue: string = this.getValue(ctx, hexColorValue)\n\t\t\t\t?? \"000000\";\n\t\t\tconst byteOffset = ColorComponent.Blue - this.colorComponent;\n\t\t\tconst byteMask = 0xff << (byteOffset * 8);\n\t\t\tlet hexValueNumeric = parseInt(hexValue, 16);\n\t\t\thexValueNumeric = (hexValueNumeric & ~byteMask)\n\t\t\t\t| (this.currentValue << (byteOffset * 8));\n\t\t\tthis.setValue(\n\t\t\t\tctx,\n\t\t\t\thexColorValue,\n\t\t\t\thexValueNumeric.toString(16).padStart(6, \"0\"),\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic readonly colorComponent: ColorComponent;\n\n\tpublic readonly currentValue: number;\n\n\tpublic readonly targetValue: number | undefined;\n\n\tpublic readonly duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.colorComponent,\n\t\t\tthis.currentValue,\n\t\t]);\n\t\tif (this.targetValue != undefined && this.duration != undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\t[\n\t\t\t\t\tthis.targetValue ?? 0xfe,\n\t\t\t\t\t(this.duration ?? Duration.default()).serializeReport(),\n\t\t\t\t],\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"color component\": getEnumMemberName(\n\t\t\t\tColorComponent,\n\t\t\t\tthis.colorComponent,\n\t\t\t),\n\t\t\t\"current value\": this.currentValue,\n\t\t};\n\t\tif (this.targetValue != undefined) {\n\t\t\tmessage[\"target value\"] = this.targetValue;\n\t\t}\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ColorSwitchCCGetOptions {\n\tcolorComponent: ColorComponent;\n}\n\nfunction testResponseForColorSwitchGet(\n\tsent: ColorSwitchCCGet,\n\treceived: ColorSwitchCCReport,\n) {\n\treturn sent.colorComponent === received.colorComponent;\n}\n\n@CCCommand(ColorSwitchCommand.Get)\n@expectedCCResponse(ColorSwitchCCReport, testResponseForColorSwitchGet)\nexport class ColorSwitchCCGet extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis._colorComponent = options.colorComponent;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCGet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst colorComponent: ColorComponent = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcolorComponent,\n\t\t});\n\t}\n\n\tprivate _colorComponent: ColorComponent;\n\tpublic get colorComponent(): ColorComponent {\n\t\treturn this._colorComponent;\n\t}\n\tpublic set colorComponent(value: ColorComponent) {\n\t\tif (!ColorComponent[value]) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"colorComponent must be a valid color component index.\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis._colorComponent = value;\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this._colorComponent]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"color component\": getEnumMemberName(\n\t\t\t\t\tColorComponent,\n\t\t\t\t\tthis.colorComponent,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport type ColorSwitchCCSetOptions = (ColorTable | { hexColor: string }) & {\n\tduration?: Duration | string;\n};\n\n@CCCommand(ColorSwitchCommand.Set)\n@useSupervision()\nexport class ColorSwitchCCSet extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\t// Populate properties from options object\n\t\tif (\"hexColor\" in options) {\n\t\t\tconst match = hexColorRegex.exec(options.hexColor);\n\t\t\tif (!match) {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t`${options.hexColor} is not a valid HEX color string`,\n\t\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.colorTable = {\n\t\t\t\tred: parseInt(match.groups!.red, 16),\n\t\t\t\tgreen: parseInt(match.groups!.green, 16),\n\t\t\t\tblue: parseInt(match.groups!.blue, 16),\n\t\t\t};\n\t\t} else {\n\t\t\tthis.colorTable = pick(options, colorTableKeys as any[]);\n\t\t}\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): ColorSwitchCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst populatedColorCount = raw.payload[0] & 0b11111;\n\n\t\tvalidatePayload(raw.payload.length >= 1 + populatedColorCount * 2);\n\t\tconst colorTable: ColorTable = {};\n\t\tlet offset = 1;\n\t\tfor (let color = 0; color < populatedColorCount; color++) {\n\t\t\tconst component = raw.payload[offset];\n\t\t\tconst value = raw.payload[offset + 1];\n\t\t\tconst key = colorComponentToTableKey(component);\n\t\t\t// @ts-expect-error\n\t\t\tif (key) this.colorTable[key] = value;\n\t\t\toffset += 2;\n\t\t}\n\n\t\tlet duration: Duration | undefined;\n\t\tif (raw.payload.length > offset) {\n\t\t\tduration = Duration.parseSet(raw.payload[offset]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t...colorTable,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic colorTable: ColorTable;\n\tpublic duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst populatedColorCount = Object.keys(this.colorTable).length;\n\t\tthis.payload = new Bytes(\n\t\t\t1 + populatedColorCount * 2 + 1,\n\t\t);\n\t\tthis.payload[0] = populatedColorCount & 0b11111;\n\t\tlet i = 1;\n\t\tfor (const [key, value] of Object.entries(this.colorTable)) {\n\t\t\tconst component = colorTableKeyToComponent(key);\n\t\t\tthis.payload[i] = component;\n\t\t\tthis.payload[i + 1] = clamp(value, 0, 0xff);\n\t\t\ti += 2;\n\t\t}\n\t\tthis.payload[i] = (\n\t\t\tthis.duration ?? Duration.default()\n\t\t).serializeSet();\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, omit the duration byte\n\t\t\tthis.payload = this.payload.subarray(0, -1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {};\n\t\tfor (const [key, value] of Object.entries(this.colorTable)) {\n\t\t\tconst realKey: string = key in ColorComponentMap\n\t\t\t\t? (ColorComponent as any)[(ColorComponentMap as any)[key]]\n\t\t\t\t: (ColorComponent as any)[key];\n\t\t\tmessage[realKey] = value;\n\t\t}\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport type ColorSwitchCCStartLevelChangeOptions =\n\t& {\n\t\tcolorComponent: ColorComponent;\n\t\tdirection: keyof typeof LevelChangeDirection;\n\t}\n\t& (\n\t\t| {\n\t\t\tignoreStartLevel: true;\n\t\t\tstartLevel?: number;\n\t\t}\n\t\t| {\n\t\t\tignoreStartLevel: false;\n\t\t\tstartLevel: number;\n\t\t}\n\t)\n\t& {\n\t\t// Version >= 3:\n\t\tduration?: Duration | string;\n\t};\n\n@CCCommand(ColorSwitchCommand.StartLevelChange)\n@useSupervision()\nexport class ColorSwitchCCStartLevelChange extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCStartLevelChangeOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.duration = Duration.from(options.duration);\n\t\tthis.ignoreStartLevel = options.ignoreStartLevel;\n\t\tthis.startLevel = options.startLevel ?? 0;\n\t\tthis.direction = options.direction;\n\t\tthis.colorComponent = options.colorComponent;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ColorSwitchCCStartLevelChange {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst ignoreStartLevel = !!((raw.payload[0] & 0b0_0_1_00000) >>> 5);\n\t\tconst direction = ((raw.payload[0] & 0b0_1_0_00000) >>> 6)\n\t\t\t? \"down\"\n\t\t\t: \"up\";\n\t\tconst colorComponent: ColorComponent = raw.payload[1];\n\t\tconst startLevel = raw.payload[2];\n\t\tlet duration: Duration | undefined;\n\t\tif (raw.payload.length >= 4) {\n\t\t\tduration = Duration.parseSet(raw.payload[3]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tignoreStartLevel,\n\t\t\tdirection,\n\t\t\tcolorComponent,\n\t\t\tstartLevel,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic duration: Duration | undefined;\n\tpublic startLevel: number;\n\tpublic ignoreStartLevel: boolean;\n\tpublic direction: keyof typeof LevelChangeDirection;\n\tpublic colorComponent: ColorComponent;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst controlByte = (LevelChangeDirection[this.direction] << 6)\n\t\t\t| (this.ignoreStartLevel ? 0b0010_0000 : 0);\n\t\tthis.payload = Bytes.from([\n\t\t\tcontrolByte,\n\t\t\tthis.colorComponent,\n\t\t\tthis.startLevel,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 3 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1 or 2, omit the duration byte\n\t\t\tthis.payload = this.payload.subarray(0, -1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"color component\": getEnumMemberName(\n\t\t\t\tColorComponent,\n\t\t\t\tthis.colorComponent,\n\t\t\t),\n\t\t\t\"start level\": `${this.startLevel}${\n\t\t\t\tthis.ignoreStartLevel ? \" (ignored)\" : \"\"\n\t\t\t}`,\n\t\t\tdirection: this.direction,\n\t\t};\n\t\tif (this.duration != undefined) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ColorSwitchCCStopLevelChangeOptions {\n\tcolorComponent: ColorComponent;\n}\n\n@CCCommand(ColorSwitchCommand.StopLevelChange)\n@useSupervision()\nexport class ColorSwitchCCStopLevelChange extends ColorSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ColorSwitchCCStopLevelChangeOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.colorComponent = options.colorComponent;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ColorSwitchCCStopLevelChange {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst colorComponent: ColorComponent = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcolorComponent,\n\t\t});\n\t}\n\n\tpublic readonly colorComponent: ColorComponent;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.colorComponent]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"color component\": getEnumMemberName(\n\t\t\t\t\tColorComponent,\n\t\t\t\t\tthis.colorComponent,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAoBO;AACP,oBAMO;AAEP,kBAAsB;AACtB,wBAAyB;AACzB,iBAUO;AACP,0BAOO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAOO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEP,MAAM,gBACL;AAED,MAAM,iBAAiB;EACtB,OAAG,sBAAO,2BAAc;EACxB,OAAG,sBAAO,8BAAiB;;AAG5B,SAAS,yBAAyB,KAAW;AAC5C,MAAI,QAAQ,KAAK,GAAG,GAAG;AACtB,WAAO,SAAS,KAAK,EAAE;EACxB,WAAW,OAAO,gCAAmB;AACpC,WAAQ,+BAA0B,GAAG;EACtC,WAAW,OAAO,6BAAgB;AACjC,WAAQ,4BAAuB,GAAG;EACnC;AACA,QAAM,IAAI,uBACT,qBAAqB,GAAG,KACxB,4BAAgB,gBAAgB;AAElC;AAZS;AAcT,SAAS,yBACR,WAAyB;AAEzB,aAAW,CAAC,KAAK,IAAI,KAAK,OAAO,QAAQ,8BAAiB,GAAG;AAC5D,QAAI,SAAS;AAAW,aAAO;EAChC;AACD;AANS;IAwFI,oBAAgB,MAAA;8BAD5B,mCAAI,2BAAe,cAAc,CAAC,CAAC;;;;oBACE;;;;;;wCAAA,YAAK;WAAA;;;;;;;;AAqC1C,mBAAA,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,MA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AAW,KAAK,SAAS,SAAQ;MAC1C;AACA,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB;;IAEF;;;;IAUY,gCAA4B,MAAA;8BAFxC,yCAAU,gCAAmB,eAAe,OAC5C,8CAAc,CAAE;;;;oBACiC;oDAAA,YAAa;WAAA;;;;;;;;AAA/D,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IACZ,YACC,SAAyD;AAEzD,YAAM,OAAO;AACb,WAAK,iBAAiB,QAAQ;IAC/B;IAEO,OAAO,KACb,KACA,KAAqB;AAErB,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,iBAAiC,IAAI,QAAQ,CAAC;AAEpD,aAAO,IAAI,KAAK;QACf,QAAQ,IAAI;QACZ;OACA;IACF;IAEgB;IAET,UAAU,KAAsB;AACtC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,cAAc,CAAC;AAC/C,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACR,uBAAmB,iCAClB,6BACA,KAAK,cAAc;;;IAIvB;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1062,6 +1062,7 @@ alters capabilities: ${!!properties.altersCapabilities}`;
|
|
|
1062
1062
|
valueSize: info.valueSize,
|
|
1063
1063
|
min: info.minValue,
|
|
1064
1064
|
max: info.maxValue,
|
|
1065
|
+
allowed: info.allowed,
|
|
1065
1066
|
default: info.defaultValue,
|
|
1066
1067
|
recommended: info.recommendedValue,
|
|
1067
1068
|
unit: info.unit,
|
|
@@ -1188,7 +1189,7 @@ let ConfigurationCCReport = (() => {
|
|
|
1188
1189
|
}
|
|
1189
1190
|
serialize(ctx) {
|
|
1190
1191
|
this.payload = import_shared.Bytes.concat([
|
|
1191
|
-
|
|
1192
|
+
[this.parameter, this.valueSize & 7],
|
|
1192
1193
|
new import_shared.Bytes(this.valueSize)
|
|
1193
1194
|
]);
|
|
1194
1195
|
serializeValue(this.payload, 2, this.valueSize, this.valueFormat ?? import_core.ConfigValueFormat.SignedInteger, this.value);
|