@zwave-js/cc 15.9.0 → 15.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/BatteryCC.d.ts +4 -35
- package/build/cjs/cc/BatteryCC.js +14 -22
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.d.ts +38 -30
- package/build/cjs/cc/IndicatorCC.js +116 -33
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSwitchCC.js +19 -3
- package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.d.ts +58 -98
- package/build/cjs/cc/_CCValues.generated.js +38 -56
- package/build/cjs/cc/_CCValues.generated.js.map +2 -2
- package/build/cjs/lib/API.d.ts +1 -1
- package/build/cjs/lib/API.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts +4 -35
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +22 -23
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts +38 -30
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +132 -39
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +21 -8
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts +58 -98
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.js +40 -60
- package/build/esm/cc/_CCValues.generated.js.map +1 -1
- package/build/esm/lib/API.d.ts +1 -1
- package/build/esm/lib/API.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/MultilevelSwitchCC.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\tDuration,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MaybeUnknown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\tNOT_KNOWN,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tmaybeUnknownToString,\n\tparseMaybeNumber,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\tSET_VALUE_HOOKS,\n\ttype SetValueImplementation,\n\ttype SetValueImplementationHooksFactory,\n\tthrowUnsupportedProperty,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\tmultilevelSwitchTypeProperties,\n\tmultilevelSwitchTypeToActions,\n} from \"../lib/CCValueUtils.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\tLevelChangeDirection,\n\tMultilevelSwitchCommand,\n\tSwitchType,\n} from \"../lib/_Types.js\";\n\nexport const MultilevelSwitchCCValues = V.defineCCValues(\n\tCommandClasses[\"Multilevel Switch\"],\n\t{\n\t\t...V.staticProperty(\n\t\t\t\"currentValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyLevel,\n\t\t\t\tlabel: \"Current value\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"targetValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Level,\n\t\t\t\tlabel: \"Target value\",\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"duration\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyDuration,\n\t\t\t\tlabel: \"Remaining duration\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"restorePrevious\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\t\tlabel: \"Restore previous value\",\n\t\t\t\tstates: {\n\t\t\t\t\ttrue: \"Restore\",\n\t\t\t\t},\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"compatEvent\",\n\t\t\t\"event\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tlabel: \"Event value\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tstateful: false,\n\t\t\t\tautoCreate: (applHost, endpoint) =>\n\t\t\t\t\t!!applHost.getDeviceConfig?.(endpoint.nodeId)?.compat\n\t\t\t\t\t\t?.treatMultilevelSwitchSetAsEvent,\n\t\t\t},\n\t\t),\n\t\t...V.staticProperty(\"switchType\", undefined, { internal: true }),\n\t\t...V.staticProperty(\"superviseStartStopLevelChange\", undefined, {\n\t\t\tinternal: true,\n\t\t\tsupportsEndpoints: false,\n\t\t}),\n\t\t...V.dynamicPropertyWithName(\n\t\t\t\"levelChangeUp\",\n\t\t\t// This is called \"up\" here, but the actual property name will depend on\n\t\t\t// the given switch type\n\t\t\t(switchType: SwitchType) => {\n\t\t\t\tconst switchTypeName = getEnumMemberName(\n\t\t\t\t\tSwitchType,\n\t\t\t\t\tswitchType,\n\t\t\t\t);\n\t\t\t\tconst [, up] = multilevelSwitchTypeToActions(switchTypeName);\n\t\t\t\treturn up;\n\t\t\t},\n\t\t\t({ property }) =>\n\t\t\t\ttypeof property === \"string\"\n\t\t\t\t&& multilevelSwitchTypeProperties.indexOf(property) % 2 === 1,\n\t\t\t(switchType: SwitchType) => {\n\t\t\t\tconst switchTypeName = getEnumMemberName(\n\t\t\t\t\tSwitchType,\n\t\t\t\t\tswitchType,\n\t\t\t\t);\n\t\t\t\tconst [, up] = multilevelSwitchTypeToActions(switchTypeName);\n\t\t\t\treturn {\n\t\t\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\t\t\tlabel: `Perform a level change (${up})`,\n\t\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t\t\tstates: {\n\t\t\t\t\t\ttrue: \"Start\",\n\t\t\t\t\t\tfalse: \"Stop\",\n\t\t\t\t\t},\n\t\t\t\t\tccSpecific: { switchType },\n\t\t\t\t} as const;\n\t\t\t},\n\t\t),\n\t\t...V.dynamicPropertyWithName(\n\t\t\t\"levelChangeDown\",\n\t\t\t// This is called \"down\" here, but the actual property name will depend on\n\t\t\t// the given switch type\n\t\t\t(switchType: SwitchType) => {\n\t\t\t\tconst switchTypeName = getEnumMemberName(\n\t\t\t\t\tSwitchType,\n\t\t\t\t\tswitchType,\n\t\t\t\t);\n\t\t\t\tconst [down] = multilevelSwitchTypeToActions(switchTypeName);\n\t\t\t\treturn down;\n\t\t\t},\n\t\t\t({ property }) =>\n\t\t\t\ttypeof property === \"string\"\n\t\t\t\t&& multilevelSwitchTypeProperties.indexOf(property) % 2 === 0,\n\t\t\t(switchType: SwitchType) => {\n\t\t\t\tconst switchTypeName = getEnumMemberName(\n\t\t\t\t\tSwitchType,\n\t\t\t\t\tswitchType,\n\t\t\t\t);\n\t\t\t\tconst [down] = multilevelSwitchTypeToActions(switchTypeName);\n\t\t\t\treturn {\n\t\t\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\t\t\tlabel: `Perform a level change (${down})`,\n\t\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t\t\tstates: {\n\t\t\t\t\t\ttrue: \"Start\",\n\t\t\t\t\t\tfalse: \"Stop\",\n\t\t\t\t\t},\n\t\t\t\t\tccSpecific: { switchType },\n\t\t\t\t} as const;\n\t\t\t},\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Multilevel Switch\"])\nexport class MultilevelSwitchCCAPI extends CCAPI {\n\tpublic supportsCommand(\n\t\tcmd: MultilevelSwitchCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase MultilevelSwitchCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase MultilevelSwitchCommand.Set:\n\t\t\tcase MultilevelSwitchCommand.StartLevelChange:\n\t\t\tcase MultilevelSwitchCommand.StopLevelChange:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase MultilevelSwitchCommand.SupportedGet:\n\t\t\t\treturn this.version >= 3 && this.isSinglecast();\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.Get,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultilevelSwitchCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"currentValue\", \"targetValue\", \"duration\"]);\n\t\t}\n\t}\n\n\t/**\n\t * Sets the switch to a new value\n\t * @param targetValue The new target value for the switch\n\t * @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `\"1m17s\"`. Only supported in V2 and above.\n\t * @returns A promise indicating whether the command was completed\n\t */\n\t@validateArgs()\n\tpublic async set(\n\t\ttargetValue: number,\n\t\tduration?: Duration | string,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.Set,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\tpublic async startLevelChange(\n\t\toptions: MultilevelSwitchCCStartLevelChangeOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.StartLevelChange,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCStartLevelChange({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tpublic async stopLevelChange(): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.StopLevelChange,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCStopLevelChange({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tpublic async getSupported(): Promise<MaybeNotKnown<SwitchType>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.SupportedGet,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCSupportedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultilevelSwitchCCSupportedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.switchType;\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: MultilevelSwitchCCAPI,\n\t\t\t{ property },\n\t\t\tvalue,\n\t\t\toptions,\n\t\t) {\n\t\t\t// Enable restoring the previous non-zero value\n\t\t\tif (property === \"restorePrevious\") {\n\t\t\t\tproperty = \"targetValue\";\n\t\t\t\tvalue = 255;\n\t\t\t}\n\n\t\t\tif (property === \"targetValue\") {\n\t\t\t\tif (typeof value !== \"number\") {\n\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\ttypeof value,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\t\treturn this.set(value, duration);\n\t\t\t} else if (\n\t\t\t\tmultilevelSwitchTypeProperties.includes(property as string)\n\t\t\t) {\n\t\t\t\t// Since the switch only supports one of the switch types, we would\n\t\t\t\t// need to check if the correct one is used. But since the names are\n\t\t\t\t// purely cosmetic, we just accept all of them\n\t\t\t\tif (typeof value !== \"boolean\") {\n\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\ttypeof value,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (value) {\n\t\t\t\t\t// The property names are organized so that positive motions are\n\t\t\t\t\t// at odd indices and negative motions at even indices\n\t\t\t\t\tconst direction = multilevelSwitchTypeProperties.indexOf(\n\t\t\t\t\t\t\t\t\tproperty as string,\n\t\t\t\t\t\t\t\t) % 2\n\t\t\t\t\t\t\t=== 0\n\t\t\t\t\t\t? \"down\"\n\t\t\t\t\t\t: \"up\";\n\t\t\t\t\t// Singlecast only: Try to retrieve the current value to use as the start level,\n\t\t\t\t\t// even if the target node is going to ignore it. There might\n\t\t\t\t\t// be some bugged devices that ignore the ignore start level flag.\n\t\t\t\t\tconst startLevel = this.tryGetValueDB()?.getValue<\n\t\t\t\t\t\tMaybeUnknown<number>\n\t\t\t\t\t>(\n\t\t\t\t\t\tMultilevelSwitchCCValues.currentValue.endpoint(\n\t\t\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\t// And perform the level change\n\t\t\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\t\t\treturn this.startLevelChange({\n\t\t\t\t\t\tdirection,\n\t\t\t\t\t\tignoreStartLevel: true,\n\t\t\t\t\t\tstartLevel: typeof startLevel === \"number\"\n\t\t\t\t\t\t\t? startLevel\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tduration,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn this.stopLevelChange();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = (\n\t\t{ property },\n\t\tvalue,\n\t\toptions,\n\t) => {\n\t\t// Enable restoring the previous non-zero value\n\t\tif (property === \"restorePrevious\") {\n\t\t\tproperty = \"targetValue\";\n\t\t\tvalue = 255;\n\t\t}\n\n\t\tif (property === \"targetValue\") {\n\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\tconst currentValueValueId = MultilevelSwitchCCValues.currentValue\n\t\t\t\t.endpoint(\n\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t);\n\n\t\t\treturn {\n\t\t\t\t// Multilevel Switch commands may take some time to be executed.\n\t\t\t\t// Therefore we try to supervise the command execution and delay the\n\t\t\t\t// optimistic update until the final result is received.\n\t\t\t\tsupervisionDelayedUpdates: true,\n\t\t\t\tsupervisionOnSuccess: async () => {\n\t\t\t\t\t// Only update currentValue for valid target values\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof value === \"number\"\n\t\t\t\t\t\t&& value >= 0\n\t\t\t\t\t\t&& value <= 99\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.tryGetValueDB()?.setValue(\n\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (value === 255) {\n\t\t\t\t\t\t// We don't know the status now, so refresh the current value\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait this.get();\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tsupervisionOnFailure: async () => {\n\t\t\t\t\t// The transition failed, so now we don't know the status - refresh the current value\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.get();\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// ignore\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\t_supervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\t// Only update currentValue for valid target values\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof value === \"number\"\n\t\t\t\t\t\t&& value >= 0\n\t\t\t\t\t\t&& value <= 99\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\t\tthis.tryGetValueDB()?.setValue(\n\t\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (this.isMulticast()) {\n\t\t\t\t\t\t\t// Figure out which nodes were affected by this command\n\t\t\t\t\t\t\tconst affectedNodes = this.endpoint.node\n\t\t\t\t\t\t\t\t.physicalNodes.filter(\n\t\t\t\t\t\t\t\t\t(node) =>\n\t\t\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t\t\t\t\t\t?.supportsCC(this.ccId),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// and optimistically update the currentValue\n\t\t\t\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\t\t\t\tthis.host\n\t\t\t\t\t\t\t\t\t.tryGetValueDB(node.id)\n\t\t\t\t\t\t\t\t\t?.setValue(currentValueValueId, value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tforceVerifyChanges: () => {\n\t\t\t\t\t// If we don't know the actual value, we need to verify the change, regardless of the supervision result\n\t\t\t\t\treturn value === 255;\n\t\t\t\t},\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.isSinglecast()\n\t\t\t\t\t\t// We generally don't want to poll for multicasts because of how much traffic it can cause\n\t\t\t\t\t\t// However, when setting the value 255 (ON), we don't know the actual state\n\t\t\t\t\t\t|| (this.isMulticast() && value === 255)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We query currentValue instead of targetValue to make sure that unsolicited updates cancel the scheduled poll\n\t\t\t\t\t\t(this as this).schedulePoll(\n\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\tvalue === 255 ? undefined : value,\n\t\t\t\t\t\t\t{ duration },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t};\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: MultilevelSwitchCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"currentValue\":\n\t\t\t\tcase \"targetValue\":\n\t\t\t\tcase \"duration\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Multilevel Switch\"])\n@implementedVersion(4)\n@ccValues(MultilevelSwitchCCValues)\nexport class MultilevelSwitchCC extends CommandClass {\n\tdeclare ccCommand: MultilevelSwitchCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multilevel Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tif (api.version >= 3) {\n\t\t\t// Find out which kind of switch this is\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"requesting switch type...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst switchType = await api.getSupported();\n\t\t\tif (switchType != undefined) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `has switch type ${\n\t\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\t\tSwitchType,\n\t\t\t\t\t\t\tswitchType,\n\t\t\t\t\t\t)\n\t\t\t\t\t}`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// requesting the switch type automatically creates the up/down actions\n\t\t\t// We need to do this manually for V1 and V2\n\t\t\tthis.createMetadataForLevelChangeActions(ctx);\n\t\t}\n\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multilevel Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"requesting current switch state...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tawait api.get();\n\t}\n\n\tpublic setMappedBasicValue(\n\t\tctx: GetValueDB,\n\t\tvalue: number,\n\t): boolean {\n\t\tthis.setValue(ctx, MultilevelSwitchCCValues.currentValue, value);\n\t\treturn true;\n\t}\n\n\tprotected createMetadataForLevelChangeActions(\n\t\tctx: GetValueDB,\n\t\t// SDS13781: The Primary Switch Type SHOULD be 0x02 (Up/Down)\n\t\tswitchType: SwitchType = SwitchType[\"Down/Up\"],\n\t): void {\n\t\tthis.ensureMetadata(\n\t\t\tctx,\n\t\t\tMultilevelSwitchCCValues.levelChangeUp(switchType),\n\t\t);\n\t\tthis.ensureMetadata(\n\t\t\tctx,\n\t\t\tMultilevelSwitchCCValues.levelChangeDown(switchType),\n\t\t);\n\t}\n}\n\n// @publicAPI\nexport interface MultilevelSwitchCCSetOptions {\n\ttargetValue: number;\n\t// Version >= 2:\n\tduration?: Duration | string;\n}\n\n@CCCommand(MultilevelSwitchCommand.Set)\n@useSupervision()\nexport class MultilevelSwitchCCSet extends MultilevelSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultilevelSwitchCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultilevelSwitchCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst targetValue = raw.payload[0];\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 2) {\n\t\t\tduration = Duration.parseReport(raw.payload[1]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic targetValue: number;\n\tpublic duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.targetValue,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, only include the target value\n\t\t\tthis.payload = this.payload.subarray(0, 1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"target value\": this.targetValue,\n\t\t};\n\t\tif (this.duration) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultilevelSwitchCCReportOptions {\n\tcurrentValue?: MaybeUnknown<number>;\n\ttargetValue?: MaybeUnknown<number>;\n\tduration?: Duration | string;\n}\n\n@CCCommand(MultilevelSwitchCommand.Report)\n@ccValueProperty(\"targetValue\", MultilevelSwitchCCValues.targetValue)\n@ccValueProperty(\"duration\", MultilevelSwitchCCValues.duration)\n@ccValueProperty(\"currentValue\", MultilevelSwitchCCValues.currentValue)\nexport class MultilevelSwitchCCReport extends MultilevelSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultilevelSwitchCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.currentValue = options.currentValue;\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultilevelSwitchCCReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst currentValue: MaybeUnknown<number> | undefined =\n\t\t\t// 0xff is a legacy value for 100% (99)\n\t\t\traw.payload[0] === 0xff\n\t\t\t\t? 99\n\t\t\t\t: parseMaybeNumber(raw.payload[0]);\n\t\tlet targetValue: MaybeUnknown<number> | undefined;\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\ttargetValue = parseMaybeNumber(raw.payload[1]);\n\t\t\tduration = Duration.parseReport(raw.payload[2]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcurrentValue,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic targetValue: MaybeUnknown<number> | undefined;\n\n\tpublic duration: Duration | undefined;\n\n\tpublic currentValue: MaybeUnknown<number> | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.currentValue ?? 0xfe,\n\t\t\tthis.targetValue ?? 0xfe,\n\t\t\t(this.duration ?? Duration.default()).serializeReport(),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"current value\": maybeUnknownToString(this.currentValue),\n\t\t};\n\t\tif (this.targetValue !== NOT_KNOWN && this.duration) {\n\t\t\tmessage[\"target value\"] = maybeUnknownToString(this.targetValue);\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(MultilevelSwitchCommand.Get)\n@expectedCCResponse(MultilevelSwitchCCReport)\nexport class MultilevelSwitchCCGet extends MultilevelSwitchCC {}\n\n// @publicAPI\nexport type MultilevelSwitchCCStartLevelChangeOptions =\n\t& {\n\t\tdirection: keyof typeof LevelChangeDirection;\n\t}\n\t& (\n\t\t| {\n\t\t\tignoreStartLevel: true;\n\t\t\tstartLevel?: number;\n\t\t}\n\t\t| {\n\t\t\tignoreStartLevel: false;\n\t\t\tstartLevel: number;\n\t\t}\n\t)\n\t& {\n\t\t// Version >= 2:\n\t\tduration?: Duration | string;\n\t};\n\n@CCCommand(MultilevelSwitchCommand.StartLevelChange)\n@useSupervision()\nexport class MultilevelSwitchCCStartLevelChange extends MultilevelSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultilevelSwitchCCStartLevelChangeOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.duration = Duration.from(options.duration);\n\t\tthis.ignoreStartLevel = options.ignoreStartLevel;\n\t\tthis.startLevel = options.startLevel ?? 0;\n\t\tthis.direction = options.direction;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultilevelSwitchCCStartLevelChange {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst ignoreStartLevel = !!((raw.payload[0] & 0b0_0_1_00000) >>> 5);\n\t\tconst direction = ((raw.payload[0] & 0b0_1_0_00000) >>> 6)\n\t\t\t? \"down\"\n\t\t\t: \"up\";\n\t\tconst startLevel = raw.payload[1];\n\t\tlet duration: Duration | undefined;\n\t\tif (raw.payload.length >= 3) {\n\t\t\tduration = Duration.parseSet(raw.payload[2]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tignoreStartLevel,\n\t\t\tdirection,\n\t\t\tstartLevel,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic duration: Duration | undefined;\n\tpublic startLevel: number;\n\tpublic ignoreStartLevel: boolean;\n\tpublic direction: keyof typeof LevelChangeDirection;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst controlByte = (LevelChangeDirection[this.direction] << 6)\n\t\t\t| (this.ignoreStartLevel ? 0b0010_0000 : 0);\n\t\tthis.payload = Bytes.from([\n\t\t\tcontrolByte,\n\t\t\tthis.startLevel,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, omit the duration byte\n\t\t\tthis.payload = this.payload.subarray(0, -1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\tstartLevel: `${this.startLevel}${\n\t\t\t\tthis.ignoreStartLevel ? \" (ignored)\" : \"\"\n\t\t\t}`,\n\t\t\tdirection: this.direction,\n\t\t};\n\t\tif (this.duration) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(MultilevelSwitchCommand.StopLevelChange)\n@useSupervision()\nexport class MultilevelSwitchCCStopLevelChange extends MultilevelSwitchCC {}\n\n// @publicAPI\nexport interface MultilevelSwitchCCSupportedReportOptions {\n\tswitchType: SwitchType;\n}\n\n@CCCommand(MultilevelSwitchCommand.SupportedReport)\n@ccValueProperty(\"switchType\", MultilevelSwitchCCValues.switchType)\nexport class MultilevelSwitchCCSupportedReport extends MultilevelSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultilevelSwitchCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.switchType = options.switchType;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultilevelSwitchCCSupportedReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst switchType: SwitchType = raw.payload[0] & 0b11111;\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tswitchType,\n\t\t});\n\t}\n\n\t// This is the primary switch type. We're not supporting secondary switch types\n\n\tpublic readonly switchType: SwitchType;\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\t\tthis.createMetadataForLevelChangeActions(ctx, this.switchType);\n\t\treturn true;\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.switchType & 0b11111]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"switch type\": getEnumMemberName(SwitchType, this.switchType),\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(MultilevelSwitchCommand.SupportedGet)\n@expectedCCResponse(MultilevelSwitchCCSupportedReport)\nexport class MultilevelSwitchCCSupportedGet extends MultilevelSwitchCC {}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAgBO;AACP,oBAA+C;AAE/C,iBAUO;AACP,0BAGO;AACP,0BAOO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAIO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8HM,yBAAqB,MAAA;8BADjC,mCAAI,2BAAe,mBAAmB,CAAC,CAAC;;;;oBACE;;;;6CAAA,YAAK;WAAA;;;;;;;;AA8C/C,mBAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EA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G,eAAO;AACtC,WAAK,oCAAoC,KAAK,KAAK,UAAU;AAC7D,aAAO;IACR;IAEO,UAAU,KAAsB;AACtC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,aAAa,EAAO,CAAC;AACrD,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACR,mBAAe,iCAAkB,yBAAY,KAAK,UAAU;;;IAG/D;;;;IAKY,kCAA8B,MAAA;8BAF1C,yCAAU,qCAAwB,YAAY,OAC9C,kDAAmB,iCAAiC,CAAC;;;;oBACF;sDAAA,YAAkB;WAAA;;;;;;;;AAAtE,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
|
|
4
|
+
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\tDuration,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MaybeUnknown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\tNOT_KNOWN,\n\ttype SupervisionResult,\n\tSupervisionStatus,\n\tValueMetadata,\n\ttype WithAddress,\n\tmaybeUnknownToString,\n\tparseMaybeNumber,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\tSET_VALUE_HOOKS,\n\ttype SetValueImplementation,\n\ttype SetValueImplementationHooksFactory,\n\tthrowUnsupportedProperty,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\tmultilevelSwitchTypeProperties,\n\tmultilevelSwitchTypeToActions,\n} from \"../lib/CCValueUtils.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\tLevelChangeDirection,\n\tMultilevelSwitchCommand,\n\tSwitchType,\n} from \"../lib/_Types.js\";\n\nexport const MultilevelSwitchCCValues = V.defineCCValues(\n\tCommandClasses[\"Multilevel Switch\"],\n\t{\n\t\t...V.staticProperty(\n\t\t\t\"currentValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyLevel,\n\t\t\t\tlabel: \"Current value\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"targetValue\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Level,\n\t\t\t\tlabel: \"Target value\",\n\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"duration\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyDuration,\n\t\t\t\tlabel: \"Remaining duration\",\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"restorePrevious\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\t\tlabel: \"Restore previous value\",\n\t\t\t\tstates: {\n\t\t\t\t\ttrue: \"Restore\",\n\t\t\t\t},\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"compatEvent\",\n\t\t\t\"event\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tlabel: \"Event value\",\n\t\t\t} as const,\n\t\t\t{\n\t\t\t\tstateful: false,\n\t\t\t\tautoCreate: (applHost, endpoint) =>\n\t\t\t\t\t!!applHost.getDeviceConfig?.(endpoint.nodeId)?.compat\n\t\t\t\t\t\t?.treatMultilevelSwitchSetAsEvent,\n\t\t\t},\n\t\t),\n\t\t...V.staticProperty(\"switchType\", undefined, { internal: true }),\n\t\t...V.staticProperty(\"superviseStartStopLevelChange\", undefined, {\n\t\t\tinternal: true,\n\t\t\tsupportsEndpoints: false,\n\t\t}),\n\t\t...V.dynamicPropertyWithName(\n\t\t\t\"levelChangeUp\",\n\t\t\t// This is called \"up\" here, but the actual property name will depend on\n\t\t\t// the given switch type\n\t\t\t(switchType: SwitchType) => {\n\t\t\t\tconst switchTypeName = getEnumMemberName(\n\t\t\t\t\tSwitchType,\n\t\t\t\t\tswitchType,\n\t\t\t\t);\n\t\t\t\tconst [, up] = multilevelSwitchTypeToActions(switchTypeName);\n\t\t\t\treturn up;\n\t\t\t},\n\t\t\t({ property }) =>\n\t\t\t\ttypeof property === \"string\"\n\t\t\t\t&& multilevelSwitchTypeProperties.indexOf(property) % 2 === 1,\n\t\t\t(switchType: SwitchType) => {\n\t\t\t\tconst switchTypeName = getEnumMemberName(\n\t\t\t\t\tSwitchType,\n\t\t\t\t\tswitchType,\n\t\t\t\t);\n\t\t\t\tconst [, up] = multilevelSwitchTypeToActions(switchTypeName);\n\t\t\t\treturn {\n\t\t\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\t\t\tlabel: `Perform a level change (${up})`,\n\t\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t\t\tstates: {\n\t\t\t\t\t\ttrue: \"Start\",\n\t\t\t\t\t\tfalse: \"Stop\",\n\t\t\t\t\t},\n\t\t\t\t\tccSpecific: { switchType },\n\t\t\t\t} as const;\n\t\t\t},\n\t\t),\n\t\t...V.dynamicPropertyWithName(\n\t\t\t\"levelChangeDown\",\n\t\t\t// This is called \"down\" here, but the actual property name will depend on\n\t\t\t// the given switch type\n\t\t\t(switchType: SwitchType) => {\n\t\t\t\tconst switchTypeName = getEnumMemberName(\n\t\t\t\t\tSwitchType,\n\t\t\t\t\tswitchType,\n\t\t\t\t);\n\t\t\t\tconst [down] = multilevelSwitchTypeToActions(switchTypeName);\n\t\t\t\treturn down;\n\t\t\t},\n\t\t\t({ property }) =>\n\t\t\t\ttypeof property === \"string\"\n\t\t\t\t&& multilevelSwitchTypeProperties.indexOf(property) % 2 === 0,\n\t\t\t(switchType: SwitchType) => {\n\t\t\t\tconst switchTypeName = getEnumMemberName(\n\t\t\t\t\tSwitchType,\n\t\t\t\t\tswitchType,\n\t\t\t\t);\n\t\t\t\tconst [down] = multilevelSwitchTypeToActions(switchTypeName);\n\t\t\t\treturn {\n\t\t\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\t\t\tlabel: `Perform a level change (${down})`,\n\t\t\t\t\tvalueChangeOptions: [\"transitionDuration\"],\n\t\t\t\t\tstates: {\n\t\t\t\t\t\ttrue: \"Start\",\n\t\t\t\t\t\tfalse: \"Stop\",\n\t\t\t\t\t},\n\t\t\t\t\tccSpecific: { switchType },\n\t\t\t\t} as const;\n\t\t\t},\n\t\t),\n\t},\n);\n\n@API(CommandClasses[\"Multilevel Switch\"])\nexport class MultilevelSwitchCCAPI extends CCAPI {\n\tpublic supportsCommand(\n\t\tcmd: MultilevelSwitchCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase MultilevelSwitchCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase MultilevelSwitchCommand.Set:\n\t\t\tcase MultilevelSwitchCommand.StartLevelChange:\n\t\t\tcase MultilevelSwitchCommand.StopLevelChange:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase MultilevelSwitchCommand.SupportedGet:\n\t\t\t\treturn this.version >= 3 && this.isSinglecast();\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.Get,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultilevelSwitchCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"currentValue\", \"targetValue\", \"duration\"]);\n\t\t}\n\t}\n\n\t/**\n\t * Sets the switch to a new value\n\t * @param targetValue The new target value for the switch\n\t * @param duration The duration after which the target value should be reached. Can be a Duration instance or a user-friendly duration string like `\"1m17s\"`. Only supported in V2 and above.\n\t * @returns A promise indicating whether the command was completed\n\t */\n\t@validateArgs()\n\tpublic async set(\n\t\ttargetValue: number,\n\t\tduration?: Duration | string,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.Set,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\tpublic async startLevelChange(\n\t\toptions: MultilevelSwitchCCStartLevelChangeOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.StartLevelChange,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCStartLevelChange({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tpublic async stopLevelChange(): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.StopLevelChange,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCStopLevelChange({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tpublic async getSupported(): Promise<MaybeNotKnown<SwitchType>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultilevelSwitchCommand,\n\t\t\tMultilevelSwitchCommand.SupportedGet,\n\t\t);\n\n\t\tconst cc = new MultilevelSwitchCCSupportedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultilevelSwitchCCSupportedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.switchType;\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: MultilevelSwitchCCAPI,\n\t\t\t{ property },\n\t\t\tvalue,\n\t\t\toptions,\n\t\t) {\n\t\t\t// Enable restoring the previous non-zero value\n\t\t\tif (property === \"restorePrevious\") {\n\t\t\t\tproperty = \"targetValue\";\n\t\t\t\tvalue = 255;\n\t\t\t}\n\n\t\t\tif (property === \"targetValue\") {\n\t\t\t\tif (typeof value !== \"number\") {\n\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\ttypeof value,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\t\treturn this.set(value, duration);\n\t\t\t} else if (\n\t\t\t\tmultilevelSwitchTypeProperties.includes(property as string)\n\t\t\t) {\n\t\t\t\t// Since the switch only supports one of the switch types, we would\n\t\t\t\t// need to check if the correct one is used. But since the names are\n\t\t\t\t// purely cosmetic, we just accept all of them\n\t\t\t\tif (typeof value !== \"boolean\") {\n\t\t\t\t\tthrowWrongValueType(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\ttypeof value,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (value) {\n\t\t\t\t\t// The property names are organized so that positive motions are\n\t\t\t\t\t// at odd indices and negative motions at even indices\n\t\t\t\t\tconst direction = multilevelSwitchTypeProperties.indexOf(\n\t\t\t\t\t\t\t\t\tproperty as string,\n\t\t\t\t\t\t\t\t) % 2\n\t\t\t\t\t\t\t=== 0\n\t\t\t\t\t\t? \"down\"\n\t\t\t\t\t\t: \"up\";\n\t\t\t\t\t// Singlecast only: Try to retrieve the current value to use as the start level,\n\t\t\t\t\t// even if the target node is going to ignore it. There might\n\t\t\t\t\t// be some bugged devices that ignore the ignore start level flag.\n\t\t\t\t\tconst startLevel = this.tryGetValueDB()?.getValue<\n\t\t\t\t\t\tMaybeUnknown<number>\n\t\t\t\t\t>(\n\t\t\t\t\t\tMultilevelSwitchCCValues.currentValue.endpoint(\n\t\t\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\t// And perform the level change\n\t\t\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\t\t\treturn this.startLevelChange({\n\t\t\t\t\t\tdirection,\n\t\t\t\t\t\tignoreStartLevel: true,\n\t\t\t\t\t\tstartLevel: typeof startLevel === \"number\"\n\t\t\t\t\t\t\t? startLevel\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tduration,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn this.stopLevelChange();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = (\n\t\t{ property },\n\t\tvalue,\n\t\toptions,\n\t) => {\n\t\t// Enable restoring the previous non-zero value\n\t\tif (property === \"restorePrevious\") {\n\t\t\tproperty = \"targetValue\";\n\t\t\tvalue = 255;\n\t\t}\n\n\t\tif (property === \"targetValue\") {\n\t\t\tconst duration = Duration.from(options?.transitionDuration);\n\t\t\tconst currentValueValueId = MultilevelSwitchCCValues.currentValue\n\t\t\t\t.endpoint(\n\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t);\n\n\t\t\treturn {\n\t\t\t\t// Multilevel Switch commands may take some time to be executed.\n\t\t\t\t// Therefore we try to supervise the command execution and delay the\n\t\t\t\t// optimistic update until the final result is received.\n\t\t\t\tsupervisionDelayedUpdates: true,\n\t\t\t\tsupervisionOnSuccess: async () => {\n\t\t\t\t\t// Only update currentValue for valid target values\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof value === \"number\"\n\t\t\t\t\t\t&& value >= 0\n\t\t\t\t\t\t&& value <= 99\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.tryGetValueDB()?.setValue(\n\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (value === 255) {\n\t\t\t\t\t\t// We don't know the status now, so refresh the current value\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait this.get();\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tsupervisionOnFailure: async () => {\n\t\t\t\t\t// The transition failed, so now we don't know the status - refresh the current value\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.get();\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// ignore\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\t_supervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\t// Only update currentValue for valid target values\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof value === \"number\"\n\t\t\t\t\t\t&& value >= 0\n\t\t\t\t\t\t&& value <= 99\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (this.isSinglecast()) {\n\t\t\t\t\t\t\tthis.tryGetValueDB()?.setValue(\n\t\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (this.isMulticast()) {\n\t\t\t\t\t\t\t// Figure out which nodes were affected by this command\n\t\t\t\t\t\t\tconst affectedNodes = this.endpoint.node\n\t\t\t\t\t\t\t\t.physicalNodes.filter(\n\t\t\t\t\t\t\t\t\t(node) =>\n\t\t\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t\t\t\t\t\t?.supportsCC(this.ccId),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// and optimistically update the currentValue\n\t\t\t\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\t\t\t\tthis.host\n\t\t\t\t\t\t\t\t\t.tryGetValueDB(node.id)\n\t\t\t\t\t\t\t\t\t?.setValue(currentValueValueId, value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tforceVerifyChanges: () => {\n\t\t\t\t\t// If we don't know the actual value, we need to verify the change, regardless of the supervision result\n\t\t\t\t\treturn value === 255;\n\t\t\t\t},\n\t\t\t\tverifyChanges: async (result) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t// We generally don't want to poll for multicasts because of how much traffic it can cause\n\t\t\t\t\t\t// However, when setting the value 255 (ON), we don't know the actual state\n\t\t\t\t\t\t!(this.isSinglecast()\n\t\t\t\t\t\t\t|| (this.isMulticast() && value === 255))\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (result?.status) {\n\t\t\t\t\t\tcase SupervisionStatus.Success:\n\t\t\t\t\t\tcase SupervisionStatus.Fail:\n\t\t\t\t\t\t\tawait this.pollValue!(currentValueValueId);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SupervisionStatus.Working:\n\t\t\t\t\t\tdefault: // (not supervised)\n\t\t\t\t\t\t\t(this as this).schedulePoll(\n\t\t\t\t\t\t\t\tcurrentValueValueId,\n\t\t\t\t\t\t\t\tvalue === 255 ? undefined : value,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tduration: result?.remainingDuration\n\t\t\t\t\t\t\t\t\t\t?? duration,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t};\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: MultilevelSwitchCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"currentValue\":\n\t\t\t\tcase \"targetValue\":\n\t\t\t\tcase \"duration\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Multilevel Switch\"])\n@implementedVersion(4)\n@ccValues(MultilevelSwitchCCValues)\nexport class MultilevelSwitchCC extends CommandClass {\n\tdeclare ccCommand: MultilevelSwitchCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multilevel Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tif (api.version >= 3) {\n\t\t\t// Find out which kind of switch this is\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"requesting switch type...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst switchType = await api.getSupported();\n\t\t\tif (switchType != undefined) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `has switch type ${\n\t\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\t\tSwitchType,\n\t\t\t\t\t\t\tswitchType,\n\t\t\t\t\t\t)\n\t\t\t\t\t}`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// requesting the switch type automatically creates the up/down actions\n\t\t\t// We need to do this manually for V1 and V2\n\t\t\tthis.createMetadataForLevelChangeActions(ctx);\n\t\t}\n\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multilevel Switch\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"requesting current switch state...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tawait api.get();\n\t}\n\n\tpublic setMappedBasicValue(\n\t\tctx: GetValueDB,\n\t\tvalue: number,\n\t): boolean {\n\t\tthis.setValue(ctx, MultilevelSwitchCCValues.currentValue, value);\n\t\treturn true;\n\t}\n\n\tprotected createMetadataForLevelChangeActions(\n\t\tctx: GetValueDB,\n\t\t// SDS13781: The Primary Switch Type SHOULD be 0x02 (Up/Down)\n\t\tswitchType: SwitchType = SwitchType[\"Down/Up\"],\n\t): void {\n\t\tthis.ensureMetadata(\n\t\t\tctx,\n\t\t\tMultilevelSwitchCCValues.levelChangeUp(switchType),\n\t\t);\n\t\tthis.ensureMetadata(\n\t\t\tctx,\n\t\t\tMultilevelSwitchCCValues.levelChangeDown(switchType),\n\t\t);\n\t}\n}\n\n// @publicAPI\nexport interface MultilevelSwitchCCSetOptions {\n\ttargetValue: number;\n\t// Version >= 2:\n\tduration?: Duration | string;\n}\n\n@CCCommand(MultilevelSwitchCommand.Set)\n@useSupervision()\nexport class MultilevelSwitchCCSet extends MultilevelSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultilevelSwitchCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultilevelSwitchCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst targetValue = raw.payload[0];\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 2) {\n\t\t\tduration = Duration.parseReport(raw.payload[1]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic targetValue: number;\n\tpublic duration: Duration | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.targetValue,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, only include the target value\n\t\t\tthis.payload = this.payload.subarray(0, 1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"target value\": this.targetValue,\n\t\t};\n\t\tif (this.duration) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultilevelSwitchCCReportOptions {\n\tcurrentValue?: MaybeUnknown<number>;\n\ttargetValue?: MaybeUnknown<number>;\n\tduration?: Duration | string;\n}\n\n@CCCommand(MultilevelSwitchCommand.Report)\n@ccValueProperty(\"targetValue\", MultilevelSwitchCCValues.targetValue)\n@ccValueProperty(\"duration\", MultilevelSwitchCCValues.duration)\n@ccValueProperty(\"currentValue\", MultilevelSwitchCCValues.currentValue)\nexport class MultilevelSwitchCCReport extends MultilevelSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultilevelSwitchCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.currentValue = options.currentValue;\n\t\tthis.targetValue = options.targetValue;\n\t\tthis.duration = Duration.from(options.duration);\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultilevelSwitchCCReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst currentValue: MaybeUnknown<number> | undefined =\n\t\t\t// 0xff is a legacy value for 100% (99)\n\t\t\traw.payload[0] === 0xff\n\t\t\t\t? 99\n\t\t\t\t: parseMaybeNumber(raw.payload[0]);\n\t\tlet targetValue: MaybeUnknown<number> | undefined;\n\t\tlet duration: Duration | undefined;\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\ttargetValue = parseMaybeNumber(raw.payload[1]);\n\t\t\tduration = Duration.parseReport(raw.payload[2]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcurrentValue,\n\t\t\ttargetValue,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic targetValue: MaybeUnknown<number> | undefined;\n\n\tpublic duration: Duration | undefined;\n\n\tpublic currentValue: MaybeUnknown<number> | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.currentValue ?? 0xfe,\n\t\t\tthis.targetValue ?? 0xfe,\n\t\t\t(this.duration ?? Duration.default()).serializeReport(),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"current value\": maybeUnknownToString(this.currentValue),\n\t\t};\n\t\tif (this.targetValue !== NOT_KNOWN && this.duration) {\n\t\t\tmessage[\"target value\"] = maybeUnknownToString(this.targetValue);\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(MultilevelSwitchCommand.Get)\n@expectedCCResponse(MultilevelSwitchCCReport)\nexport class MultilevelSwitchCCGet extends MultilevelSwitchCC {}\n\n// @publicAPI\nexport type MultilevelSwitchCCStartLevelChangeOptions =\n\t& {\n\t\tdirection: keyof typeof LevelChangeDirection;\n\t}\n\t& (\n\t\t| {\n\t\t\tignoreStartLevel: true;\n\t\t\tstartLevel?: number;\n\t\t}\n\t\t| {\n\t\t\tignoreStartLevel: false;\n\t\t\tstartLevel: number;\n\t\t}\n\t)\n\t& {\n\t\t// Version >= 2:\n\t\tduration?: Duration | string;\n\t};\n\n@CCCommand(MultilevelSwitchCommand.StartLevelChange)\n@useSupervision()\nexport class MultilevelSwitchCCStartLevelChange extends MultilevelSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultilevelSwitchCCStartLevelChangeOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.duration = Duration.from(options.duration);\n\t\tthis.ignoreStartLevel = options.ignoreStartLevel;\n\t\tthis.startLevel = options.startLevel ?? 0;\n\t\tthis.direction = options.direction;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultilevelSwitchCCStartLevelChange {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst ignoreStartLevel = !!((raw.payload[0] & 0b0_0_1_00000) >>> 5);\n\t\tconst direction = ((raw.payload[0] & 0b0_1_0_00000) >>> 6)\n\t\t\t? \"down\"\n\t\t\t: \"up\";\n\t\tconst startLevel = raw.payload[1];\n\t\tlet duration: Duration | undefined;\n\t\tif (raw.payload.length >= 3) {\n\t\t\tduration = Duration.parseSet(raw.payload[2]);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tignoreStartLevel,\n\t\t\tdirection,\n\t\t\tstartLevel,\n\t\t\tduration,\n\t\t});\n\t}\n\n\tpublic duration: Duration | undefined;\n\tpublic startLevel: number;\n\tpublic ignoreStartLevel: boolean;\n\tpublic direction: keyof typeof LevelChangeDirection;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst controlByte = (LevelChangeDirection[this.direction] << 6)\n\t\t\t| (this.ignoreStartLevel ? 0b0010_0000 : 0);\n\t\tthis.payload = Bytes.from([\n\t\t\tcontrolByte,\n\t\t\tthis.startLevel,\n\t\t\t(this.duration ?? Duration.default()).serializeSet(),\n\t\t]);\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (\n\t\t\tccVersion < 2 && ctx.getDeviceConfig?.(\n\t\t\t\tthis.nodeId as number,\n\t\t\t)?.compat?.encodeCCsUsingTargetVersion\n\t\t) {\n\t\t\t// When forcing CC version 1, omit the duration byte\n\t\t\tthis.payload = this.payload.subarray(0, -1);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\tstartLevel: `${this.startLevel}${\n\t\t\t\tthis.ignoreStartLevel ? \" (ignored)\" : \"\"\n\t\t\t}`,\n\t\t\tdirection: this.direction,\n\t\t};\n\t\tif (this.duration) {\n\t\t\tmessage.duration = this.duration.toString();\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(MultilevelSwitchCommand.StopLevelChange)\n@useSupervision()\nexport class MultilevelSwitchCCStopLevelChange extends MultilevelSwitchCC {}\n\n// @publicAPI\nexport interface MultilevelSwitchCCSupportedReportOptions {\n\tswitchType: SwitchType;\n}\n\n@CCCommand(MultilevelSwitchCommand.SupportedReport)\n@ccValueProperty(\"switchType\", MultilevelSwitchCCValues.switchType)\nexport class MultilevelSwitchCCSupportedReport extends MultilevelSwitchCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultilevelSwitchCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.switchType = options.switchType;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultilevelSwitchCCSupportedReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst switchType: SwitchType = raw.payload[0] & 0b11111;\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tswitchType,\n\t\t});\n\t}\n\n\t// This is the primary switch type. We're not supporting secondary switch types\n\n\tpublic readonly switchType: SwitchType;\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\t\tthis.createMetadataForLevelChangeActions(ctx, this.switchType);\n\t\treturn true;\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.switchType & 0b11111]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"switch type\": getEnumMemberName(SwitchType, this.switchType),\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(MultilevelSwitchCommand.SupportedGet)\n@expectedCCResponse(MultilevelSwitchCCSupportedReport)\nexport class MultilevelSwitchCCSupportedGet extends MultilevelSwitchCC {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAiBO;AACP,oBAA+C;AAE/C,iBAUO;AACP,0BAGO;AACP,0BAOO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAIO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8HM,yBAAqB,MAAA;8BADjC,mCAAI,2BAAe,mBAAmB,CAAC,CAAC;;;;oBACE;;;;6CAAA,YAAK;WAAA;;;;;;;;AA8C/C,mBAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAmBhB,mBAAA,MAAA,MAAA,8BAAA,EAAA,MAAA,UAAA,MAAA,oBAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,sBAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,kBAAb,OAA6B,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAjE9B,mBAAA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ACrD,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACR,mBAAe,iCAAkB,yBAAY,KAAK,UAAU;;;IAG/D;;;;IAKY,kCAA8B,MAAA;8BAF1C,yCAAU,qCAAwB,YAAY,OAC9C,kDAAmB,iCAAiC,CAAC;;;;oBACF;sDAAA,YAAkB;WAAA;;;;;;;;AAAtE,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -727,32 +727,6 @@ export declare const BatteryCCValues: Readonly<{
|
|
|
727
727
|
readonly autoCreate: true;
|
|
728
728
|
};
|
|
729
729
|
};
|
|
730
|
-
isLow: {
|
|
731
|
-
id: {
|
|
732
|
-
readonly commandClass: CommandClasses.Battery;
|
|
733
|
-
readonly property: "isLow";
|
|
734
|
-
};
|
|
735
|
-
endpoint: (endpoint?: number) => {
|
|
736
|
-
readonly commandClass: CommandClasses.Battery;
|
|
737
|
-
readonly endpoint: number;
|
|
738
|
-
readonly property: "isLow";
|
|
739
|
-
};
|
|
740
|
-
is: (valueId: ValueID) => boolean;
|
|
741
|
-
readonly meta: {
|
|
742
|
-
readonly label: "Low battery level";
|
|
743
|
-
readonly writeable: false;
|
|
744
|
-
readonly type: "boolean";
|
|
745
|
-
readonly readable: true;
|
|
746
|
-
};
|
|
747
|
-
options: {
|
|
748
|
-
readonly internal: false;
|
|
749
|
-
readonly minVersion: 1;
|
|
750
|
-
readonly secret: false;
|
|
751
|
-
readonly stateful: true;
|
|
752
|
-
readonly supportsEndpoints: true;
|
|
753
|
-
readonly autoCreate: true;
|
|
754
|
-
};
|
|
755
|
-
};
|
|
756
730
|
maximumCapacity: {
|
|
757
731
|
id: {
|
|
758
732
|
readonly commandClass: CommandClasses.Battery;
|
|
@@ -2966,78 +2940,84 @@ export declare const IndicatorCCValues: Readonly<{
|
|
|
2966
2940
|
readonly autoCreate: true;
|
|
2967
2941
|
};
|
|
2968
2942
|
};
|
|
2969
|
-
|
|
2943
|
+
supportedPropertyIDs: ((indicatorId: number) => {
|
|
2970
2944
|
id: {
|
|
2971
2945
|
readonly commandClass: CommandClasses.Indicator;
|
|
2972
|
-
readonly property: "
|
|
2946
|
+
readonly property: "supportedPropertyIDs";
|
|
2947
|
+
readonly propertyKey: number;
|
|
2973
2948
|
};
|
|
2974
2949
|
endpoint: (endpoint?: number) => {
|
|
2975
2950
|
readonly commandClass: CommandClasses.Indicator;
|
|
2976
2951
|
readonly endpoint: number;
|
|
2977
|
-
readonly property: "
|
|
2952
|
+
readonly property: "supportedPropertyIDs";
|
|
2953
|
+
readonly propertyKey: number;
|
|
2978
2954
|
};
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
readonly label: "Timeout";
|
|
2982
|
-
readonly type: "string";
|
|
2955
|
+
readonly meta: Readonly<{
|
|
2956
|
+
readonly type: "any";
|
|
2983
2957
|
readonly readable: true;
|
|
2984
2958
|
readonly writeable: true;
|
|
2985
|
-
}
|
|
2959
|
+
}>;
|
|
2960
|
+
}) & {
|
|
2961
|
+
is: (valueId: ValueID) => boolean;
|
|
2986
2962
|
options: {
|
|
2987
|
-
readonly internal:
|
|
2988
|
-
readonly minVersion:
|
|
2963
|
+
readonly internal: true;
|
|
2964
|
+
readonly minVersion: 1;
|
|
2989
2965
|
readonly secret: false;
|
|
2990
2966
|
readonly stateful: true;
|
|
2991
2967
|
readonly supportsEndpoints: true;
|
|
2992
2968
|
readonly autoCreate: true;
|
|
2993
2969
|
};
|
|
2994
2970
|
};
|
|
2995
|
-
|
|
2971
|
+
valueV2: ((indicatorId: number, propertyId: number) => {
|
|
2996
2972
|
id: {
|
|
2997
2973
|
readonly commandClass: CommandClasses.Indicator;
|
|
2998
|
-
readonly property:
|
|
2974
|
+
readonly property: number;
|
|
2999
2975
|
readonly propertyKey: number;
|
|
3000
2976
|
};
|
|
3001
2977
|
endpoint: (endpoint?: number) => {
|
|
3002
2978
|
readonly commandClass: CommandClasses.Indicator;
|
|
3003
2979
|
readonly endpoint: number;
|
|
3004
|
-
readonly property:
|
|
2980
|
+
readonly property: number;
|
|
3005
2981
|
readonly propertyKey: number;
|
|
3006
2982
|
};
|
|
3007
|
-
readonly meta:
|
|
2983
|
+
readonly meta: {
|
|
2984
|
+
readonly ccSpecific: {
|
|
2985
|
+
readonly indicatorId: number;
|
|
2986
|
+
readonly propertyId: number;
|
|
2987
|
+
};
|
|
3008
2988
|
readonly type: "any";
|
|
3009
2989
|
readonly readable: true;
|
|
3010
2990
|
readonly writeable: true;
|
|
3011
|
-
}
|
|
2991
|
+
};
|
|
3012
2992
|
}) & {
|
|
3013
2993
|
is: (valueId: ValueID) => boolean;
|
|
3014
2994
|
options: {
|
|
3015
|
-
readonly internal:
|
|
3016
|
-
readonly minVersion:
|
|
2995
|
+
readonly internal: false;
|
|
2996
|
+
readonly minVersion: 2;
|
|
3017
2997
|
readonly secret: false;
|
|
3018
2998
|
readonly stateful: true;
|
|
3019
2999
|
readonly supportsEndpoints: true;
|
|
3020
3000
|
readonly autoCreate: true;
|
|
3021
3001
|
};
|
|
3022
3002
|
};
|
|
3023
|
-
|
|
3003
|
+
timeout: ((indicatorId: number) => {
|
|
3024
3004
|
id: {
|
|
3025
3005
|
readonly commandClass: CommandClasses.Indicator;
|
|
3026
3006
|
readonly property: number;
|
|
3027
|
-
readonly propertyKey:
|
|
3007
|
+
readonly propertyKey: "timeout";
|
|
3028
3008
|
};
|
|
3029
3009
|
endpoint: (endpoint?: number) => {
|
|
3030
3010
|
readonly commandClass: CommandClasses.Indicator;
|
|
3031
3011
|
readonly endpoint: number;
|
|
3032
3012
|
readonly property: number;
|
|
3033
|
-
readonly propertyKey:
|
|
3013
|
+
readonly propertyKey: "timeout";
|
|
3034
3014
|
};
|
|
3035
3015
|
readonly meta: {
|
|
3016
|
+
readonly label: "Timeout";
|
|
3036
3017
|
readonly ccSpecific: {
|
|
3037
3018
|
readonly indicatorId: number;
|
|
3038
|
-
readonly propertyId: number;
|
|
3039
3019
|
};
|
|
3040
|
-
readonly type: "
|
|
3020
|
+
readonly type: "string";
|
|
3041
3021
|
readonly readable: true;
|
|
3042
3022
|
readonly writeable: true;
|
|
3043
3023
|
};
|
|
@@ -3045,7 +3025,7 @@ export declare const IndicatorCCValues: Readonly<{
|
|
|
3045
3025
|
is: (valueId: ValueID) => boolean;
|
|
3046
3026
|
options: {
|
|
3047
3027
|
readonly internal: false;
|
|
3048
|
-
readonly minVersion:
|
|
3028
|
+
readonly minVersion: 3;
|
|
3049
3029
|
readonly secret: false;
|
|
3050
3030
|
readonly stateful: true;
|
|
3051
3031
|
readonly supportsEndpoints: true;
|
|
@@ -8699,32 +8679,6 @@ export declare const CCValues: {
|
|
|
8699
8679
|
readonly autoCreate: true;
|
|
8700
8680
|
};
|
|
8701
8681
|
};
|
|
8702
|
-
isLow: {
|
|
8703
|
-
id: {
|
|
8704
|
-
readonly commandClass: CommandClasses.Battery;
|
|
8705
|
-
readonly property: "isLow";
|
|
8706
|
-
};
|
|
8707
|
-
endpoint: (endpoint?: number) => {
|
|
8708
|
-
readonly commandClass: CommandClasses.Battery;
|
|
8709
|
-
readonly endpoint: number;
|
|
8710
|
-
readonly property: "isLow";
|
|
8711
|
-
};
|
|
8712
|
-
is: (valueId: ValueID) => boolean;
|
|
8713
|
-
readonly meta: {
|
|
8714
|
-
readonly label: "Low battery level";
|
|
8715
|
-
readonly writeable: false;
|
|
8716
|
-
readonly type: "boolean";
|
|
8717
|
-
readonly readable: true;
|
|
8718
|
-
};
|
|
8719
|
-
options: {
|
|
8720
|
-
readonly internal: false;
|
|
8721
|
-
readonly minVersion: 1;
|
|
8722
|
-
readonly secret: false;
|
|
8723
|
-
readonly stateful: true;
|
|
8724
|
-
readonly supportsEndpoints: true;
|
|
8725
|
-
readonly autoCreate: true;
|
|
8726
|
-
};
|
|
8727
|
-
};
|
|
8728
8682
|
maximumCapacity: {
|
|
8729
8683
|
id: {
|
|
8730
8684
|
readonly commandClass: CommandClasses.Battery;
|
|
@@ -10931,78 +10885,84 @@ export declare const CCValues: {
|
|
|
10931
10885
|
readonly autoCreate: true;
|
|
10932
10886
|
};
|
|
10933
10887
|
};
|
|
10934
|
-
|
|
10888
|
+
supportedPropertyIDs: ((indicatorId: number) => {
|
|
10935
10889
|
id: {
|
|
10936
10890
|
readonly commandClass: CommandClasses.Indicator;
|
|
10937
|
-
readonly property: "
|
|
10891
|
+
readonly property: "supportedPropertyIDs";
|
|
10892
|
+
readonly propertyKey: number;
|
|
10938
10893
|
};
|
|
10939
10894
|
endpoint: (endpoint?: number) => {
|
|
10940
10895
|
readonly commandClass: CommandClasses.Indicator;
|
|
10941
10896
|
readonly endpoint: number;
|
|
10942
|
-
readonly property: "
|
|
10897
|
+
readonly property: "supportedPropertyIDs";
|
|
10898
|
+
readonly propertyKey: number;
|
|
10943
10899
|
};
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
readonly label: "Timeout";
|
|
10947
|
-
readonly type: "string";
|
|
10900
|
+
readonly meta: Readonly<{
|
|
10901
|
+
readonly type: "any";
|
|
10948
10902
|
readonly readable: true;
|
|
10949
10903
|
readonly writeable: true;
|
|
10950
|
-
}
|
|
10904
|
+
}>;
|
|
10905
|
+
}) & {
|
|
10906
|
+
is: (valueId: ValueID) => boolean;
|
|
10951
10907
|
options: {
|
|
10952
|
-
readonly internal:
|
|
10953
|
-
readonly minVersion:
|
|
10908
|
+
readonly internal: true;
|
|
10909
|
+
readonly minVersion: 1;
|
|
10954
10910
|
readonly secret: false;
|
|
10955
10911
|
readonly stateful: true;
|
|
10956
10912
|
readonly supportsEndpoints: true;
|
|
10957
10913
|
readonly autoCreate: true;
|
|
10958
10914
|
};
|
|
10959
10915
|
};
|
|
10960
|
-
|
|
10916
|
+
valueV2: ((indicatorId: number, propertyId: number) => {
|
|
10961
10917
|
id: {
|
|
10962
10918
|
readonly commandClass: CommandClasses.Indicator;
|
|
10963
|
-
readonly property:
|
|
10919
|
+
readonly property: number;
|
|
10964
10920
|
readonly propertyKey: number;
|
|
10965
10921
|
};
|
|
10966
10922
|
endpoint: (endpoint?: number) => {
|
|
10967
10923
|
readonly commandClass: CommandClasses.Indicator;
|
|
10968
10924
|
readonly endpoint: number;
|
|
10969
|
-
readonly property:
|
|
10925
|
+
readonly property: number;
|
|
10970
10926
|
readonly propertyKey: number;
|
|
10971
10927
|
};
|
|
10972
|
-
readonly meta:
|
|
10928
|
+
readonly meta: {
|
|
10929
|
+
readonly ccSpecific: {
|
|
10930
|
+
readonly indicatorId: number;
|
|
10931
|
+
readonly propertyId: number;
|
|
10932
|
+
};
|
|
10973
10933
|
readonly type: "any";
|
|
10974
10934
|
readonly readable: true;
|
|
10975
10935
|
readonly writeable: true;
|
|
10976
|
-
}
|
|
10936
|
+
};
|
|
10977
10937
|
}) & {
|
|
10978
10938
|
is: (valueId: ValueID) => boolean;
|
|
10979
10939
|
options: {
|
|
10980
|
-
readonly internal:
|
|
10981
|
-
readonly minVersion:
|
|
10940
|
+
readonly internal: false;
|
|
10941
|
+
readonly minVersion: 2;
|
|
10982
10942
|
readonly secret: false;
|
|
10983
10943
|
readonly stateful: true;
|
|
10984
10944
|
readonly supportsEndpoints: true;
|
|
10985
10945
|
readonly autoCreate: true;
|
|
10986
10946
|
};
|
|
10987
10947
|
};
|
|
10988
|
-
|
|
10948
|
+
timeout: ((indicatorId: number) => {
|
|
10989
10949
|
id: {
|
|
10990
10950
|
readonly commandClass: CommandClasses.Indicator;
|
|
10991
10951
|
readonly property: number;
|
|
10992
|
-
readonly propertyKey:
|
|
10952
|
+
readonly propertyKey: "timeout";
|
|
10993
10953
|
};
|
|
10994
10954
|
endpoint: (endpoint?: number) => {
|
|
10995
10955
|
readonly commandClass: CommandClasses.Indicator;
|
|
10996
10956
|
readonly endpoint: number;
|
|
10997
10957
|
readonly property: number;
|
|
10998
|
-
readonly propertyKey:
|
|
10958
|
+
readonly propertyKey: "timeout";
|
|
10999
10959
|
};
|
|
11000
10960
|
readonly meta: {
|
|
10961
|
+
readonly label: "Timeout";
|
|
11001
10962
|
readonly ccSpecific: {
|
|
11002
10963
|
readonly indicatorId: number;
|
|
11003
|
-
readonly propertyId: number;
|
|
11004
10964
|
};
|
|
11005
|
-
readonly type: "
|
|
10965
|
+
readonly type: "string";
|
|
11006
10966
|
readonly readable: true;
|
|
11007
10967
|
readonly writeable: true;
|
|
11008
10968
|
};
|
|
@@ -11010,7 +10970,7 @@ export declare const CCValues: {
|
|
|
11010
10970
|
is: (valueId: ValueID) => boolean;
|
|
11011
10971
|
options: {
|
|
11012
10972
|
readonly internal: false;
|
|
11013
|
-
readonly minVersion:
|
|
10973
|
+
readonly minVersion: 3;
|
|
11014
10974
|
readonly secret: false;
|
|
11015
10975
|
readonly stateful: true;
|
|
11016
10976
|
readonly supportsEndpoints: true;
|
|
@@ -856,34 +856,6 @@ const BatteryCCValues = Object.freeze({
|
|
|
856
856
|
autoCreate: true
|
|
857
857
|
}
|
|
858
858
|
},
|
|
859
|
-
isLow: {
|
|
860
|
-
id: {
|
|
861
|
-
commandClass: import_core.CommandClasses.Battery,
|
|
862
|
-
property: "isLow"
|
|
863
|
-
},
|
|
864
|
-
endpoint: /* @__PURE__ */ __name((endpoint = 0) => ({
|
|
865
|
-
commandClass: import_core.CommandClasses.Battery,
|
|
866
|
-
endpoint,
|
|
867
|
-
property: "isLow"
|
|
868
|
-
}), "endpoint"),
|
|
869
|
-
is: /* @__PURE__ */ __name((valueId) => {
|
|
870
|
-
return valueId.commandClass === import_core.CommandClasses.Battery && valueId.property === "isLow" && valueId.propertyKey == void 0;
|
|
871
|
-
}, "is"),
|
|
872
|
-
get meta() {
|
|
873
|
-
return {
|
|
874
|
-
...import_core.ValueMetadata.ReadOnlyBoolean,
|
|
875
|
-
label: "Low battery level"
|
|
876
|
-
};
|
|
877
|
-
},
|
|
878
|
-
options: {
|
|
879
|
-
internal: false,
|
|
880
|
-
minVersion: 1,
|
|
881
|
-
secret: false,
|
|
882
|
-
stateful: true,
|
|
883
|
-
supportsEndpoints: true,
|
|
884
|
-
autoCreate: true
|
|
885
|
-
}
|
|
886
|
-
},
|
|
887
859
|
maximumCapacity: {
|
|
888
860
|
id: {
|
|
889
861
|
commandClass: import_core.CommandClasses.Battery,
|
|
@@ -3245,34 +3217,6 @@ const IndicatorCCValues = Object.freeze({
|
|
|
3245
3217
|
autoCreate: true
|
|
3246
3218
|
}
|
|
3247
3219
|
},
|
|
3248
|
-
timeout: {
|
|
3249
|
-
id: {
|
|
3250
|
-
commandClass: import_core.CommandClasses.Indicator,
|
|
3251
|
-
property: "timeout"
|
|
3252
|
-
},
|
|
3253
|
-
endpoint: /* @__PURE__ */ __name((endpoint = 0) => ({
|
|
3254
|
-
commandClass: import_core.CommandClasses.Indicator,
|
|
3255
|
-
endpoint,
|
|
3256
|
-
property: "timeout"
|
|
3257
|
-
}), "endpoint"),
|
|
3258
|
-
is: /* @__PURE__ */ __name((valueId) => {
|
|
3259
|
-
return valueId.commandClass === import_core.CommandClasses.Indicator && valueId.property === "timeout" && valueId.propertyKey == void 0;
|
|
3260
|
-
}, "is"),
|
|
3261
|
-
get meta() {
|
|
3262
|
-
return {
|
|
3263
|
-
...import_core.ValueMetadata.String,
|
|
3264
|
-
label: "Timeout"
|
|
3265
|
-
};
|
|
3266
|
-
},
|
|
3267
|
-
options: {
|
|
3268
|
-
internal: false,
|
|
3269
|
-
minVersion: 3,
|
|
3270
|
-
secret: false,
|
|
3271
|
-
stateful: true,
|
|
3272
|
-
supportsEndpoints: true,
|
|
3273
|
-
autoCreate: true
|
|
3274
|
-
}
|
|
3275
|
-
},
|
|
3276
3220
|
supportedPropertyIDs: Object.assign((indicatorId) => {
|
|
3277
3221
|
const property = "supportedPropertyIDs";
|
|
3278
3222
|
const propertyKey = indicatorId;
|
|
@@ -3343,6 +3287,44 @@ const IndicatorCCValues = Object.freeze({
|
|
|
3343
3287
|
autoCreate: true
|
|
3344
3288
|
}
|
|
3345
3289
|
}),
|
|
3290
|
+
timeout: Object.assign((indicatorId) => {
|
|
3291
|
+
const property = indicatorId;
|
|
3292
|
+
const propertyKey = "timeout";
|
|
3293
|
+
return {
|
|
3294
|
+
id: {
|
|
3295
|
+
commandClass: import_core.CommandClasses.Indicator,
|
|
3296
|
+
property,
|
|
3297
|
+
propertyKey
|
|
3298
|
+
},
|
|
3299
|
+
endpoint: /* @__PURE__ */ __name((endpoint = 0) => ({
|
|
3300
|
+
commandClass: import_core.CommandClasses.Indicator,
|
|
3301
|
+
endpoint,
|
|
3302
|
+
property,
|
|
3303
|
+
propertyKey
|
|
3304
|
+
}), "endpoint"),
|
|
3305
|
+
get meta() {
|
|
3306
|
+
return {
|
|
3307
|
+
...import_core.ValueMetadata.String,
|
|
3308
|
+
label: "Timeout",
|
|
3309
|
+
ccSpecific: {
|
|
3310
|
+
indicatorId
|
|
3311
|
+
}
|
|
3312
|
+
};
|
|
3313
|
+
}
|
|
3314
|
+
};
|
|
3315
|
+
}, {
|
|
3316
|
+
is: /* @__PURE__ */ __name((valueId) => {
|
|
3317
|
+
return valueId.commandClass === import_core.CommandClasses.Indicator && (({ property, propertyKey }) => typeof property === "number" && propertyKey === "timeout")(valueId);
|
|
3318
|
+
}, "is"),
|
|
3319
|
+
options: {
|
|
3320
|
+
internal: false,
|
|
3321
|
+
minVersion: 3,
|
|
3322
|
+
secret: false,
|
|
3323
|
+
stateful: true,
|
|
3324
|
+
supportsEndpoints: true,
|
|
3325
|
+
autoCreate: true
|
|
3326
|
+
}
|
|
3327
|
+
}),
|
|
3346
3328
|
indicatorDescription: Object.assign((indicatorId) => {
|
|
3347
3329
|
const property = indicatorId;
|
|
3348
3330
|
return {
|