@zwave-js/cc 15.31.2 → 15.32.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AlarmSensorCC.js +2 -3
- package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
- package/build/cjs/cc/AssociationGroupInfoCC.js +5 -2
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/CentralSceneCC.d.ts +5 -0
- package/build/cjs/cc/CentralSceneCC.js +28 -2
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.js +2 -3
- package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
- package/build/cjs/cc/ConfigurationCC.d.ts +2 -0
- package/build/cjs/cc/ConfigurationCC.js +28 -8
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.js +3 -2
- package/build/cjs/cc/EntryControlCC.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.map +1 -1
- package/build/cjs/cc/LanguageCC.js +6 -2
- package/build/cjs/cc/LanguageCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.js +1 -1
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.js +25 -4
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.js +2 -2
- package/build/cjs/cc/NodeNamingCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.js +10 -11
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.js +11 -6
- package/build/cjs/cc/Security2CC.js.map +2 -2
- package/build/cjs/cc/SecurityCC.js +2 -1
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC.js +1 -1
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetpointCC.js +2 -1
- package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
- package/build/cjs/cc/UserCredentialCC.d.ts +6 -0
- package/build/cjs/cc/UserCredentialCC.js +81 -6
- package/build/cjs/cc/UserCredentialCC.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.js +2 -1
- package/build/cjs/lib/Security2/Extension.js.map +2 -2
- package/build/cjs/lib/securityLogging.d.ts +6 -0
- package/build/cjs/lib/securityLogging.js +34 -0
- package/build/cjs/lib/securityLogging.js.map +7 -0
- package/build/cjs/lib/serializers.js +3 -0
- package/build/cjs/lib/serializers.js.map +2 -2
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +5 -3
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +10 -6
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts +5 -0
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +29 -0
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +2 -4
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts +2 -0
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +34 -13
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +4 -3
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +4 -6
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +8 -3
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +2 -2
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +27 -5
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +3 -3
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +22 -24
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +21 -10
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +4 -4
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +2 -2
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +5 -1
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/UserCredentialCC.d.ts +6 -0
- package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
- package/build/esm/cc/UserCredentialCC.js +103 -13
- package/build/esm/cc/UserCredentialCC.js.map +1 -1
- package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
- package/build/esm/lib/Security2/Extension.js +3 -3
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/build/esm/lib/securityLogging.d.ts +6 -0
- package/build/esm/lib/securityLogging.d.ts.map +1 -0
- package/build/esm/lib/securityLogging.js +10 -0
- package/build/esm/lib/securityLogging.js.map +1 -0
- package/build/esm/lib/serializers.d.ts.map +1 -1
- package/build/esm/lib/serializers.js +4 -0
- package/build/esm/lib/serializers.js.map +1 -1
- package/package.json +7 -7
|
@@ -260,6 +260,7 @@ let AlarmSensorCCReport = (() => {
|
|
|
260
260
|
static from(raw, ctx) {
|
|
261
261
|
(0, import_core.validatePayload)(raw.payload.length >= 5, raw.payload[1] !== 255);
|
|
262
262
|
const sourceNodeId = raw.payload[0];
|
|
263
|
+
import_core.validatePayload.withReason(`Ignoring Alarm Sensor Report forwarded on behalf of node ${sourceNodeId}`)(sourceNodeId === 0 || sourceNodeId === ctx.sourceNodeId);
|
|
263
264
|
const sensorType = raw.payload[1];
|
|
264
265
|
const state = raw.payload[2] > 0;
|
|
265
266
|
let severity;
|
|
@@ -268,9 +269,7 @@ let AlarmSensorCCReport = (() => {
|
|
|
268
269
|
}
|
|
269
270
|
const duration = raw.payload.readUInt16BE(3) || void 0;
|
|
270
271
|
return new this({
|
|
271
|
-
|
|
272
|
-
// (and only then!) the payload contains the original node ID
|
|
273
|
-
nodeId: sourceNodeId || ctx.sourceNodeId,
|
|
272
|
+
nodeId: ctx.sourceNodeId,
|
|
274
273
|
sensorType,
|
|
275
274
|
state,
|
|
276
275
|
severity,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/AlarmSensorCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./AlarmSensorCC._validateArgs.js\";\nconst { validateArgs_AlarmSensorCCAPI_get } = __validateArgs;\nimport { CommandClasses, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, ValueMetadata, type WithAddress, encodeBitMask, logDict, logList, logText, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, isEnumMember, pick } from \"@zwave-js/shared\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { AlarmSensorCommand, AlarmSensorType } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { AlarmSensorCCValues } from \"./_CCValues.generated.js\";\nexport { AlarmSensorCCValues };\n// @noSetValueAPI This CC is read-only\n@API(CommandClasses[\"Alarm Sensor\"])\nexport class AlarmSensorCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: AlarmSensorCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case AlarmSensorCommand.Get:\n case AlarmSensorCommand.SupportedGet:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n /**\n * Retrieves the current value from this sensor\n * @param sensorType The (optional) sensor type to retrieve the value for\n */\n @validateArgs_AlarmSensorCCAPI_get()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get(sensorType?: AlarmSensorType) {\n this.assertSupportsCommand(AlarmSensorCommand, AlarmSensorCommand.Get);\n const cc = new AlarmSensorCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n sensorType,\n });\n const response = await this.host.sendCommand<AlarmSensorCCReport>(cc, this.commandOptions);\n if (response)\n return pick(response, [\"state\", \"severity\", \"duration\"]);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupportedSensorTypes() {\n this.assertSupportsCommand(AlarmSensorCommand, AlarmSensorCommand.SupportedGet);\n const cc = new AlarmSensorCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<AlarmSensorCCSupportedReport>(cc, this.commandOptions);\n if (response)\n return response.supportedSensorTypes;\n }\n}\n@commandClass(CommandClasses[\"Alarm Sensor\"])\n@implementedVersion(1)\n@ccValues(AlarmSensorCCValues)\nexport class AlarmSensorCC extends CommandClass {\n declare ccCommand: AlarmSensorCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n // Skip the interview in favor of Notification CC if possible,\n // but only if the device supports Notification CC v2+. Version 1\n // doesn't provide information about supported notification types,\n // so we still need to interview Alarm Sensor CC for those devices.\n if (endpoint.supportsCC(CommandClasses.Notification)\n && endpoint.getCCVersion(CommandClasses.Notification) >= 2) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `${this.constructor.name}: skipping interview because Notification CC is supported...`,\n direction: \"none\",\n });\n this.setInterviewComplete(ctx, true);\n return;\n }\n const api = CCAPI.create(CommandClasses[\"Alarm Sensor\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // Find out which sensor types this sensor supports\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported sensor types...\",\n direction: \"outbound\",\n });\n const supportedSensorTypes = await api.getSupportedSensorTypes();\n if (supportedSensorTypes) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(\"received supported sensor types:\", {\n nested: logList(supportedSensorTypes.map((type) => getEnumMemberName(AlarmSensorType, type))),\n }),\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported sensor types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n // Query (all of) the sensor's current value(s)\n await this.refreshValues(ctx, { tag: \"interview\" });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Alarm Sensor\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n const supportedSensorTypes: readonly AlarmSensorType[] = this.getValue(ctx, AlarmSensorCCValues.supportedSensorTypes) ?? [];\n // Always query (all of) the sensor's current value(s)\n for (const type of supportedSensorTypes) {\n // Some devices report invalid sensor types, but the CC API checks\n // for valid values and throws otherwise.\n if (!isEnumMember(AlarmSensorType, type))\n continue;\n const sensorName = getEnumMemberName(AlarmSensorType, type);\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value for ${sensorName}...`,\n direction: \"outbound\",\n });\n const currentValue = await api.get(type);\n if (currentValue) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(`received current value for ${sensorName}:`, {\n nested: logDict({\n state: currentValue.state,\n severity: currentValue.severity,\n duration: currentValue.duration,\n }),\n }),\n direction: \"inbound\",\n });\n }\n }\n }\n /**\n * Returns which sensor types are supported.\n * This only works AFTER the interview process\n */\n public static getSupportedSensorTypesCached(ctx: GetValueDB, endpoint: EndpointId): MaybeNotKnown<AlarmSensorType[]> {\n return ctx\n .getValueDB(endpoint.nodeId)\n .getValue(AlarmSensorCCValues.supportedSensorTypes.endpoint(endpoint.index));\n }\n protected createMetadataForSensorType(ctx: GetValueDB, sensorType: AlarmSensorType): void {\n const stateValue = AlarmSensorCCValues.state(sensorType);\n const severityValue = AlarmSensorCCValues.severity(sensorType);\n const durationValue = AlarmSensorCCValues.duration(sensorType);\n // Always create metadata if it does not exist\n this.ensureMetadata(ctx, stateValue);\n this.ensureMetadata(ctx, severityValue);\n this.ensureMetadata(ctx, durationValue);\n }\n}\n// @publicAPI\nexport interface AlarmSensorCCReportOptions {\n sensorType: AlarmSensorType;\n state: boolean;\n severity?: number;\n duration?: number;\n}\n@CCCommand(AlarmSensorCommand.Report)\nexport class AlarmSensorCCReport extends AlarmSensorCC {\n public constructor(options: WithAddress<AlarmSensorCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sensorType = options.sensorType;\n this.state = options.state;\n this.severity = options.severity;\n this.duration = options.duration;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AlarmSensorCCReport {\n validatePayload(raw.payload.length >= 5, raw.payload[1] !== 0xff);\n const sourceNodeId = raw.payload[0];\n const sensorType: AlarmSensorType = raw.payload[1];\n // Any positive value gets interpreted as alarm\n const state: boolean = raw.payload[2] > 0;\n // Severity only ranges from 1 to 100\n let severity: number | undefined;\n if (raw.payload[2] > 0 && raw.payload[2] <= 0x64) {\n severity = raw.payload[2];\n }\n // ignore zero durations\n const duration = raw.payload.readUInt16BE(3) || undefined;\n return new this({\n // Alarm Sensor reports may be forwarded by a different node, in this case\n // (and only then!) the payload contains the original node ID\n nodeId: sourceNodeId || ctx.sourceNodeId,\n sensorType,\n state,\n severity,\n duration,\n });\n }\n public readonly sensorType: AlarmSensorType;\n public readonly state: boolean;\n public readonly severity: number | undefined;\n public readonly duration: number | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n let severity: number;\n if (this.state) {\n severity = this.severity ?? 0xff;\n }\n else {\n severity = 0;\n }\n this.payload = Bytes.from([0, this.sensorType, severity, 0, 0]);\n this.payload.writeUInt16BE(this.duration ?? 0, 3);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"sensor type\": getEnumMemberName(AlarmSensorType, this.sensorType),\n \"alarm state\": this.state,\n };\n if (this.severity != undefined) {\n message.severity = this.severity;\n }\n if (this.duration != undefined) {\n message.duration = `${this.duration} seconds`;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Create metadata if it does not exist\n this.createMetadataForSensorType(ctx, this.sensorType);\n const stateValue = AlarmSensorCCValues.state(this.sensorType);\n const severityValue = AlarmSensorCCValues.severity(this.sensorType);\n const durationValue = AlarmSensorCCValues.duration(this.sensorType);\n this.setValue(ctx, stateValue, this.state);\n this.setValue(ctx, severityValue, this.severity);\n this.setValue(ctx, durationValue, this.duration);\n return true;\n }\n}\nfunction testResponseForAlarmSensorGet(sent: AlarmSensorCCGet, received: AlarmSensorCCReport) {\n // We expect a Alarm Sensor Report that matches the requested sensor type (if a type was requested)\n return (sent.sensorType === AlarmSensorType.Any\n || received.sensorType === sent.sensorType);\n}\n// @publicAPI\nexport interface AlarmSensorCCGetOptions {\n sensorType?: AlarmSensorType;\n}\n@CCCommand(AlarmSensorCommand.Get)\n@expectedCCResponse(AlarmSensorCCReport, testResponseForAlarmSensorGet)\nexport class AlarmSensorCCGet extends AlarmSensorCC {\n public constructor(options: WithAddress<AlarmSensorCCGetOptions>) {\n super(options);\n this.sensorType = options.sensorType ?? AlarmSensorType.Any;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AlarmSensorCCGet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n sensorType: raw.payload[0],\n });\n }\n public sensorType: AlarmSensorType;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.sensorType]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"sensor type\": getEnumMemberName(AlarmSensorType, this.sensorType),\n },\n };\n }\n}\n// @publicAPI\nexport interface AlarmSensorCCSupportedReportOptions {\n supportedSensorTypes: AlarmSensorType[];\n}\n@CCCommand(AlarmSensorCommand.SupportedReport)\n@ccValueProperty(\"supportedSensorTypes\", AlarmSensorCCValues.supportedSensorTypes)\nexport class AlarmSensorCCSupportedReport extends AlarmSensorCC {\n public constructor(options: WithAddress<AlarmSensorCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.supportedSensorTypes = options.supportedSensorTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AlarmSensorCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const bitMaskLength = raw.payload[0];\n validatePayload(raw.payload.length >= 1 + bitMaskLength);\n const supportedSensorTypes: AlarmSensorType[] = parseBitMask(raw.payload.subarray(1, 1 + bitMaskLength), AlarmSensorType[\"General Purpose\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedSensorTypes,\n });\n }\n public supportedSensorTypes: AlarmSensorType[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Any is not a valid sensor type for the bit mask\n const mask = encodeBitMask(this.supportedSensorTypes.filter((t) => t !== AlarmSensorType.Any), undefined, AlarmSensorType[\"General Purpose\"]);\n this.payload = Bytes.concat([[mask.length], mask]);\n return super.serialize(ctx);\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Create metadata for each sensor type\n for (const type of this.supportedSensorTypes) {\n this.createMetadataForSensorType(ctx, type);\n }\n return true;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported sensor types\": this.supportedSensorTypes\n .map((t) => getEnumMemberName(AlarmSensorType, t))\n .join(\", \"),\n },\n };\n }\n}\n@CCCommand(AlarmSensorCommand.SupportedGet)\n@expectedCCResponse(AlarmSensorCCSupportedReport)\nexport class AlarmSensorCCSupportedGet extends AlarmSensorCC {\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAA+P;AAC/P,oBAA6D;AAC7D,iBAAqC;AACrC,0BAAkJ;AAClJ,oCAAiH;AAEjH,mBAAoD;AAEpD,gCAAoC;AATpC,MAAM,EAAE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Aa;AACtC,WAAK,eAAe,KAAK,aAAa;IAC1C;;;;IAUS,uBAAmB,MAAA;8BAD/B,yCAAU,gCAAmB,MAAM,CAAC;;;;oBACI;2CAAA,YAAa;WAAA;;;;;;;;AAAtD,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAAgD;AAC/D,YAAM,OAAO;AAEb,WAAK,aAAa,QAAQ;AAC1B,WAAK,QAAQ,QAAQ;AACrB,WAAK,WAAW,QAAQ;AACxB,WAAK,WAAW,QAAQ;IAC5B;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAI;AAChE,YAAM,eAAe,IAAI,QAAQ,CAAC;
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./AlarmSensorCC._validateArgs.js\";\nconst { validateArgs_AlarmSensorCCAPI_get } = __validateArgs;\nimport { CommandClasses, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, ValueMetadata, type WithAddress, encodeBitMask, logDict, logList, logText, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, isEnumMember, pick } from \"@zwave-js/shared\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { AlarmSensorCommand, AlarmSensorType } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { AlarmSensorCCValues } from \"./_CCValues.generated.js\";\nexport { AlarmSensorCCValues };\n// @noSetValueAPI This CC is read-only\n@API(CommandClasses[\"Alarm Sensor\"])\nexport class AlarmSensorCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: AlarmSensorCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case AlarmSensorCommand.Get:\n case AlarmSensorCommand.SupportedGet:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n /**\n * Retrieves the current value from this sensor\n * @param sensorType The (optional) sensor type to retrieve the value for\n */\n @validateArgs_AlarmSensorCCAPI_get()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get(sensorType?: AlarmSensorType) {\n this.assertSupportsCommand(AlarmSensorCommand, AlarmSensorCommand.Get);\n const cc = new AlarmSensorCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n sensorType,\n });\n const response = await this.host.sendCommand<AlarmSensorCCReport>(cc, this.commandOptions);\n if (response)\n return pick(response, [\"state\", \"severity\", \"duration\"]);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupportedSensorTypes() {\n this.assertSupportsCommand(AlarmSensorCommand, AlarmSensorCommand.SupportedGet);\n const cc = new AlarmSensorCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<AlarmSensorCCSupportedReport>(cc, this.commandOptions);\n if (response)\n return response.supportedSensorTypes;\n }\n}\n@commandClass(CommandClasses[\"Alarm Sensor\"])\n@implementedVersion(1)\n@ccValues(AlarmSensorCCValues)\nexport class AlarmSensorCC extends CommandClass {\n declare ccCommand: AlarmSensorCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n // Skip the interview in favor of Notification CC if possible,\n // but only if the device supports Notification CC v2+. Version 1\n // doesn't provide information about supported notification types,\n // so we still need to interview Alarm Sensor CC for those devices.\n if (endpoint.supportsCC(CommandClasses.Notification)\n && endpoint.getCCVersion(CommandClasses.Notification) >= 2) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `${this.constructor.name}: skipping interview because Notification CC is supported...`,\n direction: \"none\",\n });\n this.setInterviewComplete(ctx, true);\n return;\n }\n const api = CCAPI.create(CommandClasses[\"Alarm Sensor\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // Find out which sensor types this sensor supports\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported sensor types...\",\n direction: \"outbound\",\n });\n const supportedSensorTypes = await api.getSupportedSensorTypes();\n if (supportedSensorTypes) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(\"received supported sensor types:\", {\n nested: logList(supportedSensorTypes.map((type) => getEnumMemberName(AlarmSensorType, type))),\n }),\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported sensor types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n // Query (all of) the sensor's current value(s)\n await this.refreshValues(ctx, { tag: \"interview\" });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Alarm Sensor\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n const supportedSensorTypes: readonly AlarmSensorType[] = this.getValue(ctx, AlarmSensorCCValues.supportedSensorTypes) ?? [];\n // Always query (all of) the sensor's current value(s)\n for (const type of supportedSensorTypes) {\n // Some devices report invalid sensor types, but the CC API checks\n // for valid values and throws otherwise.\n if (!isEnumMember(AlarmSensorType, type))\n continue;\n const sensorName = getEnumMemberName(AlarmSensorType, type);\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value for ${sensorName}...`,\n direction: \"outbound\",\n });\n const currentValue = await api.get(type);\n if (currentValue) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(`received current value for ${sensorName}:`, {\n nested: logDict({\n state: currentValue.state,\n severity: currentValue.severity,\n duration: currentValue.duration,\n }),\n }),\n direction: \"inbound\",\n });\n }\n }\n }\n /**\n * Returns which sensor types are supported.\n * This only works AFTER the interview process\n */\n public static getSupportedSensorTypesCached(ctx: GetValueDB, endpoint: EndpointId): MaybeNotKnown<AlarmSensorType[]> {\n return ctx\n .getValueDB(endpoint.nodeId)\n .getValue(AlarmSensorCCValues.supportedSensorTypes.endpoint(endpoint.index));\n }\n protected createMetadataForSensorType(ctx: GetValueDB, sensorType: AlarmSensorType): void {\n const stateValue = AlarmSensorCCValues.state(sensorType);\n const severityValue = AlarmSensorCCValues.severity(sensorType);\n const durationValue = AlarmSensorCCValues.duration(sensorType);\n // Always create metadata if it does not exist\n this.ensureMetadata(ctx, stateValue);\n this.ensureMetadata(ctx, severityValue);\n this.ensureMetadata(ctx, durationValue);\n }\n}\n// @publicAPI\nexport interface AlarmSensorCCReportOptions {\n sensorType: AlarmSensorType;\n state: boolean;\n severity?: number;\n duration?: number;\n}\n@CCCommand(AlarmSensorCommand.Report)\nexport class AlarmSensorCCReport extends AlarmSensorCC {\n public constructor(options: WithAddress<AlarmSensorCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sensorType = options.sensorType;\n this.state = options.state;\n this.severity = options.severity;\n this.duration = options.duration;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AlarmSensorCCReport {\n validatePayload(raw.payload.length >= 5, raw.payload[1] !== 0xff);\n const sourceNodeId = raw.payload[0];\n // Alarm Sensor reports may be forwarded by a different node, in which case the payload\n // contains the original node ID. We cannot verify that the forwarding node is allowed\n // to report on behalf of another node, so such reports are ignored.\n validatePayload.withReason(`Ignoring Alarm Sensor Report forwarded on behalf of node ${sourceNodeId}`)(sourceNodeId === 0 || sourceNodeId === ctx.sourceNodeId);\n const sensorType: AlarmSensorType = raw.payload[1];\n // Any positive value gets interpreted as alarm\n const state: boolean = raw.payload[2] > 0;\n // Severity only ranges from 1 to 100\n let severity: number | undefined;\n if (raw.payload[2] > 0 && raw.payload[2] <= 0x64) {\n severity = raw.payload[2];\n }\n // ignore zero durations\n const duration = raw.payload.readUInt16BE(3) || undefined;\n return new this({\n nodeId: ctx.sourceNodeId,\n sensorType,\n state,\n severity,\n duration,\n });\n }\n public readonly sensorType: AlarmSensorType;\n public readonly state: boolean;\n public readonly severity: number | undefined;\n public readonly duration: number | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n let severity: number;\n if (this.state) {\n severity = this.severity ?? 0xff;\n }\n else {\n severity = 0;\n }\n this.payload = Bytes.from([0, this.sensorType, severity, 0, 0]);\n this.payload.writeUInt16BE(this.duration ?? 0, 3);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"sensor type\": getEnumMemberName(AlarmSensorType, this.sensorType),\n \"alarm state\": this.state,\n };\n if (this.severity != undefined) {\n message.severity = this.severity;\n }\n if (this.duration != undefined) {\n message.duration = `${this.duration} seconds`;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Create metadata if it does not exist\n this.createMetadataForSensorType(ctx, this.sensorType);\n const stateValue = AlarmSensorCCValues.state(this.sensorType);\n const severityValue = AlarmSensorCCValues.severity(this.sensorType);\n const durationValue = AlarmSensorCCValues.duration(this.sensorType);\n this.setValue(ctx, stateValue, this.state);\n this.setValue(ctx, severityValue, this.severity);\n this.setValue(ctx, durationValue, this.duration);\n return true;\n }\n}\nfunction testResponseForAlarmSensorGet(sent: AlarmSensorCCGet, received: AlarmSensorCCReport) {\n // We expect a Alarm Sensor Report that matches the requested sensor type (if a type was requested)\n return (sent.sensorType === AlarmSensorType.Any\n || received.sensorType === sent.sensorType);\n}\n// @publicAPI\nexport interface AlarmSensorCCGetOptions {\n sensorType?: AlarmSensorType;\n}\n@CCCommand(AlarmSensorCommand.Get)\n@expectedCCResponse(AlarmSensorCCReport, testResponseForAlarmSensorGet)\nexport class AlarmSensorCCGet extends AlarmSensorCC {\n public constructor(options: WithAddress<AlarmSensorCCGetOptions>) {\n super(options);\n this.sensorType = options.sensorType ?? AlarmSensorType.Any;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AlarmSensorCCGet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n sensorType: raw.payload[0],\n });\n }\n public sensorType: AlarmSensorType;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.sensorType]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"sensor type\": getEnumMemberName(AlarmSensorType, this.sensorType),\n },\n };\n }\n}\n// @publicAPI\nexport interface AlarmSensorCCSupportedReportOptions {\n supportedSensorTypes: AlarmSensorType[];\n}\n@CCCommand(AlarmSensorCommand.SupportedReport)\n@ccValueProperty(\"supportedSensorTypes\", AlarmSensorCCValues.supportedSensorTypes)\nexport class AlarmSensorCCSupportedReport extends AlarmSensorCC {\n public constructor(options: WithAddress<AlarmSensorCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.supportedSensorTypes = options.supportedSensorTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AlarmSensorCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const bitMaskLength = raw.payload[0];\n validatePayload(raw.payload.length >= 1 + bitMaskLength);\n const supportedSensorTypes: AlarmSensorType[] = parseBitMask(raw.payload.subarray(1, 1 + bitMaskLength), AlarmSensorType[\"General Purpose\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedSensorTypes,\n });\n }\n public supportedSensorTypes: AlarmSensorType[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Any is not a valid sensor type for the bit mask\n const mask = encodeBitMask(this.supportedSensorTypes.filter((t) => t !== AlarmSensorType.Any), undefined, AlarmSensorType[\"General Purpose\"]);\n this.payload = Bytes.concat([[mask.length], mask]);\n return super.serialize(ctx);\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Create metadata for each sensor type\n for (const type of this.supportedSensorTypes) {\n this.createMetadataForSensorType(ctx, type);\n }\n return true;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported sensor types\": this.supportedSensorTypes\n .map((t) => getEnumMemberName(AlarmSensorType, t))\n .join(\", \"),\n },\n };\n }\n}\n@CCCommand(AlarmSensorCommand.SupportedGet)\n@expectedCCResponse(AlarmSensorCCSupportedReport)\nexport class AlarmSensorCCSupportedGet extends AlarmSensorCC {\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAA+P;AAC/P,oBAA6D;AAC7D,iBAAqC;AACrC,0BAAkJ;AAClJ,oCAAiH;AAEjH,mBAAoD;AAEpD,gCAAoC;AATpC,MAAM,EAAE,kCAAiC,IAAK;IAajC,oBAAgB,MAAA;8BAD5B,mCAAI,2BAAe,cAAc,CAAC,CAAC;;;;oBACE;;;wCAAA,YAAa;WAAA;;;;;;;;yBAa9C,kCAAiC,CAAE;AAEpC,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAg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;QACvB,SAAS;UACL,0BAA0B,KAAK,qBAC1B,IAAI,CAAC,UAAM,iCAAkB,8BAAiB,CAAC,CAAC,EAChD,KAAK,IAAI;;;IAG1B;;;;IAIS,6BAAyB,MAAA;8BAFrC,yCAAU,gCAAmB,YAAY,OACzC,kDAAmB,4BAA4B,CAAC;;;;oBACF;iDAAA,YAAa;WAAA;;;;;;;;AAA5D,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -346,7 +346,7 @@ let AssociationGroupInfoCCNameReport = (() => {
|
|
|
346
346
|
const nameLength = raw.payload[1];
|
|
347
347
|
(0, import_core.validatePayload)(nameLength <= 42);
|
|
348
348
|
(0, import_core.validatePayload)(raw.payload.length >= 2 + nameLength);
|
|
349
|
-
const name = (0, import_shared.
|
|
349
|
+
const name = (0, import_shared.stripControlCharacters)(raw.payload.subarray(2, 2 + nameLength).toString("utf8"));
|
|
350
350
|
return new this({
|
|
351
351
|
nodeId: ctx.sourceNodeId,
|
|
352
352
|
groupId,
|
|
@@ -626,7 +626,10 @@ let AssociationGroupInfoCCCommandListReport = (() => {
|
|
|
626
626
|
let offset = 0;
|
|
627
627
|
const commands = /* @__PURE__ */ new Map();
|
|
628
628
|
while (offset < listLength) {
|
|
629
|
-
const
|
|
629
|
+
const parsed = (0, import_core.tryParseCCId)(listBytes, offset);
|
|
630
|
+
if (!parsed || offset + parsed.bytesRead >= listLength)
|
|
631
|
+
break;
|
|
632
|
+
const { ccId, bytesRead } = parsed;
|
|
630
633
|
const command = listBytes[offset + bytesRead];
|
|
631
634
|
if (!commands.has(ccId))
|
|
632
635
|
commands.set(ccId, []);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/AssociationGroupInfoCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./AssociationGroupInfoCC._validateArgs.js\";\nconst { validateArgs_AssociationGroupInfoCCAPI_getGroupName, validateArgs_AssociationGroupInfoCCAPI_reportGroupName, validateArgs_AssociationGroupInfoCCAPI_getGroupInfo, validateArgs_AssociationGroupInfoCCAPI_reportGroupInfo, validateArgs_AssociationGroupInfoCCAPI_getCommands, validateArgs_AssociationGroupInfoCCAPI_reportCommands } = __validateArgs;\nimport { CommandClasses, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupportsCC, type WithAddress, encodeCCId, getCCName, logDict, logList, logText, parseCCId, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, cpp2js, getEnumMemberName, num2hex } from \"@zwave-js/shared\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { AssociationGroupInfoCommand, AssociationGroupInfoProfile, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { AssociationCC } from \"./AssociationCC.js\";\nimport { MultiChannelAssociationCC } from \"./MultiChannelAssociationCC.js\";\nimport { AssociationGroupInfoCCValues } from \"./_CCValues.generated.js\";\nexport { AssociationGroupInfoCCValues };\n// @noSetValueAPI This CC only has get-type commands\n@API(CommandClasses[\"Association Group Information\"])\nexport class AssociationGroupInfoCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: AssociationGroupInfoCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case AssociationGroupInfoCommand.NameGet:\n case AssociationGroupInfoCommand.NameReport:\n case AssociationGroupInfoCommand.InfoGet:\n case AssociationGroupInfoCommand.InfoReport:\n case AssociationGroupInfoCommand.CommandListGet:\n case AssociationGroupInfoCommand.CommandListReport:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n @validateArgs_AssociationGroupInfoCCAPI_getGroupName()\n public async getGroupName(groupId: number): Promise<MaybeNotKnown<string>> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.NameGet);\n const cc = new AssociationGroupInfoCCNameGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n });\n const response = await this.host.sendCommand<AssociationGroupInfoCCNameReport>(cc, this.commandOptions);\n if (response)\n return response.name;\n }\n @validateArgs_AssociationGroupInfoCCAPI_reportGroupName()\n public async reportGroupName(groupId: number, name: string): Promise<void> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.NameReport);\n const cc = new AssociationGroupInfoCCNameReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n name,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_AssociationGroupInfoCCAPI_getGroupInfo()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getGroupInfo(groupId: number, refreshCache: boolean = false) {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.InfoGet);\n const cc = new AssociationGroupInfoCCInfoGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n refreshCache,\n });\n const response = await this.host.sendCommand<AssociationGroupInfoCCInfoReport>(cc, this.commandOptions);\n // SDS13782 says: If List Mode is set to 0, the Group Count field MUST be set to 1.\n // But that's not always the case. Apparently some endpoints return 0 groups\n // although they support AGI CC\n if (response && response.groups.length > 0) {\n const { groupId: _, ...info } = response.groups[0];\n return {\n hasDynamicInfo: response.hasDynamicInfo,\n ...info,\n };\n }\n }\n @validateArgs_AssociationGroupInfoCCAPI_reportGroupInfo()\n public async reportGroupInfo(options: AssociationGroupInfoCCInfoReportOptions): Promise<void> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.InfoReport);\n const cc = new AssociationGroupInfoCCInfoReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_AssociationGroupInfoCCAPI_getCommands()\n public async getCommands(groupId: number, allowCache: boolean = true): Promise<MaybeNotKnown<AssociationGroupInfoCCCommandListReport[\"commands\"]>> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.CommandListGet);\n const cc = new AssociationGroupInfoCCCommandListGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n allowCache,\n });\n const response = await this.host.sendCommand<AssociationGroupInfoCCCommandListReport>(cc, this.commandOptions);\n if (response)\n return response.commands;\n }\n @validateArgs_AssociationGroupInfoCCAPI_reportCommands()\n public async reportCommands(groupId: number, commands: ReadonlyMap<CommandClasses, readonly number[]>): Promise<void> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.CommandListReport);\n const cc = new AssociationGroupInfoCCCommandListReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n commands,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses[\"Association Group Information\"])\n@implementedVersion(3)\n@ccValues(AssociationGroupInfoCCValues)\nexport class AssociationGroupInfoCC extends CommandClass {\n declare ccCommand: AssociationGroupInfoCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n // AssociationCC must be interviewed after Z-Wave+ if that is supported\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n ];\n }\n /** Returns the name of an association group */\n public static getGroupNameCached(ctx: GetValueDB, endpoint: EndpointId, groupId: number): MaybeNotKnown<string> {\n return ctx\n .getValueDB(endpoint.nodeId)\n .getValue(AssociationGroupInfoCCValues.groupName(groupId).endpoint(endpoint.index));\n }\n /** Returns the association profile for an association group */\n public static getGroupProfileCached(ctx: GetValueDB, endpoint: EndpointId, groupId: number): MaybeNotKnown<AssociationGroupInfoProfile> {\n return ctx.getValueDB(endpoint.nodeId).getValue<{\n profile: AssociationGroupInfoProfile;\n }>(AssociationGroupInfoCCValues.groupInfo(groupId).endpoint(endpoint.index))\n ?.profile;\n }\n /** Returns the dictionary of all commands issued by the given association group */\n public static getIssuedCommandsCached(ctx: GetValueDB, endpoint: EndpointId, groupId: number): MaybeNotKnown<ReadonlyMap<CommandClasses, readonly number[]>> {\n return ctx\n .getValueDB(endpoint.nodeId)\n .getValue(AssociationGroupInfoCCValues.commands(groupId).endpoint(endpoint.index));\n }\n public static findGroupsForIssuedCommand(ctx: GetValueDB, endpoint: EndpointId & SupportsCC, ccId: CommandClasses, command: number): number[] {\n const ret: number[] = [];\n const associationGroupCount = this.getAssociationGroupCountCached(ctx, endpoint);\n for (let groupId = 1; groupId <= associationGroupCount; groupId++) {\n // Scan the issued commands of all groups if there's a match\n const issuedCommands = this.getIssuedCommandsCached(ctx, endpoint, groupId);\n if (!issuedCommands)\n continue;\n if (issuedCommands.has(ccId)\n && issuedCommands.get(ccId)!.includes(command)) {\n ret.push(groupId);\n continue;\n }\n }\n return ret;\n }\n private static getAssociationGroupCountCached(ctx: GetValueDB, endpoint: EndpointId & SupportsCC): number {\n // The association group count is either determined by the\n // Association CC or the Multi Channel Association CC\n return (\n // First query the Multi Channel Association CC\n // And fall back to 0\n (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])\n && MultiChannelAssociationCC.getGroupCountCached(ctx, endpoint))\n // Then the Association CC\n || (endpoint.supportsCC(CommandClasses.Association)\n && AssociationCC.getGroupCountCached(ctx, endpoint))\n || 0);\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Association Group Information\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n const associationGroupCount = AssociationGroupInfoCC.getAssociationGroupCountCached(ctx, endpoint);\n for (let groupId = 1; groupId <= associationGroupCount; groupId++) {\n // First get the group's name\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Association group #${groupId}: Querying name...`,\n direction: \"outbound\",\n });\n const name = await api.getGroupName(groupId);\n if (name) {\n const logMessage = `Association group #${groupId} has name \"${name}\"`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n // Then the command list\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Association group #${groupId}: Querying command list...`,\n direction: \"outbound\",\n });\n await api.getCommands(groupId);\n // Not sure how to log this\n // This loop and the info query in refreshValues() each iterate over all groups,\n // so they make up the first and second half of this CC's interview progress.\n node.reportInterviewProgress(groupId, 2 * associationGroupCount);\n }\n // Finally query each group for its information\n await this.refreshValues(ctx, {\n tag: \"interview\",\n onProgress: (completed) => node.reportInterviewProgress(associationGroupCount + completed, 2 * associationGroupCount),\n });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Association Group Information\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the information for each group (this is the only thing that could be dynamic)\n const associationGroupCount = AssociationGroupInfoCC.getAssociationGroupCountCached(ctx, endpoint);\n const hasDynamicInfo = this.getValue<boolean>(ctx, AssociationGroupInfoCCValues.hasDynamicInfo);\n for (let groupId = 1; groupId <= associationGroupCount; groupId++) {\n // Then its information\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Association group #${groupId}: Querying info...`,\n direction: \"outbound\",\n });\n const info = await api.getGroupInfo(groupId, !!hasDynamicInfo);\n if (info) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(`Received info for association group #${groupId}:`, {\n nested: logDict({\n \"info is dynamic\": info.hasDynamicInfo,\n profile: getEnumMemberName(AssociationGroupInfoProfile, info.profile),\n }),\n }),\n direction: \"inbound\",\n });\n }\n options?.onProgress?.(groupId, associationGroupCount);\n }\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCNameReportOptions {\n groupId: number;\n name: string;\n}\n@CCCommand(AssociationGroupInfoCommand.NameReport)\nexport class AssociationGroupInfoCCNameReport extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCNameReportOptions>) {\n super(options);\n this.groupId = options.groupId;\n this.name = options.name;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCNameReport {\n validatePayload(raw.payload.length >= 2);\n const groupId = raw.payload[0];\n const nameLength = raw.payload[1];\n // CC:0059.01.02.11.001: The Name Length field MUST be in the range 0..42\n validatePayload(nameLength <= 42);\n validatePayload(raw.payload.length >= 2 + nameLength);\n // The specs don't allow 0-terminated string, but some devices use them\n // So we need to cut them off\n const name = cpp2js(raw.payload.subarray(2, 2 + nameLength).toString(\"utf8\"));\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n name,\n });\n }\n public readonly groupId: number;\n public readonly name: string;\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const valueDB = this.getValueDB(ctx);\n valueDB.setValue(AssociationGroupInfoCCValues.groupName(this.groupId).endpoint(this.endpointIndex), this.name);\n return true;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.groupId, this.name.length],\n Bytes.from(this.name, \"utf8\"),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n name: this.name,\n },\n };\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCNameGetOptions {\n groupId: number;\n}\n@CCCommand(AssociationGroupInfoCommand.NameGet)\n@expectedCCResponse(AssociationGroupInfoCCNameReport)\nexport class AssociationGroupInfoCCNameGet extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCNameGetOptions>) {\n super(options);\n this.groupId = options.groupId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCNameGet {\n validatePayload(raw.payload.length >= 1);\n const groupId = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n });\n }\n public groupId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.groupId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"group id\": this.groupId },\n };\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfo {\n groupId: number;\n mode: number;\n profile: number;\n eventCode: number;\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCInfoReportOptions {\n isListMode: boolean;\n hasDynamicInfo: boolean;\n groups: AssociationGroupInfo[];\n}\n@CCCommand(AssociationGroupInfoCommand.InfoReport)\n@ccValueProperty(\"hasDynamicInfo\", AssociationGroupInfoCCValues.hasDynamicInfo)\nexport class AssociationGroupInfoCCInfoReport extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCInfoReportOptions>) {\n super(options);\n this.isListMode = options.isListMode;\n this.hasDynamicInfo = options.hasDynamicInfo;\n this.groups = options.groups;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCInfoReport {\n validatePayload(raw.payload.length >= 1);\n const isListMode = !!(raw.payload[0] & 128);\n const hasDynamicInfo = !!(raw.payload[0] & 64);\n const groupCount = raw.payload[0] & 63;\n // each group requires 7 bytes of payload\n validatePayload(raw.payload.length >= 1 + groupCount * 7);\n const groups: AssociationGroupInfo[] = [];\n for (let i = 0; i < groupCount; i++) {\n const offset = 1 + i * 7;\n // Parse the payload\n const groupBytes = raw.payload.subarray(offset, offset + 7);\n const groupId = groupBytes[0];\n const mode = 0; // groupBytes[1];\n const profile = groupBytes.readUInt16BE(2);\n const eventCode = 0; // groupBytes.readUInt16BE(5);\n groups.push({ groupId, mode, profile, eventCode });\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n isListMode,\n hasDynamicInfo,\n groups,\n });\n }\n public readonly isListMode: boolean;\n public readonly hasDynamicInfo: boolean;\n public readonly groups: readonly AssociationGroupInfo[];\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n for (const group of this.groups) {\n const { groupId, mode, profile, eventCode } = group;\n this.setValue(ctx, AssociationGroupInfoCCValues.groupInfo(groupId), {\n mode,\n profile,\n eventCode,\n });\n }\n return true;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.alloc(1 + this.groups.length * 7, 0);\n this.payload[0] =\n (this.isListMode ? 128 : 0)\n | (this.hasDynamicInfo ? 64 : 0)\n | (this.groups.length & 63);\n for (let i = 0; i < this.groups.length; i++) {\n const offset = 1 + i * 7;\n this.payload[offset] = this.groups[i].groupId;\n this.payload.writeUInt16BE(this.groups[i].profile, offset + 2);\n // The remaining bytes are zero\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: logDict({\n \"is list mode\": this.isListMode,\n \"has dynamic info\": this.hasDynamicInfo,\n }, this.groups.map((g) => logText(`Group #${g.groupId}`, {\n nested: logDict({\n mode: g.mode,\n profile: g.profile,\n \"event code\": g.eventCode,\n }),\n }))),\n };\n }\n}\n// @publicAPI\nexport type AssociationGroupInfoCCInfoGetOptions = {\n refreshCache: boolean;\n} & ({\n listMode: boolean;\n} | {\n groupId: number;\n});\n@CCCommand(AssociationGroupInfoCommand.InfoGet)\n@expectedCCResponse(AssociationGroupInfoCCInfoReport)\nexport class AssociationGroupInfoCCInfoGet extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCInfoGetOptions>) {\n super(options);\n this.refreshCache = options.refreshCache;\n if (\"listMode\" in options)\n this.listMode = options.listMode;\n if (\"groupId\" in options)\n this.groupId = options.groupId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCInfoGet {\n validatePayload(raw.payload.length >= 2);\n const optionByte = raw.payload[0];\n const refreshCache = !!(optionByte & 128);\n const listMode: boolean | undefined = !!(optionByte & 64);\n let groupId: number | undefined;\n if (!listMode) {\n groupId = raw.payload[1];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n refreshCache,\n listMode,\n groupId,\n });\n }\n public refreshCache: boolean;\n public listMode?: boolean;\n public groupId?: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const isListMode = this.listMode === true;\n const optionByte = (this.refreshCache ? 128 : 0)\n | (isListMode ? 64 : 0);\n this.payload = Bytes.from([optionByte, isListMode ? 0 : this.groupId!]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.groupId != undefined) {\n message[\"group id\"] = this.groupId;\n }\n if (this.listMode != undefined) {\n message[\"list mode\"] = this.listMode;\n }\n message[\"refresh cache\"] = this.refreshCache;\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCCommandListReportOptions {\n groupId: number;\n commands: ReadonlyMap<CommandClasses, readonly number[]>;\n}\n@CCCommand(AssociationGroupInfoCommand.CommandListReport)\n@ccValueProperty(\"commands\", AssociationGroupInfoCCValues.commands, (self) => [\n self.groupId,\n])\nexport class AssociationGroupInfoCCCommandListReport extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCCommandListReportOptions>) {\n super(options);\n this.groupId = options.groupId;\n this.commands = options.commands;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCCommandListReport {\n validatePayload(raw.payload.length >= 2);\n const groupId = raw.payload[0];\n const listLength = raw.payload[1];\n validatePayload(raw.payload.length >= 2 + listLength);\n const listBytes = raw.payload.subarray(2, 2 + listLength);\n // Parse all CC ids and commands\n let offset = 0;\n const commands = new Map<CommandClasses, number[]>();\n while (offset < listLength) {\n const { ccId, bytesRead } = parseCCId(listBytes, offset);\n const command = listBytes[offset + bytesRead];\n if (!commands.has(ccId))\n commands.set(ccId, []);\n commands.get(ccId)!.push(command);\n offset += bytesRead + 1;\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n commands,\n });\n }\n public readonly groupId: number;\n public readonly commands: ReadonlyMap<CommandClasses, readonly number[]>;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // To make it easier to encode possible extended CCs, we first\n // allocate as much space as we may need, then trim it again\n this.payload = new Bytes(2 + this.commands.size * 3);\n this.payload[0] = this.groupId;\n let offset = 2;\n for (const [ccId, commands] of this.commands) {\n for (const command of commands) {\n offset += encodeCCId(ccId, this.payload, offset);\n this.payload[offset] = command;\n offset++;\n }\n }\n this.payload[1] = offset - 2; // list length\n this.payload = this.payload.subarray(0, offset);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n commands: logList([...this.commands].map(([cc, cmds]) => `${getCCName(cc)}: ${cmds\n .map((cmd) => num2hex(cmd))\n .join(\", \")}`)),\n },\n };\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCCommandListGetOptions {\n allowCache: boolean;\n groupId: number;\n}\n@CCCommand(AssociationGroupInfoCommand.CommandListGet)\n@expectedCCResponse(AssociationGroupInfoCCCommandListReport)\nexport class AssociationGroupInfoCCCommandListGet extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCCommandListGetOptions>) {\n super(options);\n this.allowCache = options.allowCache;\n this.groupId = options.groupId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCCommandListGet {\n validatePayload(raw.payload.length >= 2);\n const allowCache = !!(raw.payload[0] & 128);\n const groupId = raw.payload[1];\n return new this({\n nodeId: ctx.sourceNodeId,\n allowCache,\n groupId,\n });\n }\n public allowCache: boolean;\n public groupId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.allowCache ? 128 : 0,\n this.groupId,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"allow cache\": this.allowCache,\n },\n };\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAsQ;AACtQ,oBAA0D;AAC1D,iBAAqC;AACrC,0BAAkJ;AAClJ,oCAAiH;AAEjH,mBAA0E;AAE1E,2BAA8B;AAC9B,uCAA0C;AAC1C,gCAA6C;AAX7C,MAAM,EAAE,qDAAqD,wDAAwD,qDAAqD,wDAAwD,oDAAoD,sDAAqD,IAAK;IAenU,6BAAyB,MAAA;8BADrC,mCAAI,2BAAe,+BAA+B,CAAC,CAAC;;;;oBACN;;;;;;;;iDAAA,YAAa;WAAA;;;;;;;;kCAavD,oDAAmD,CAAE;qCAYrD,uDAAsD,CAAE;kCAWxD,oDAAmD,CAAE;qCAsBrD,uDAAsD,CAAE;iCAUxD,mDAAkD,CAAE;oCAapD,sDAAqD,CAAE;AAnExD,qCAAA,MAAA,MAAA,0BAAA,EAAA,MAAA,UAAA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MAAA;8BAFhD,yCAAU,yCAA4B,cAAc,OACpD,kDAAmB,uCAAuC,CAAC;;;;oBACF;4DAAA,YAAsB;WAAA;;;;;;;;AAAhF,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAAiE;AAChF,YAAM,OAAO;AACb,WAAK,aAAa,QAAQ;AAC1B,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,aAAa,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI;AACvC,YAAM,UAAU,IAAI,QAAQ,CAAC;AAC7B,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;QACA;OACH;IACL;IACO;IACA;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK;QACtB,KAAK,aAAa,MAAM;QACxB,KAAK;OACR;AACD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,YAAY,KAAK;UACjB,eAAe,KAAK;;;IAGhC;;;;",
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./AssociationGroupInfoCC._validateArgs.js\";\nconst { validateArgs_AssociationGroupInfoCCAPI_getGroupName, validateArgs_AssociationGroupInfoCCAPI_reportGroupName, validateArgs_AssociationGroupInfoCCAPI_getGroupInfo, validateArgs_AssociationGroupInfoCCAPI_reportGroupInfo, validateArgs_AssociationGroupInfoCCAPI_getCommands, validateArgs_AssociationGroupInfoCCAPI_reportCommands } = __validateArgs;\nimport { CommandClasses, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupportsCC, type WithAddress, encodeCCId, getCCName, logDict, logList, logText, tryParseCCId, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, stripControlCharacters, getEnumMemberName, num2hex, } from \"@zwave-js/shared\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { AssociationGroupInfoCommand, AssociationGroupInfoProfile, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { AssociationCC } from \"./AssociationCC.js\";\nimport { MultiChannelAssociationCC } from \"./MultiChannelAssociationCC.js\";\nimport { AssociationGroupInfoCCValues } from \"./_CCValues.generated.js\";\nexport { AssociationGroupInfoCCValues };\n// @noSetValueAPI This CC only has get-type commands\n@API(CommandClasses[\"Association Group Information\"])\nexport class AssociationGroupInfoCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: AssociationGroupInfoCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case AssociationGroupInfoCommand.NameGet:\n case AssociationGroupInfoCommand.NameReport:\n case AssociationGroupInfoCommand.InfoGet:\n case AssociationGroupInfoCommand.InfoReport:\n case AssociationGroupInfoCommand.CommandListGet:\n case AssociationGroupInfoCommand.CommandListReport:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n @validateArgs_AssociationGroupInfoCCAPI_getGroupName()\n public async getGroupName(groupId: number): Promise<MaybeNotKnown<string>> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.NameGet);\n const cc = new AssociationGroupInfoCCNameGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n });\n const response = await this.host.sendCommand<AssociationGroupInfoCCNameReport>(cc, this.commandOptions);\n if (response)\n return response.name;\n }\n @validateArgs_AssociationGroupInfoCCAPI_reportGroupName()\n public async reportGroupName(groupId: number, name: string): Promise<void> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.NameReport);\n const cc = new AssociationGroupInfoCCNameReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n name,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_AssociationGroupInfoCCAPI_getGroupInfo()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getGroupInfo(groupId: number, refreshCache: boolean = false) {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.InfoGet);\n const cc = new AssociationGroupInfoCCInfoGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n refreshCache,\n });\n const response = await this.host.sendCommand<AssociationGroupInfoCCInfoReport>(cc, this.commandOptions);\n // SDS13782 says: If List Mode is set to 0, the Group Count field MUST be set to 1.\n // But that's not always the case. Apparently some endpoints return 0 groups\n // although they support AGI CC\n if (response && response.groups.length > 0) {\n const { groupId: _, ...info } = response.groups[0];\n return {\n hasDynamicInfo: response.hasDynamicInfo,\n ...info,\n };\n }\n }\n @validateArgs_AssociationGroupInfoCCAPI_reportGroupInfo()\n public async reportGroupInfo(options: AssociationGroupInfoCCInfoReportOptions): Promise<void> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.InfoReport);\n const cc = new AssociationGroupInfoCCInfoReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_AssociationGroupInfoCCAPI_getCommands()\n public async getCommands(groupId: number, allowCache: boolean = true): Promise<MaybeNotKnown<AssociationGroupInfoCCCommandListReport[\"commands\"]>> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.CommandListGet);\n const cc = new AssociationGroupInfoCCCommandListGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n allowCache,\n });\n const response = await this.host.sendCommand<AssociationGroupInfoCCCommandListReport>(cc, this.commandOptions);\n if (response)\n return response.commands;\n }\n @validateArgs_AssociationGroupInfoCCAPI_reportCommands()\n public async reportCommands(groupId: number, commands: ReadonlyMap<CommandClasses, readonly number[]>): Promise<void> {\n this.assertSupportsCommand(AssociationGroupInfoCommand, AssociationGroupInfoCommand.CommandListReport);\n const cc = new AssociationGroupInfoCCCommandListReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n commands,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n}\n@commandClass(CommandClasses[\"Association Group Information\"])\n@implementedVersion(3)\n@ccValues(AssociationGroupInfoCCValues)\nexport class AssociationGroupInfoCC extends CommandClass {\n declare ccCommand: AssociationGroupInfoCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n // AssociationCC must be interviewed after Z-Wave+ if that is supported\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n ];\n }\n /** Returns the name of an association group */\n public static getGroupNameCached(ctx: GetValueDB, endpoint: EndpointId, groupId: number): MaybeNotKnown<string> {\n return ctx\n .getValueDB(endpoint.nodeId)\n .getValue(AssociationGroupInfoCCValues.groupName(groupId).endpoint(endpoint.index));\n }\n /** Returns the association profile for an association group */\n public static getGroupProfileCached(ctx: GetValueDB, endpoint: EndpointId, groupId: number): MaybeNotKnown<AssociationGroupInfoProfile> {\n return ctx.getValueDB(endpoint.nodeId).getValue<{\n profile: AssociationGroupInfoProfile;\n }>(AssociationGroupInfoCCValues.groupInfo(groupId).endpoint(endpoint.index))\n ?.profile;\n }\n /** Returns the dictionary of all commands issued by the given association group */\n public static getIssuedCommandsCached(ctx: GetValueDB, endpoint: EndpointId, groupId: number): MaybeNotKnown<ReadonlyMap<CommandClasses, readonly number[]>> {\n return ctx\n .getValueDB(endpoint.nodeId)\n .getValue(AssociationGroupInfoCCValues.commands(groupId).endpoint(endpoint.index));\n }\n public static findGroupsForIssuedCommand(ctx: GetValueDB, endpoint: EndpointId & SupportsCC, ccId: CommandClasses, command: number): number[] {\n const ret: number[] = [];\n const associationGroupCount = this.getAssociationGroupCountCached(ctx, endpoint);\n for (let groupId = 1; groupId <= associationGroupCount; groupId++) {\n // Scan the issued commands of all groups if there's a match\n const issuedCommands = this.getIssuedCommandsCached(ctx, endpoint, groupId);\n if (!issuedCommands)\n continue;\n if (issuedCommands.has(ccId)\n && issuedCommands.get(ccId)!.includes(command)) {\n ret.push(groupId);\n continue;\n }\n }\n return ret;\n }\n private static getAssociationGroupCountCached(ctx: GetValueDB, endpoint: EndpointId & SupportsCC): number {\n // The association group count is either determined by the\n // Association CC or the Multi Channel Association CC\n return (\n // First query the Multi Channel Association CC\n // And fall back to 0\n (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])\n && MultiChannelAssociationCC.getGroupCountCached(ctx, endpoint))\n // Then the Association CC\n || (endpoint.supportsCC(CommandClasses.Association)\n && AssociationCC.getGroupCountCached(ctx, endpoint))\n || 0);\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Association Group Information\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n const associationGroupCount = AssociationGroupInfoCC.getAssociationGroupCountCached(ctx, endpoint);\n for (let groupId = 1; groupId <= associationGroupCount; groupId++) {\n // First get the group's name\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Association group #${groupId}: Querying name...`,\n direction: \"outbound\",\n });\n const name = await api.getGroupName(groupId);\n if (name) {\n const logMessage = `Association group #${groupId} has name \"${name}\"`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n // Then the command list\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Association group #${groupId}: Querying command list...`,\n direction: \"outbound\",\n });\n await api.getCommands(groupId);\n // Not sure how to log this\n // This loop and the info query in refreshValues() each iterate over all groups,\n // so they make up the first and second half of this CC's interview progress.\n node.reportInterviewProgress(groupId, 2 * associationGroupCount);\n }\n // Finally query each group for its information\n await this.refreshValues(ctx, {\n tag: \"interview\",\n onProgress: (completed) => node.reportInterviewProgress(associationGroupCount + completed, 2 * associationGroupCount),\n });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Association Group Information\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the information for each group (this is the only thing that could be dynamic)\n const associationGroupCount = AssociationGroupInfoCC.getAssociationGroupCountCached(ctx, endpoint);\n const hasDynamicInfo = this.getValue<boolean>(ctx, AssociationGroupInfoCCValues.hasDynamicInfo);\n for (let groupId = 1; groupId <= associationGroupCount; groupId++) {\n // Then its information\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Association group #${groupId}: Querying info...`,\n direction: \"outbound\",\n });\n const info = await api.getGroupInfo(groupId, !!hasDynamicInfo);\n if (info) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(`Received info for association group #${groupId}:`, {\n nested: logDict({\n \"info is dynamic\": info.hasDynamicInfo,\n profile: getEnumMemberName(AssociationGroupInfoProfile, info.profile),\n }),\n }),\n direction: \"inbound\",\n });\n }\n options?.onProgress?.(groupId, associationGroupCount);\n }\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCNameReportOptions {\n groupId: number;\n name: string;\n}\n@CCCommand(AssociationGroupInfoCommand.NameReport)\nexport class AssociationGroupInfoCCNameReport extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCNameReportOptions>) {\n super(options);\n this.groupId = options.groupId;\n this.name = options.name;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCNameReport {\n validatePayload(raw.payload.length >= 2);\n const groupId = raw.payload[0];\n const nameLength = raw.payload[1];\n // CC:0059.01.02.11.001: The Name Length field MUST be in the range 0..42\n validatePayload(nameLength <= 42);\n validatePayload(raw.payload.length >= 2 + nameLength);\n // The specs don't allow 0-terminated strings, but some devices use them.\n // stripControlCharacters cuts them off at the first NUL character.\n const name = stripControlCharacters(raw.payload.subarray(2, 2 + nameLength).toString(\"utf8\"));\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n name,\n });\n }\n public readonly groupId: number;\n public readonly name: string;\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const valueDB = this.getValueDB(ctx);\n valueDB.setValue(AssociationGroupInfoCCValues.groupName(this.groupId).endpoint(this.endpointIndex), this.name);\n return true;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.groupId, this.name.length],\n Bytes.from(this.name, \"utf8\"),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n name: this.name,\n },\n };\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCNameGetOptions {\n groupId: number;\n}\n@CCCommand(AssociationGroupInfoCommand.NameGet)\n@expectedCCResponse(AssociationGroupInfoCCNameReport)\nexport class AssociationGroupInfoCCNameGet extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCNameGetOptions>) {\n super(options);\n this.groupId = options.groupId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCNameGet {\n validatePayload(raw.payload.length >= 1);\n const groupId = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n });\n }\n public groupId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.groupId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"group id\": this.groupId },\n };\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfo {\n groupId: number;\n mode: number;\n profile: number;\n eventCode: number;\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCInfoReportOptions {\n isListMode: boolean;\n hasDynamicInfo: boolean;\n groups: AssociationGroupInfo[];\n}\n@CCCommand(AssociationGroupInfoCommand.InfoReport)\n@ccValueProperty(\"hasDynamicInfo\", AssociationGroupInfoCCValues.hasDynamicInfo)\nexport class AssociationGroupInfoCCInfoReport extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCInfoReportOptions>) {\n super(options);\n this.isListMode = options.isListMode;\n this.hasDynamicInfo = options.hasDynamicInfo;\n this.groups = options.groups;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCInfoReport {\n validatePayload(raw.payload.length >= 1);\n const isListMode = !!(raw.payload[0] & 128);\n const hasDynamicInfo = !!(raw.payload[0] & 64);\n const groupCount = raw.payload[0] & 63;\n // each group requires 7 bytes of payload\n validatePayload(raw.payload.length >= 1 + groupCount * 7);\n const groups: AssociationGroupInfo[] = [];\n for (let i = 0; i < groupCount; i++) {\n const offset = 1 + i * 7;\n // Parse the payload\n const groupBytes = raw.payload.subarray(offset, offset + 7);\n const groupId = groupBytes[0];\n const mode = 0; // groupBytes[1];\n const profile = groupBytes.readUInt16BE(2);\n const eventCode = 0; // groupBytes.readUInt16BE(5);\n groups.push({ groupId, mode, profile, eventCode });\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n isListMode,\n hasDynamicInfo,\n groups,\n });\n }\n public readonly isListMode: boolean;\n public readonly hasDynamicInfo: boolean;\n public readonly groups: readonly AssociationGroupInfo[];\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n for (const group of this.groups) {\n const { groupId, mode, profile, eventCode } = group;\n this.setValue(ctx, AssociationGroupInfoCCValues.groupInfo(groupId), {\n mode,\n profile,\n eventCode,\n });\n }\n return true;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.alloc(1 + this.groups.length * 7, 0);\n this.payload[0] =\n (this.isListMode ? 128 : 0)\n | (this.hasDynamicInfo ? 64 : 0)\n | (this.groups.length & 63);\n for (let i = 0; i < this.groups.length; i++) {\n const offset = 1 + i * 7;\n this.payload[offset] = this.groups[i].groupId;\n this.payload.writeUInt16BE(this.groups[i].profile, offset + 2);\n // The remaining bytes are zero\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: logDict({\n \"is list mode\": this.isListMode,\n \"has dynamic info\": this.hasDynamicInfo,\n }, this.groups.map((g) => logText(`Group #${g.groupId}`, {\n nested: logDict({\n mode: g.mode,\n profile: g.profile,\n \"event code\": g.eventCode,\n }),\n }))),\n };\n }\n}\n// @publicAPI\nexport type AssociationGroupInfoCCInfoGetOptions = {\n refreshCache: boolean;\n} & ({\n listMode: boolean;\n} | {\n groupId: number;\n});\n@CCCommand(AssociationGroupInfoCommand.InfoGet)\n@expectedCCResponse(AssociationGroupInfoCCInfoReport)\nexport class AssociationGroupInfoCCInfoGet extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCInfoGetOptions>) {\n super(options);\n this.refreshCache = options.refreshCache;\n if (\"listMode\" in options)\n this.listMode = options.listMode;\n if (\"groupId\" in options)\n this.groupId = options.groupId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCInfoGet {\n validatePayload(raw.payload.length >= 2);\n const optionByte = raw.payload[0];\n const refreshCache = !!(optionByte & 128);\n const listMode: boolean | undefined = !!(optionByte & 64);\n let groupId: number | undefined;\n if (!listMode) {\n groupId = raw.payload[1];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n refreshCache,\n listMode,\n groupId,\n });\n }\n public refreshCache: boolean;\n public listMode?: boolean;\n public groupId?: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const isListMode = this.listMode === true;\n const optionByte = (this.refreshCache ? 128 : 0)\n | (isListMode ? 64 : 0);\n this.payload = Bytes.from([optionByte, isListMode ? 0 : this.groupId!]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.groupId != undefined) {\n message[\"group id\"] = this.groupId;\n }\n if (this.listMode != undefined) {\n message[\"list mode\"] = this.listMode;\n }\n message[\"refresh cache\"] = this.refreshCache;\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCCommandListReportOptions {\n groupId: number;\n commands: ReadonlyMap<CommandClasses, readonly number[]>;\n}\n@CCCommand(AssociationGroupInfoCommand.CommandListReport)\n@ccValueProperty(\"commands\", AssociationGroupInfoCCValues.commands, (self) => [\n self.groupId,\n])\nexport class AssociationGroupInfoCCCommandListReport extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCCommandListReportOptions>) {\n super(options);\n this.groupId = options.groupId;\n this.commands = options.commands;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCCommandListReport {\n validatePayload(raw.payload.length >= 2);\n const groupId = raw.payload[0];\n const listLength = raw.payload[1];\n validatePayload(raw.payload.length >= 2 + listLength);\n const listBytes = raw.payload.subarray(2, 2 + listLength);\n // Parse all CC ids and commands\n let offset = 0;\n const commands = new Map<CommandClasses, number[]>();\n while (offset < listLength) {\n // Ignore a truncated entry at the end of the list\n const parsed = tryParseCCId(listBytes, offset);\n if (!parsed || offset + parsed.bytesRead >= listLength)\n break;\n const { ccId, bytesRead } = parsed;\n const command = listBytes[offset + bytesRead];\n if (!commands.has(ccId))\n commands.set(ccId, []);\n commands.get(ccId)!.push(command);\n offset += bytesRead + 1;\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n commands,\n });\n }\n public readonly groupId: number;\n public readonly commands: ReadonlyMap<CommandClasses, readonly number[]>;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // To make it easier to encode possible extended CCs, we first\n // allocate as much space as we may need, then trim it again\n this.payload = new Bytes(2 + this.commands.size * 3);\n this.payload[0] = this.groupId;\n let offset = 2;\n for (const [ccId, commands] of this.commands) {\n for (const command of commands) {\n offset += encodeCCId(ccId, this.payload, offset);\n this.payload[offset] = command;\n offset++;\n }\n }\n this.payload[1] = offset - 2; // list length\n this.payload = this.payload.subarray(0, offset);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n commands: logList([...this.commands].map(([cc, cmds]) => `${getCCName(cc)}: ${cmds\n .map((cmd) => num2hex(cmd))\n .join(\", \")}`)),\n },\n };\n }\n}\n// @publicAPI\nexport interface AssociationGroupInfoCCCommandListGetOptions {\n allowCache: boolean;\n groupId: number;\n}\n@CCCommand(AssociationGroupInfoCommand.CommandListGet)\n@expectedCCResponse(AssociationGroupInfoCCCommandListReport)\nexport class AssociationGroupInfoCCCommandListGet extends AssociationGroupInfoCC {\n public constructor(options: WithAddress<AssociationGroupInfoCCCommandListGetOptions>) {\n super(options);\n this.allowCache = options.allowCache;\n this.groupId = options.groupId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): AssociationGroupInfoCCCommandListGet {\n validatePayload(raw.payload.length >= 2);\n const allowCache = !!(raw.payload[0] & 128);\n const groupId = raw.payload[1];\n return new this({\n nodeId: ctx.sourceNodeId,\n allowCache,\n groupId,\n });\n }\n public allowCache: boolean;\n public groupId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.allowCache ? 128 : 0,\n this.groupId,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"allow cache\": this.allowCache,\n },\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAyQ;AACzQ,oBAA2E;AAC3E,iBAAqC;AACrC,0BAAkJ;AAClJ,oCAAiH;AAEjH,mBAA0E;AAE1E,2BAA8B;AAC9B,uCAA0C;AAC1C,gCAA6C;AAX7C,MAAM,EAAE,qDAAqD,wDAAwD,qDAAqD,wDAAwD,oDAAoD,sDAAqD,IAAK;IAenU,6BAAyB,MAAA;8BADrC,mCAAI,2BAAe,+BAA+B,CAAC,CAAC;;;;oBACN;;;;;;;;iDAAA,YAAa;WAAA;;;;;;;;kCAavD,oDAAmD,CAAE;qCAYrD,uDAAsD,CAAE;kCAWxD,oDAAmD,CAAE;qCAsBrD,uDAAsD,CAAE;iCAUxD,mDAAkD,CAAE;oCAapD,sDAAqD,CAAE;AAnExD,qCAAA,MAAA,MAAA,0BAAA,EAAA,MAAA,UAAA,MAAA,gBAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,kBAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,cAAb,OAAyB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAYzB,qCAAA,MAAA,MAAA,6BAAA,EAAA,MAAA,UAAA,MAAA,mBAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,qBAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,iBAAb,OAA4B,GAAA,UAA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IACT,YAAmB,SAAiE;AAChF,YAAM,OAAO;AACb,WAAK,aAAa,QAAQ;AAC1B,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,aAAa,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI;AACvC,YAAM,UAAU,IAAI,QAAQ,CAAC;AAC7B,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;QACA;OACH;IACL;IACO;IACA;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK;QACtB,KAAK,aAAa,MAAM;QACxB,KAAK;OACR;AACD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,YAAY,KAAK;UACjB,eAAe,KAAK;;;IAGhC;;;;",
|
|
6
6
|
"names": ["AssociationGroupInfoCC"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GetDeviceConfig } from "@zwave-js/config";
|
|
1
2
|
import { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, type WithAddress } from "@zwave-js/core";
|
|
2
3
|
import { Bytes } from "@zwave-js/shared";
|
|
3
4
|
import { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation } from "../lib/API.js";
|
|
@@ -6,6 +7,10 @@ import { CentralSceneCommand, CentralSceneKeys } from "../lib/_Types.js";
|
|
|
6
7
|
import type { CCEncodingContext, CCParsingContext } from "../lib/traits.js";
|
|
7
8
|
import { CentralSceneCCValues } from "./_CCValues.generated.js";
|
|
8
9
|
export { CentralSceneCCValues };
|
|
10
|
+
/**
|
|
11
|
+
* Updates the label and description of all stored scene metadata from the device config file.
|
|
12
|
+
*/
|
|
13
|
+
export declare function refreshSceneMetadataFromConfigFile(ctx: GetValueDB & GetDeviceConfig, nodeId: number, endpointIndex: number): void;
|
|
9
14
|
export declare class CentralSceneCCAPI extends CCAPI {
|
|
10
15
|
supportsCommand(cmd: CentralSceneCommand): MaybeNotKnown<boolean>;
|
|
11
16
|
getSupported(): Promise<Pick<CentralSceneCCSupportedReport, "sceneCount" | "supportedKeyAttributes" | "supportsSlowRefresh"> | undefined>;
|
|
@@ -37,7 +37,8 @@ __export(CentralSceneCC_exports, {
|
|
|
37
37
|
CentralSceneCCNotification: () => CentralSceneCCNotification,
|
|
38
38
|
CentralSceneCCSupportedGet: () => CentralSceneCCSupportedGet,
|
|
39
39
|
CentralSceneCCSupportedReport: () => CentralSceneCCSupportedReport,
|
|
40
|
-
CentralSceneCCValues: () => import_CCValues_generated.CentralSceneCCValues
|
|
40
|
+
CentralSceneCCValues: () => import_CCValues_generated.CentralSceneCCValues,
|
|
41
|
+
refreshSceneMetadataFromConfigFile: () => refreshSceneMetadataFromConfigFile
|
|
41
42
|
});
|
|
42
43
|
module.exports = __toCommonJS(CentralSceneCC_exports);
|
|
43
44
|
var import_tslib = require("tslib");
|
|
@@ -51,6 +52,30 @@ var import_Types = require("../lib/_Types.js");
|
|
|
51
52
|
var ccUtils = __toESM(require("../lib/utils.js"), 1);
|
|
52
53
|
var import_CCValues_generated = require("./_CCValues.generated.js");
|
|
53
54
|
const { validateArgs_CentralSceneCCAPI_setConfiguration } = __validateArgs;
|
|
55
|
+
function refreshSceneMetadataFromConfigFile(ctx, nodeId, endpointIndex) {
|
|
56
|
+
const deviceConfig = ctx.getDeviceConfig?.(nodeId);
|
|
57
|
+
const valueDB = ctx.getValueDB(nodeId);
|
|
58
|
+
for (const { metadata, ...valueId } of valueDB.getAllMetadata(import_core.CommandClasses["Central Scene"])) {
|
|
59
|
+
if ((valueId.endpoint ?? 0) !== endpointIndex || !import_CCValues_generated.CentralSceneCCValues.scene.is(valueId)) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const sceneNumber = parseInt(valueId.propertyKey, 10);
|
|
63
|
+
const sceneConfig = deviceConfig?.scenes?.get(sceneNumber);
|
|
64
|
+
const label = sceneConfig?.label ?? import_CCValues_generated.CentralSceneCCValues.scene(sceneNumber).meta.label;
|
|
65
|
+
const description = sceneConfig?.description;
|
|
66
|
+
if (metadata.label === label && metadata.description === description) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const newMetadata = { ...metadata, label };
|
|
70
|
+
if (description != void 0) {
|
|
71
|
+
newMetadata.description = description;
|
|
72
|
+
} else {
|
|
73
|
+
delete newMetadata.description;
|
|
74
|
+
}
|
|
75
|
+
valueDB.setMetadata(valueId, newMetadata);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
__name(refreshSceneMetadataFromConfigFile, "refreshSceneMetadataFromConfigFile");
|
|
54
79
|
let CentralSceneCCAPI = (() => {
|
|
55
80
|
let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["Central Scene"])];
|
|
56
81
|
let _classDescriptor;
|
|
@@ -588,6 +613,7 @@ let CentralSceneCCConfigurationSet = (() => {
|
|
|
588
613
|
CentralSceneCCNotification,
|
|
589
614
|
CentralSceneCCSupportedGet,
|
|
590
615
|
CentralSceneCCSupportedReport,
|
|
591
|
-
CentralSceneCCValues
|
|
616
|
+
CentralSceneCCValues,
|
|
617
|
+
refreshSceneMetadataFromConfigFile
|
|
592
618
|
});
|
|
593
619
|
//# sourceMappingURL=CentralSceneCC.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/CentralSceneCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./CentralSceneCC._validateArgs.js\";\nconst { validateArgs_CentralSceneCCAPI_setConfiguration } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, enumValuesToMetadataStates, encodeBitMask, getCCName, logDict, logList, logText, maybeUnknownToString, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { CentralSceneCommand, CentralSceneKeys } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { CentralSceneCCValues } from \"./_CCValues.generated.js\";\nexport { CentralSceneCCValues };\n@API(CommandClasses[\"Central Scene\"])\nexport class CentralSceneCCAPI extends CCAPI {\n public supportsCommand(cmd: CentralSceneCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case CentralSceneCommand.SupportedGet:\n return this.isSinglecast(); // this is mandatory\n case CentralSceneCommand.ConfigurationGet:\n return this.version >= 3 && this.isSinglecast();\n case CentralSceneCommand.ConfigurationSet:\n return this.version >= 3;\n }\n return super.supportsCommand(cmd);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.SupportedGet);\n const cc = new CentralSceneCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<CentralSceneCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"sceneCount\",\n \"supportsSlowRefresh\",\n \"supportedKeyAttributes\",\n ]);\n }\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getConfiguration() {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.ConfigurationGet);\n const cc = new CentralSceneCCConfigurationGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<CentralSceneCCConfigurationReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"slowRefresh\"]);\n }\n }\n @validateArgs_CentralSceneCCAPI_setConfiguration()\n public async setConfiguration(slowRefresh: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.ConfigurationSet);\n const cc = new CentralSceneCCConfigurationSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n slowRefresh,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: CentralSceneCCAPI, { property }, value) {\n if (property !== \"slowRefresh\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n return this.setConfiguration(value);\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: CentralSceneCCAPI, { property }) {\n if (property === \"slowRefresh\") {\n return (await this.getConfiguration())?.[property];\n }\n throwUnsupportedProperty(this.ccId, property);\n };\n }\n}\n@commandClass(CommandClasses[\"Central Scene\"])\n@implementedVersion(3)\n@ccValues(CentralSceneCCValues)\nexport class CentralSceneCC extends CommandClass {\n declare ccCommand: CentralSceneCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n CommandClasses[\"Association Group Information\"],\n ];\n }\n public skipEndpointInterview(): boolean {\n // Central scene notifications are issued by the root device\n return true;\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Central Scene\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // If one Association group issues CentralScene notifications,\n // we must associate ourselves with that channel\n try {\n await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, CentralSceneCommand.Notification);\n }\n catch {\n ctx.logNode(node.id, {\n endpoint: endpoint.index,\n message: `Configuring associations to receive ${getCCName(this.ccId)} commands failed!`,\n level: \"warn\",\n });\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported scenes...\",\n direction: \"outbound\",\n });\n const ccSupported = await api.getSupported();\n if (ccSupported) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(\"received supported scenes:\", {\n nested: logDict({\n \"# of scenes\": ccSupported.sceneCount,\n \"supports slow refresh\": ccSupported.supportsSlowRefresh,\n }),\n }),\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported scenes timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n // The slow refresh capability should be enabled whenever possible\n if (api.version >= 3 && ccSupported?.supportsSlowRefresh) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Enabling slow refresh capability...\",\n direction: \"outbound\",\n });\n await api.setConfiguration(true);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n}\n// @publicAPI\nexport interface CentralSceneCCNotificationOptions {\n sequenceNumber: number;\n keyAttribute: CentralSceneKeys;\n sceneNumber: number;\n slowRefresh?: boolean;\n}\n@CCCommand(CentralSceneCommand.Notification)\nexport class CentralSceneCCNotification extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCNotificationOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sequenceNumber = options.sequenceNumber;\n this.keyAttribute = options.keyAttribute;\n this.sceneNumber = options.sceneNumber;\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCNotification {\n validatePayload(raw.payload.length >= 3);\n const sequenceNumber = raw.payload[0];\n const keyAttribute: CentralSceneKeys = raw.payload[1] & 0b111;\n const sceneNumber = raw.payload[2];\n let slowRefresh: boolean | undefined;\n if (keyAttribute === CentralSceneKeys.KeyHeldDown) {\n // A receiving node MUST ignore this field if the command is not\n // carrying the Key Held Down key attribute.\n slowRefresh = !!(raw.payload[1] & 128);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sequenceNumber,\n keyAttribute,\n sceneNumber,\n slowRefresh,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // In case the interview is not yet completed, we still create some basic metadata\n const sceneValue = CentralSceneCCValues.scene(this.sceneNumber);\n // Get device configuration to check for custom scene labels\n const sceneConfig = ctx\n .getDeviceConfig?.(this.nodeId as number)\n ?.scenes?.get(this.sceneNumber);\n if (sceneConfig) {\n // Ensure metadata with custom label and description\n this.ensureMetadata(ctx, sceneValue, {\n ...sceneValue.meta,\n label: sceneConfig.label,\n description: sceneConfig.description,\n });\n }\n else {\n // Use default metadata\n this.ensureMetadata(ctx, sceneValue);\n }\n // The spec behavior is pretty complicated, so we cannot just store\n // the value and call it a day. Handling of these notifications will\n // happen in the receiving node class\n return true;\n }\n public readonly sequenceNumber: number;\n public readonly keyAttribute: CentralSceneKeys;\n public readonly sceneNumber: number;\n public readonly slowRefresh: boolean | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n let keyAttributeByte = this.keyAttribute & 0b111;\n if (this.slowRefresh)\n keyAttributeByte |= 0x80;\n this.payload = Bytes.from([\n this.sequenceNumber,\n keyAttributeByte,\n this.sceneNumber,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"sequence number\": this.sequenceNumber,\n \"key attribute\": getEnumMemberName(CentralSceneKeys, this.keyAttribute),\n \"scene number\": this.sceneNumber,\n };\n if (this.slowRefresh != undefined) {\n message[\"slow refresh\"] = this.slowRefresh;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface CentralSceneCCSupportedReportOptions {\n sceneCount: number;\n supportsSlowRefresh: MaybeNotKnown<boolean>;\n supportedKeyAttributes: Record<number, readonly CentralSceneKeys[]>;\n}\n@CCCommand(CentralSceneCommand.SupportedReport)\n@ccValueProperty(\"sceneCount\", CentralSceneCCValues.sceneCount)\n@ccValueProperty(\"supportsSlowRefresh\", CentralSceneCCValues.supportsSlowRefresh)\n@ccValueProperty(\"supportedKeyAttributes\", CentralSceneCCValues.supportedKeyAttributes)\nexport class CentralSceneCCSupportedReport extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sceneCount = options.sceneCount;\n this.supportsSlowRefresh = options.supportsSlowRefresh;\n for (const [scene, keys] of Object.entries(options.supportedKeyAttributes)) {\n this._supportedKeyAttributes.set(parseInt(scene), keys);\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCSupportedReport {\n validatePayload(raw.payload.length >= 2);\n const sceneCount = raw.payload[0];\n const supportsSlowRefresh: MaybeNotKnown<boolean> = !!(raw.payload[1] & 128);\n const bitMaskBytes = (raw.payload[1] & 0b110) >>> 1;\n const identicalKeyAttributes = !!(raw.payload[1] & 0b1);\n const numEntries = identicalKeyAttributes ? 1 : sceneCount;\n validatePayload(raw.payload.length >= 2 + bitMaskBytes * numEntries);\n const supportedKeyAttributes: Record<number, readonly CentralSceneKeys[]> = {};\n for (let i = 0; i < numEntries; i++) {\n const mask = raw.payload.subarray(2 + i * bitMaskBytes, 2 + (i + 1) * bitMaskBytes);\n supportedKeyAttributes[i + 1] = parseBitMask(mask, CentralSceneKeys.KeyPressed);\n }\n if (identicalKeyAttributes) {\n // The key attributes are only transmitted for scene 1, copy them to the others\n for (let i = 2; i <= sceneCount; i++) {\n supportedKeyAttributes[i] = supportedKeyAttributes[1];\n }\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sceneCount,\n supportsSlowRefresh,\n supportedKeyAttributes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Get device configuration to check for custom scene labels\n const deviceConfig = ctx.getDeviceConfig?.(this.nodeId as number);\n // Create/extend metadata for all scenes\n for (let i = 1; i <= this.sceneCount; i++) {\n const sceneValue = CentralSceneCCValues.scene(i);\n const sceneMetadata = { ...sceneValue.meta };\n // Check if there's a custom configuration for this scene\n const sceneConfig = deviceConfig?.scenes?.get(i);\n if (sceneConfig) {\n // @ts-expect-error The label type is a literal\n sceneMetadata.label = sceneConfig.label;\n }\n if (sceneConfig?.description) {\n // @ts-expect-error The predefined metadata has no description\n sceneMetadata.description = sceneConfig.description;\n }\n this.setMetadata(ctx, sceneValue, {\n ...sceneMetadata,\n states: enumValuesToMetadataStates(CentralSceneKeys, this._supportedKeyAttributes.get(i)),\n });\n }\n return true;\n }\n public readonly sceneCount: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const masks: Bytes[] = [];\n for (let i = 1; i <= this.sceneCount; i++) {\n masks.push(encodeBitMask(this.supportedKeyAttributes.get(i) ?? [], 7, CentralSceneKeys.KeyPressed));\n }\n const bitMaskBytes = masks[0]?.length ?? 1;\n let byte1 = bitMaskBytes << 1;\n if (this.supportsSlowRefresh) {\n byte1 |= 0x80;\n }\n this.payload = Bytes.concat([[this.sceneCount, byte1], ...masks]);\n return super.serialize(ctx);\n }\n // TODO: Only offer `slowRefresh` if this is true\n public readonly supportsSlowRefresh: MaybeNotKnown<boolean>;\n private _supportedKeyAttributes = new Map<number, readonly CentralSceneKeys[]>();\n public get supportedKeyAttributes(): ReadonlyMap<number, readonly CentralSceneKeys[]> {\n return this._supportedKeyAttributes;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"scene count\": this.sceneCount,\n \"supports slow refresh\": maybeUnknownToString(this.supportsSlowRefresh),\n };\n for (const [scene, keys] of this.supportedKeyAttributes) {\n message[`supported attributes (scene #${scene})`] = logList(keys.map((k) => getEnumMemberName(CentralSceneKeys, k)));\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(CentralSceneCommand.SupportedGet)\n@expectedCCResponse(CentralSceneCCSupportedReport)\nexport class CentralSceneCCSupportedGet extends CentralSceneCC {\n}\n// @publicAPI\nexport interface CentralSceneCCConfigurationReportOptions {\n slowRefresh: boolean;\n}\n@CCCommand(CentralSceneCommand.ConfigurationReport)\n@ccValueProperty(\"slowRefresh\", CentralSceneCCValues.slowRefresh)\nexport class CentralSceneCCConfigurationReport extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCConfigurationReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCConfigurationReport {\n validatePayload(raw.payload.length >= 1);\n const slowRefresh = !!(raw.payload[0] & 128);\n return new this({\n nodeId: ctx.sourceNodeId,\n slowRefresh,\n });\n }\n public readonly slowRefresh: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.slowRefresh ? 0x80 : 0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"slow refresh\": this.slowRefresh },\n };\n }\n}\n@CCCommand(CentralSceneCommand.ConfigurationGet)\n@expectedCCResponse(CentralSceneCCConfigurationReport)\nexport class CentralSceneCCConfigurationGet extends CentralSceneCC {\n}\n// @publicAPI\nexport interface CentralSceneCCConfigurationSetOptions {\n slowRefresh: boolean;\n}\n@CCCommand(CentralSceneCommand.ConfigurationSet)\n@useSupervision()\nexport class CentralSceneCCConfigurationSet extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCConfigurationSetOptions>) {\n super(options);\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCConfigurationSet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n slowRefresh: !!(raw.payload[0] & 0x80),\n });\n }\n public slowRefresh: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.slowRefresh ? 128 : 0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"slow refresh\": this.slowRefresh },\n };\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./CentralSceneCC._validateArgs.js\";\nconst { validateArgs_CentralSceneCCAPI_setConfiguration } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, enumValuesToMetadataStates, encodeBitMask, getCCName, logDict, logList, logText, maybeUnknownToString, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { CentralSceneCommand, CentralSceneKeys } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { CentralSceneCCValues } from \"./_CCValues.generated.js\";\nexport { CentralSceneCCValues };\n/**\n * Updates the label and description of all stored scene metadata from the device config file.\n */\nexport function refreshSceneMetadataFromConfigFile(ctx: GetValueDB & GetDeviceConfig, nodeId: number, endpointIndex: number): void {\n const deviceConfig = ctx.getDeviceConfig?.(nodeId);\n const valueDB = ctx.getValueDB(nodeId);\n for (const { metadata, ...valueId } of valueDB.getAllMetadata(CommandClasses[\"Central Scene\"])) {\n if ((valueId.endpoint ?? 0) !== endpointIndex\n || !CentralSceneCCValues.scene.is(valueId)) {\n continue;\n }\n const sceneNumber = parseInt(valueId.propertyKey as string, 10);\n const sceneConfig = deviceConfig?.scenes?.get(sceneNumber);\n const label = sceneConfig?.label\n ?? CentralSceneCCValues.scene(sceneNumber).meta.label;\n const description = sceneConfig?.description;\n if (metadata.label === label && metadata.description === description) {\n continue;\n }\n const newMetadata = { ...metadata, label };\n if (description != undefined) {\n newMetadata.description = description;\n }\n else {\n delete newMetadata.description;\n }\n valueDB.setMetadata(valueId, newMetadata);\n }\n}\n@API(CommandClasses[\"Central Scene\"])\nexport class CentralSceneCCAPI extends CCAPI {\n public supportsCommand(cmd: CentralSceneCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case CentralSceneCommand.SupportedGet:\n return this.isSinglecast(); // this is mandatory\n case CentralSceneCommand.ConfigurationGet:\n return this.version >= 3 && this.isSinglecast();\n case CentralSceneCommand.ConfigurationSet:\n return this.version >= 3;\n }\n return super.supportsCommand(cmd);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.SupportedGet);\n const cc = new CentralSceneCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<CentralSceneCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"sceneCount\",\n \"supportsSlowRefresh\",\n \"supportedKeyAttributes\",\n ]);\n }\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getConfiguration() {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.ConfigurationGet);\n const cc = new CentralSceneCCConfigurationGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<CentralSceneCCConfigurationReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"slowRefresh\"]);\n }\n }\n @validateArgs_CentralSceneCCAPI_setConfiguration()\n public async setConfiguration(slowRefresh: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(CentralSceneCommand, CentralSceneCommand.ConfigurationSet);\n const cc = new CentralSceneCCConfigurationSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n slowRefresh,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: CentralSceneCCAPI, { property }, value) {\n if (property !== \"slowRefresh\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n return this.setConfiguration(value);\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: CentralSceneCCAPI, { property }) {\n if (property === \"slowRefresh\") {\n return (await this.getConfiguration())?.[property];\n }\n throwUnsupportedProperty(this.ccId, property);\n };\n }\n}\n@commandClass(CommandClasses[\"Central Scene\"])\n@implementedVersion(3)\n@ccValues(CentralSceneCCValues)\nexport class CentralSceneCC extends CommandClass {\n declare ccCommand: CentralSceneCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n CommandClasses[\"Association Group Information\"],\n ];\n }\n public skipEndpointInterview(): boolean {\n // Central scene notifications are issued by the root device\n return true;\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Central Scene\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // If one Association group issues CentralScene notifications,\n // we must associate ourselves with that channel\n try {\n await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, CentralSceneCommand.Notification);\n }\n catch {\n ctx.logNode(node.id, {\n endpoint: endpoint.index,\n message: `Configuring associations to receive ${getCCName(this.ccId)} commands failed!`,\n level: \"warn\",\n });\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported scenes...\",\n direction: \"outbound\",\n });\n const ccSupported = await api.getSupported();\n if (ccSupported) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logText(\"received supported scenes:\", {\n nested: logDict({\n \"# of scenes\": ccSupported.sceneCount,\n \"supports slow refresh\": ccSupported.supportsSlowRefresh,\n }),\n }),\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported scenes timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n // The slow refresh capability should be enabled whenever possible\n if (api.version >= 3 && ccSupported?.supportsSlowRefresh) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Enabling slow refresh capability...\",\n direction: \"outbound\",\n });\n await api.setConfiguration(true);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n}\n// @publicAPI\nexport interface CentralSceneCCNotificationOptions {\n sequenceNumber: number;\n keyAttribute: CentralSceneKeys;\n sceneNumber: number;\n slowRefresh?: boolean;\n}\n@CCCommand(CentralSceneCommand.Notification)\nexport class CentralSceneCCNotification extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCNotificationOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sequenceNumber = options.sequenceNumber;\n this.keyAttribute = options.keyAttribute;\n this.sceneNumber = options.sceneNumber;\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCNotification {\n validatePayload(raw.payload.length >= 3);\n const sequenceNumber = raw.payload[0];\n const keyAttribute: CentralSceneKeys = raw.payload[1] & 0b111;\n const sceneNumber = raw.payload[2];\n let slowRefresh: boolean | undefined;\n if (keyAttribute === CentralSceneKeys.KeyHeldDown) {\n // A receiving node MUST ignore this field if the command is not\n // carrying the Key Held Down key attribute.\n slowRefresh = !!(raw.payload[1] & 128);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sequenceNumber,\n keyAttribute,\n sceneNumber,\n slowRefresh,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // In case the interview is not yet completed, we still create some basic metadata\n const sceneValue = CentralSceneCCValues.scene(this.sceneNumber);\n // Get device configuration to check for custom scene labels\n const sceneConfig = ctx\n .getDeviceConfig?.(this.nodeId as number)\n ?.scenes?.get(this.sceneNumber);\n if (sceneConfig) {\n // Ensure metadata with custom label and description\n this.ensureMetadata(ctx, sceneValue, {\n ...sceneValue.meta,\n label: sceneConfig.label,\n description: sceneConfig.description,\n });\n }\n else {\n // Use default metadata\n this.ensureMetadata(ctx, sceneValue);\n }\n // The spec behavior is pretty complicated, so we cannot just store\n // the value and call it a day. Handling of these notifications will\n // happen in the receiving node class\n return true;\n }\n public readonly sequenceNumber: number;\n public readonly keyAttribute: CentralSceneKeys;\n public readonly sceneNumber: number;\n public readonly slowRefresh: boolean | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n let keyAttributeByte = this.keyAttribute & 0b111;\n if (this.slowRefresh)\n keyAttributeByte |= 0x80;\n this.payload = Bytes.from([\n this.sequenceNumber,\n keyAttributeByte,\n this.sceneNumber,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"sequence number\": this.sequenceNumber,\n \"key attribute\": getEnumMemberName(CentralSceneKeys, this.keyAttribute),\n \"scene number\": this.sceneNumber,\n };\n if (this.slowRefresh != undefined) {\n message[\"slow refresh\"] = this.slowRefresh;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface CentralSceneCCSupportedReportOptions {\n sceneCount: number;\n supportsSlowRefresh: MaybeNotKnown<boolean>;\n supportedKeyAttributes: Record<number, readonly CentralSceneKeys[]>;\n}\n@CCCommand(CentralSceneCommand.SupportedReport)\n@ccValueProperty(\"sceneCount\", CentralSceneCCValues.sceneCount)\n@ccValueProperty(\"supportsSlowRefresh\", CentralSceneCCValues.supportsSlowRefresh)\n@ccValueProperty(\"supportedKeyAttributes\", CentralSceneCCValues.supportedKeyAttributes)\nexport class CentralSceneCCSupportedReport extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.sceneCount = options.sceneCount;\n this.supportsSlowRefresh = options.supportsSlowRefresh;\n for (const [scene, keys] of Object.entries(options.supportedKeyAttributes)) {\n this._supportedKeyAttributes.set(parseInt(scene), keys);\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCSupportedReport {\n validatePayload(raw.payload.length >= 2);\n const sceneCount = raw.payload[0];\n const supportsSlowRefresh: MaybeNotKnown<boolean> = !!(raw.payload[1] & 128);\n const bitMaskBytes = (raw.payload[1] & 0b110) >>> 1;\n const identicalKeyAttributes = !!(raw.payload[1] & 0b1);\n const numEntries = identicalKeyAttributes ? 1 : sceneCount;\n validatePayload(raw.payload.length >= 2 + bitMaskBytes * numEntries);\n const supportedKeyAttributes: Record<number, readonly CentralSceneKeys[]> = {};\n for (let i = 0; i < numEntries; i++) {\n const mask = raw.payload.subarray(2 + i * bitMaskBytes, 2 + (i + 1) * bitMaskBytes);\n supportedKeyAttributes[i + 1] = parseBitMask(mask, CentralSceneKeys.KeyPressed);\n }\n if (identicalKeyAttributes) {\n // The key attributes are only transmitted for scene 1, copy them to the others\n for (let i = 2; i <= sceneCount; i++) {\n supportedKeyAttributes[i] = supportedKeyAttributes[1];\n }\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n sceneCount,\n supportsSlowRefresh,\n supportedKeyAttributes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Get device configuration to check for custom scene labels\n const deviceConfig = ctx.getDeviceConfig?.(this.nodeId as number);\n // Create/extend metadata for all scenes\n for (let i = 1; i <= this.sceneCount; i++) {\n const sceneValue = CentralSceneCCValues.scene(i);\n const sceneMetadata = { ...sceneValue.meta };\n // Check if there's a custom configuration for this scene\n const sceneConfig = deviceConfig?.scenes?.get(i);\n if (sceneConfig) {\n // @ts-expect-error The label type is a literal\n sceneMetadata.label = sceneConfig.label;\n }\n if (sceneConfig?.description) {\n // @ts-expect-error The predefined metadata has no description\n sceneMetadata.description = sceneConfig.description;\n }\n this.setMetadata(ctx, sceneValue, {\n ...sceneMetadata,\n states: enumValuesToMetadataStates(CentralSceneKeys, this._supportedKeyAttributes.get(i)),\n });\n }\n return true;\n }\n public readonly sceneCount: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const masks: Bytes[] = [];\n for (let i = 1; i <= this.sceneCount; i++) {\n masks.push(encodeBitMask(this.supportedKeyAttributes.get(i) ?? [], 7, CentralSceneKeys.KeyPressed));\n }\n const bitMaskBytes = masks[0]?.length ?? 1;\n let byte1 = bitMaskBytes << 1;\n if (this.supportsSlowRefresh) {\n byte1 |= 0x80;\n }\n this.payload = Bytes.concat([[this.sceneCount, byte1], ...masks]);\n return super.serialize(ctx);\n }\n // TODO: Only offer `slowRefresh` if this is true\n public readonly supportsSlowRefresh: MaybeNotKnown<boolean>;\n private _supportedKeyAttributes = new Map<number, readonly CentralSceneKeys[]>();\n public get supportedKeyAttributes(): ReadonlyMap<number, readonly CentralSceneKeys[]> {\n return this._supportedKeyAttributes;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"scene count\": this.sceneCount,\n \"supports slow refresh\": maybeUnknownToString(this.supportsSlowRefresh),\n };\n for (const [scene, keys] of this.supportedKeyAttributes) {\n message[`supported attributes (scene #${scene})`] = logList(keys.map((k) => getEnumMemberName(CentralSceneKeys, k)));\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(CentralSceneCommand.SupportedGet)\n@expectedCCResponse(CentralSceneCCSupportedReport)\nexport class CentralSceneCCSupportedGet extends CentralSceneCC {\n}\n// @publicAPI\nexport interface CentralSceneCCConfigurationReportOptions {\n slowRefresh: boolean;\n}\n@CCCommand(CentralSceneCommand.ConfigurationReport)\n@ccValueProperty(\"slowRefresh\", CentralSceneCCValues.slowRefresh)\nexport class CentralSceneCCConfigurationReport extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCConfigurationReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCConfigurationReport {\n validatePayload(raw.payload.length >= 1);\n const slowRefresh = !!(raw.payload[0] & 128);\n return new this({\n nodeId: ctx.sourceNodeId,\n slowRefresh,\n });\n }\n public readonly slowRefresh: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.slowRefresh ? 0x80 : 0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"slow refresh\": this.slowRefresh },\n };\n }\n}\n@CCCommand(CentralSceneCommand.ConfigurationGet)\n@expectedCCResponse(CentralSceneCCConfigurationReport)\nexport class CentralSceneCCConfigurationGet extends CentralSceneCC {\n}\n// @publicAPI\nexport interface CentralSceneCCConfigurationSetOptions {\n slowRefresh: boolean;\n}\n@CCCommand(CentralSceneCommand.ConfigurationSet)\n@useSupervision()\nexport class CentralSceneCCConfigurationSet extends CentralSceneCC {\n public constructor(options: WithAddress<CentralSceneCCConfigurationSetOptions>) {\n super(options);\n this.slowRefresh = options.slowRefresh;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): CentralSceneCCConfigurationSet {\n validatePayload(raw.payload.length >= 1);\n return new this({\n nodeId: ctx.sourceNodeId,\n slowRefresh: !!(raw.payload[0] & 0x80),\n });\n }\n public slowRefresh: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.slowRefresh ? 128 : 0]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"slow refresh\": this.slowRefresh },\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAAmU;AACnU,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAA4F;AAC5F,oCAAiI;AAEjI,mBAAsD;AAEtD,cAAyB;AACzB,gCAAqC;AAXrC,MAAM,EAAE,gDAA+C,IAAK;AAgBtD,SAAU,mCAAmC,KAAmC,QAAgB,eAAqB;AACvH,QAAM,eAAe,IAAI,kBAAkB,MAAM;AACjD,QAAM,UAAU,IAAI,WAAW,MAAM;AACrC,aAAW,EAAE,UAAU,GAAG,QAAO,KAAM,QAAQ,eAAe,2BAAe,eAAe,CAAC,GAAG;AAC5F,SAAK,QAAQ,YAAY,OAAO,iBACzB,CAAC,+CAAqB,MAAM,GAAG,OAAO,GAAG;AAC5C;IACJ;AACA,UAAM,cAAc,SAAS,QAAQ,aAAuB,EAAE;AAC9D,UAAM,cAAc,cAAc,QAAQ,IAAI,WAAW;AACzD,UAAM,QAAQ,aAAa,SACpB,+CAAqB,MAAM,WAAW,EAAE,KAAK;AACpD,UAAM,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Q,UAAU,CAAC;AACvC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ,aAAa,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI;OACpC;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,cAAc,MAAM,CAAC,CAAC;AACtD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,gBAAgB,KAAK,YAAW;;IAEnD;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -695,9 +695,8 @@ let ColorSwitchCCSet = (() => {
|
|
|
695
695
|
const component = raw.payload[offset];
|
|
696
696
|
const value = raw.payload[offset + 1];
|
|
697
697
|
const key = colorComponentToTableKey(component);
|
|
698
|
-
if (key)
|
|
699
|
-
|
|
700
|
-
}
|
|
698
|
+
if (key)
|
|
699
|
+
colorTable[key] = value;
|
|
701
700
|
offset += 2;
|
|
702
701
|
}
|
|
703
702
|
let duration;
|