@zwave-js/cc 15.17.0 → 15.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/build/cjs/cc/ConfigurationCC.js +8 -1
  2. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  3. package/build/cjs/cc/EntryControlCC.js +0 -3
  4. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  5. package/build/cjs/cc/SoundSwitchCC._validateArgs.js +1 -1
  6. package/build/cjs/cc/SoundSwitchCC._validateArgs.js.map +1 -1
  7. package/build/cjs/cc/SoundSwitchCC.d.ts +7 -3
  8. package/build/cjs/cc/SoundSwitchCC.js +12 -8
  9. package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
  10. package/build/cjs/cc/UserCodeCC.d.ts +1 -1
  11. package/build/cjs/cc/UserCodeCC.js +78 -33
  12. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  13. package/build/cjs/cc/index.js +546 -66
  14. package/build/cjs/cc/index.js.map +2 -2
  15. package/build/cjs/lib/API.d.ts +2 -2
  16. package/build/cjs/lib/API.js.map +2 -2
  17. package/build/cjs/lib/utils.d.ts +7 -1
  18. package/build/cjs/lib/utils.js +21 -17
  19. package/build/cjs/lib/utils.js.map +2 -2
  20. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  21. package/build/esm/cc/ConfigurationCC.js +10 -1
  22. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  23. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  24. package/build/esm/cc/EntryControlCC.js +1 -3
  25. package/build/esm/cc/EntryControlCC.js.map +1 -1
  26. package/build/esm/cc/SoundSwitchCC._validateArgs.js +1 -1
  27. package/build/esm/cc/SoundSwitchCC._validateArgs.js.map +1 -1
  28. package/build/esm/cc/SoundSwitchCC.d.ts +7 -3
  29. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  30. package/build/esm/cc/SoundSwitchCC.js +12 -8
  31. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  32. package/build/esm/cc/UserCodeCC.d.ts +1 -1
  33. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  34. package/build/esm/cc/UserCodeCC.js +111 -41
  35. package/build/esm/cc/UserCodeCC.js.map +1 -1
  36. package/build/esm/cc/index.d.ts.map +1 -1
  37. package/build/esm/cc/index.js +546 -527
  38. package/build/esm/cc/index.js.map +1 -1
  39. package/build/esm/lib/API.d.ts +2 -2
  40. package/build/esm/lib/API.d.ts.map +1 -1
  41. package/build/esm/lib/API.js.map +1 -1
  42. package/build/esm/lib/utils.d.ts +7 -1
  43. package/build/esm/lib/utils.d.ts.map +1 -1
  44. package/build/esm/lib/utils.js +25 -21
  45. package/build/esm/lib/utils.js.map +1 -1
  46. package/package.json +9 -9
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/API.ts"],
4
- "sourcesContent": ["import type { SendCommand } from \"@zwave-js/cc\";\nimport type { CompatOverrideQueries, GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype Duration,\n\ttype EndpointId,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSafeCCVersion,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype MaybeNotKnown,\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\tNOT_KNOWN,\n\ttype NodeId,\n\ttype PhysicalNodes,\n\ttype QueryNodeStatus,\n\ttype SecurityManagers,\n\ttype SendCommandOptions,\n\ttype SupervisionResult,\n\ttype SupportsCC,\n\ttype TXReport,\n\ttype ValueChangeOptions,\n\ttype ValueDB,\n\ttype ValueID,\n\ttype VirtualEndpointId,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tstripUndefined,\n} from \"@zwave-js/core\";\nimport {\n\ttype AllOrNone,\n\ttype OnlyMethods,\n\tgetEnumMemberName,\n\tgetErrorMessage,\n\tnum2hex,\n} from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport {\n\tgetAPI,\n\tgetCCValues,\n\tgetCommandClass,\n\tgetImplementedVersion,\n} from \"./CommandClassDecorators.js\";\nimport type { CCValue, StaticCCValue } from \"./Values.js\";\nimport type {\n\tGetRefreshValueTimeouts,\n\tGetUserPreferences,\n\tSchedulePoll,\n} from \"./traits.js\";\n\nexport type ValueIDProperties = Pick<ValueID, \"property\" | \"propertyKey\">;\n\n/** Used to identify the method on the CC API class that handles setting values on nodes directly */\nexport const SET_VALUE: unique symbol = Symbol.for(\"CCAPI_SET_VALUE\");\n\nexport type SetValueImplementation = (\n\tproperty: ValueIDProperties,\n\tvalue: unknown,\n\toptions?: SetValueAPIOptions,\n) => Promise<SupervisionResult | undefined>;\n\nexport const SET_VALUE_HOOKS: unique symbol = Symbol.for(\n\t\"CCAPI_SET_VALUE_HOOKS\",\n);\n\nexport type SetValueImplementationHooks =\n\t& AllOrNone<{\n\t\t// Opt-in to and handle delayed supervision updates\n\t\tsupervisionDelayedUpdates: boolean;\n\t\tsupervisionOnSuccess: () => void | Promise<void>;\n\t\tsupervisionOnFailure: () => void | Promise<void>;\n\t}>\n\t& {\n\t\t// Optimistically update related cached values (if allowed)\n\t\toptimisticallyUpdateRelatedValues?: (\n\t\t\tsupervisedAndSuccessful: boolean,\n\t\t) => void;\n\t\t// Check if a verification of the set value is required, even if the API response suggests otherwise\n\t\tforceVerifyChanges?: () => boolean;\n\t\t// Verify the changes\n\t\tverifyChanges?: (result?: SupervisionResult) => void | Promise<void>;\n\t};\n\nexport type SetValueImplementationHooksFactory = (\n\tproperty: ValueIDProperties,\n\tvalue: unknown,\n\toptions?: SetValueAPIOptions,\n) => SetValueImplementationHooks | undefined;\n\n/**\n * A generic options bag for the `setValue` API.\n * Each implementation will choose the options that are relevant for it, so you can use the same options everywhere.\n * @publicAPI\n */\nexport type SetValueAPIOptions =\n\t& Partial<ValueChangeOptions>\n\t& Pick<SendCommandOptions, \"onProgress\">;\n\n/** Used to identify the method on the CC API class that handles polling values from nodes */\nexport const POLL_VALUE: unique symbol = Symbol.for(\"CCAPI_POLL_VALUE\");\nexport type PollValueImplementation<T = unknown> = (\n\tproperty: ValueIDProperties,\n) => Promise<T | undefined>;\n\n// Since the setValue API is called from a point with very generic parameters,\n// we must do narrowing inside the API calls. These three methods are for convenience\nexport function throwUnsupportedProperty(\n\tcc: CommandClasses,\n\tproperty: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${CommandClasses[cc]}: \"${property}\" is not a supported property`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwUnsupportedPropertyKey(\n\tcc: CommandClasses,\n\tproperty: string | number,\n\tpropertyKey: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: \"${propertyKey}\" is not a supported property key for property \"${property}\"`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwMissingPropertyKey(\n\tcc: CommandClasses,\n\tproperty: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: property \"${property}\" requires a property key, but none was given`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwWrongValueType(\n\tcc: CommandClasses,\n\tproperty: string | number,\n\texpectedType: string,\n\treceivedType: string,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: \"${property}\" must be of type \"${expectedType}\", received \"${receivedType}\"`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport interface CCAPISchedulePollOptions {\n\tduration?: Duration;\n\ttransition?: \"fast\" | \"slow\";\n}\n\n// Defines the necessary traits the host passed to a CC API must have\nexport type CCAPIHost<TNode extends CCAPINode = CCAPINode> =\n\t& HostIDs\n\t& GetNode<TNode>\n\t& GetValueDB\n\t& GetSupportedCCVersion\n\t& GetSafeCCVersion\n\t& SecurityManagers\n\t& GetDeviceConfig\n\t& SendCommand\n\t& GetRefreshValueTimeouts\n\t& GetUserPreferences\n\t& SchedulePoll\n\t& LogNode;\n\n// Defines the necessary traits a node passed to a CC API must have\nexport type CCAPINode = NodeId & ListenBehavior & QueryNodeStatus;\n\n// Defines the necessary traits an endpoint passed to a CC API must have\nexport type CCAPIEndpoint =\n\t& (\n\t\t| (\n\t\t\t// Physical endpoints must let us query their controlled CCs\n\t\t\tEndpointId & ControlsCC\n\t\t)\n\t\t| (\n\t\t\t// Virtual endpoints must let us query their physical nodes,\n\t\t\t// the CCs those nodes implement, and access the endpoints of those\n\t\t\t// physical nodes\n\t\t\tVirtualEndpointId & {\n\t\t\t\tnode: PhysicalNodes<\n\t\t\t\t\t& NodeId\n\t\t\t\t\t& SupportsCC\n\t\t\t\t\t& ControlsCC\n\t\t\t\t\t& GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t\t>;\n\t\t\t}\n\t\t)\n\t)\n\t& SupportsCC;\n\nexport type PhysicalCCAPIEndpoint = CCAPIEndpoint & EndpointId;\nexport type VirtualCCAPIEndpoint = CCAPIEndpoint & VirtualEndpointId;\n\n/**\n * The base class for all CC APIs exposed via `Node.commandClasses.<CCName>`\n * @publicAPI\n */\nexport class CCAPI {\n\tpublic constructor(\n\t\tprotected readonly host: CCAPIHost,\n\t\tprotected readonly endpoint: CCAPIEndpoint,\n\t) {\n\t\tthis.ccId = getCommandClass(this);\n\t}\n\n\tpublic static create<T extends CommandClasses>(\n\t\tccId: T,\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t\trequireSupport?: boolean,\n\t): CommandClasses extends T ? CCAPI : CCToAPI<T> {\n\t\tconst APIConstructor = getAPI(ccId);\n\t\tconst ccName = CommandClasses[ccId];\n\t\tif (APIConstructor == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Command Class ${ccName} (${\n\t\t\t\t\tnum2hex(\n\t\t\t\t\t\tccId,\n\t\t\t\t\t)\n\t\t\t\t}) has no associated API!`,\n\t\t\t\tZWaveErrorCodes.CC_NoAPI,\n\t\t\t);\n\t\t}\n\t\tconst apiInstance = new APIConstructor(host, endpoint);\n\n\t\t// Only require support for physical endpoints by default\n\t\trequireSupport ??= !endpoint.virtual;\n\n\t\tif (requireSupport) {\n\t\t\t// @ts-expect-error TS doesn't like assigning to conditional types\n\t\t\treturn new Proxy(apiInstance, {\n\t\t\t\tget: (target, property) => {\n\t\t\t\t\t// Forbid access to the API if it is not supported by the node\n\t\t\t\t\tif (\n\t\t\t\t\t\tproperty !== \"ccId\"\n\t\t\t\t\t\t&& property !== \"endpoint\"\n\t\t\t\t\t\t&& property !== \"isSupported\"\n\t\t\t\t\t\t&& property !== \"withOptions\"\n\t\t\t\t\t\t&& property !== \"commandOptions\"\n\t\t\t\t\t\t&& !target.isSupported()\n\t\t\t\t\t) {\n\t\t\t\t\t\tlet messageStart: string;\n\t\t\t\t\t\tif (endpoint.virtual) {\n\t\t\t\t\t\t\tconst hasNodeId =\n\t\t\t\t\t\t\t\ttypeof endpoint.nodeId === \"number\"\n\t\t\t\t\t\t\t\t&& endpoint.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t\t\t\t\t&& endpoint.nodeId !== NODE_ID_BROADCAST_LR;\n\t\t\t\t\t\t\tmessageStart = `${\n\t\t\t\t\t\t\t\thasNodeId ? \"The\" : \"This\"\n\t\t\t\t\t\t\t} virtual node${\n\t\t\t\t\t\t\t\thasNodeId ? ` ${endpoint.nodeId}` : \"\"\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmessageStart = `Node ${endpoint.nodeId}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\t\t`${messageStart}${\n\t\t\t\t\t\t\t\tendpoint.index === 0\n\t\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t\t: ` (endpoint ${endpoint.index})`\n\t\t\t\t\t\t\t} does not support the Command Class ${ccName}!`,\n\t\t\t\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If a device config defines overrides for an API call, return a wrapper method that applies them first before calling the actual method\n\t\t\t\t\tconst fallback = target[property as keyof CCAPI];\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof property === \"string\"\n\t\t\t\t\t\t&& !endpoint.virtual\n\t\t\t\t\t\t&& typeof fallback === \"function\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst overrides = host.getDeviceConfig?.(\n\t\t\t\t\t\t\tendpoint.nodeId,\n\t\t\t\t\t\t)?.compat?.overrideQueries;\n\t\t\t\t\t\tif (overrides?.hasOverride(ccId)) {\n\t\t\t\t\t\t\treturn overrideQueriesWrapper(\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tendpoint,\n\t\t\t\t\t\t\t\tccId,\n\t\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\t\toverrides,\n\t\t\t\t\t\t\t\tfallback,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Else just access the property\n\t\t\t\t\treturn fallback;\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\t// @ts-expect-error TS doesn't like assigning to conditional types\n\t\t\treturn apiInstance;\n\t\t}\n\t}\n\n\t/**\n\t * The identifier of the Command Class this API is for\n\t */\n\tpublic readonly ccId: CommandClasses;\n\n\tprotected get [SET_VALUE](): SetValueImplementation | undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Can be used on supported CC APIs to set a CC value by property name (and optionally the property key).\n\t * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!\n\t */\n\tpublic get setValue(): SetValueImplementation | undefined {\n\t\treturn this[SET_VALUE];\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory | undefined;\n\t/**\n\t * Can be implemented by CC APIs to influence the behavior of the setValue API in regards to Supervision and verifying values.\n\t */\n\tpublic get setValueHooks(): SetValueImplementationHooksFactory | undefined {\n\t\treturn this[SET_VALUE_HOOKS];\n\t}\n\n\t/** Whether a successful setValue call should imply that the value was successfully updated */\n\t// oxlint-disable-next-line no-unused-vars\n\tpublic isSetValueOptimistic(valueId: ValueID): boolean {\n\t\treturn true;\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation | undefined {\n\t\treturn undefined;\n\t}\n\t/**\n\t * Can be used on supported CC APIs to poll a CC value by property name (and optionally the property key)\n\t * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!\n\t */\n\tpublic get pollValue(): PollValueImplementation | undefined {\n\t\treturn this[POLL_VALUE];\n\t}\n\n\t/**\n\t * Schedules a value to be polled after a given time. Schedules are deduplicated on a per-property basis.\n\t * @returns `true` if the poll was scheduled, `false` otherwise\n\t */\n\tprotected schedulePoll(\n\t\t{ property, propertyKey }: ValueIDProperties,\n\t\texpectedValue: unknown,\n\t\t{ duration, transition = \"slow\" }: CCAPISchedulePollOptions = {},\n\t): boolean {\n\t\t// Figure out the delay. If a non-zero duration was given or this is a \"fast\" transition,\n\t\t// use/add the short delay. Otherwise, default to the long delay.\n\t\tconst durationMs = duration?.toMilliseconds() ?? 0;\n\t\tconst timeouts = this.host.getRefreshValueTimeouts();\n\t\tconst additionalDelay = !!durationMs || transition === \"fast\"\n\t\t\t? timeouts.refreshValueAfterTransition\n\t\t\t: timeouts.refreshValue;\n\t\tconst timeoutMs = durationMs + additionalDelay;\n\n\t\tif (this.isSinglecast()) {\n\t\t\tconst node = this.host.getNode(this.endpoint.nodeId);\n\t\t\tif (!node) return false;\n\n\t\t\treturn this.host.schedulePoll(\n\t\t\t\tnode.id,\n\t\t\t\t{\n\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\tproperty,\n\t\t\t\t\tpropertyKey,\n\t\t\t\t},\n\t\t\t\t{ timeoutMs, expectedValue },\n\t\t\t);\n\t\t} else if (this.isMulticast()) {\n\t\t\t// Only poll supporting nodes in multicast\n\t\t\tconst supportingNodes = this.endpoint.node.physicalNodes.filter(\n\t\t\t\t(node) =>\n\t\t\t\t\tnode\n\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t?.supportsCC(this.ccId),\n\t\t\t);\n\t\t\tlet ret = false;\n\t\t\tfor (const node of supportingNodes) {\n\t\t\t\tret ||= this.host.schedulePoll(\n\t\t\t\t\tnode.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t},\n\t\t\t\t\t{ timeoutMs, expectedValue },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn ret;\n\t\t} else {\n\t\t\t// Don't poll the broadcast node\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the version of the given CommandClass this endpoint implements\n\t */\n\tpublic get version(): number {\n\t\tif (this.isSinglecast()) {\n\t\t\treturn this.host.getSafeCCVersion(\n\t\t\t\tthis.ccId,\n\t\t\t\tthis.endpoint.nodeId,\n\t\t\t\tthis.endpoint.index,\n\t\t\t) ?? 0;\n\t\t} else {\n\t\t\treturn getImplementedVersion(this.ccId);\n\t\t}\n\t}\n\n\t/** Determines if this simplified API instance may be used. */\n\tpublic isSupported(): boolean {\n\t\treturn (\n\t\t\t// NoOperation is always supported\n\t\t\tthis.ccId === CommandClasses[\"No Operation\"]\n\t\t\t// Basic should always be supported. Since we are trying to hide it from library consumers\n\t\t\t// we cannot trust supportsCC to test it\n\t\t\t|| this.ccId === CommandClasses.Basic\n\t\t\t|| this.endpoint.supportsCC(this.ccId)\n\t\t);\n\t}\n\n\t/**\n\t * Determine whether the linked node supports a specific command of this command class.\n\t * {@link NOT_KNOWN} (`undefined`) means that the information has not been received yet\n\t */\n\t// oxlint-disable-next-line no-unused-vars\n\tpublic supportsCommand(command: number): MaybeNotKnown<boolean> {\n\t\t// This needs to be overwritten per command class. In the default implementation, we don't know anything!\n\t\treturn NOT_KNOWN;\n\t}\n\n\tprotected assertSupportsCommand(\n\t\tcommandEnum: unknown,\n\t\tcommand: number,\n\t): void {\n\t\tif (this.supportsCommand(command) !== true) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`${\n\t\t\t\t\tthis.isSinglecast()\n\t\t\t\t\t\t? `Node #${this.endpoint.nodeId}`\n\t\t\t\t\t\t: \"This virtual node\"\n\t\t\t\t}${\n\t\t\t\t\tthis.endpoint.index > 0\n\t\t\t\t\t\t? ` (Endpoint ${this.endpoint.index})`\n\t\t\t\t\t\t: \"\"\n\t\t\t\t} does not support the command ${\n\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\tcommandEnum,\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t)\n\t\t\t\t}!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected assertPhysicalEndpoint(\n\t\tendpoint: EndpointId | VirtualEndpointId,\n\t): asserts endpoint is EndpointId {\n\t\tif (endpoint.virtual) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`This method is not supported for virtual nodes!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Returns the command options to use for sendCommand calls */\n\tprotected get commandOptions(): SendCommandOptions {\n\t\t// No default options\n\t\treturn {};\n\t}\n\n\t/** Creates an instance of this API, scoped to use the given options */\n\tpublic withOptions(options: SendCommandOptions): this {\n\t\tconst mergedOptions = {\n\t\t\t...this.commandOptions,\n\t\t\t...options,\n\t\t};\n\t\treturn new Proxy(this, {\n\t\t\tget: (target, property) => {\n\t\t\t\tif (property === \"commandOptions\") {\n\t\t\t\t\treturn mergedOptions;\n\t\t\t\t} else {\n\t\t\t\t\treturn (target as any)[property];\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/** Creates an instance of this API which (if supported) will return TX reports along with the result. */\n\tpublic withTXReport<T extends this>(): WithTXReport<T> {\n\t\tif (this.constructor === CCAPI) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The withTXReport method may only be called on specific CC API implementations.\",\n\t\t\t\tZWaveErrorCodes.Driver_NotSupported,\n\t\t\t);\n\t\t}\n\n\t\t// Remember which properties need to be proxied\n\t\tconst proxiedProps = new Set([\n\t\t\t// These are the CC-specific methods\n\t\t\t...Object.getOwnPropertyNames(this.constructor.prototype),\n\t\t\t// as well as setValue and pollValue\n\t\t\t\"setValue\",\n\t\t\t\"pollValue\",\n\t\t]);\n\t\tproxiedProps.delete(\"constructor\");\n\n\t\tfunction wrapResult<T>(result: T, txReport: TXReport): any {\n\t\t\t// Both the result and the TX report may be undefined (no response, no support)\n\t\t\treturn stripUndefined({\n\t\t\t\tresult,\n\t\t\t\ttxReport,\n\t\t\t});\n\t\t}\n\n\t\treturn new Proxy(this, {\n\t\t\tget: (target, prop) => {\n\t\t\t\tif (prop === \"withTXReport\") return undefined;\n\n\t\t\t\tlet original: any = (target as any)[prop];\n\t\t\t\tif (\n\t\t\t\t\tproxiedProps.has(prop as string)\n\t\t\t\t\t&& typeof original === \"function\"\n\t\t\t\t) {\n\t\t\t\t\t// This is a method that only exists in the specific implementation\n\n\t\t\t\t\t// Wrap each call with its own API proxy, so we don't mix up TX reports\n\t\t\t\t\tlet txReport: TXReport;\n\t\t\t\t\tconst api = target.withOptions({\n\t\t\t\t\t\tonTXReport: (report) => {\n\t\t\t\t\t\t\t// Remember the last status report\n\t\t\t\t\t\t\ttxReport = report;\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\toriginal = (api as any)[prop].bind(api);\n\n\t\t\t\t\t// Return a wrapper function that will add the status report after the call is complete\n\t\t\t\t\treturn (...args: any) => {\n\t\t\t\t\t\tlet result = original(...args);\n\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\tresult = result.then((res) =>\n\t\t\t\t\t\t\t\twrapResult(res, txReport)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult = wrapResult(result, txReport);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn original;\n\t\t\t\t}\n\t\t\t},\n\t\t}) as any;\n\t}\n\n\tprotected isSinglecast(): this is this & {\n\t\tendpoint: PhysicalCCAPIEndpoint;\n\t} {\n\t\treturn (\n\t\t\t!this.endpoint.virtual\n\t\t\t&& typeof this.endpoint.nodeId === \"number\"\n\t\t\t&& this.endpoint.nodeId !== NODE_ID_BROADCAST\n\t\t\t&& this.endpoint.nodeId !== NODE_ID_BROADCAST_LR\n\t\t);\n\t}\n\n\tprotected isMulticast(): this is this & {\n\t\tendpoint: VirtualCCAPIEndpoint & {\n\t\t\tnodeId: number[];\n\t\t};\n\t} {\n\t\treturn this.endpoint.virtual && isArray(this.endpoint.nodeId);\n\t}\n\n\tprotected isBroadcast(): this is this & {\n\t\tendpoint: VirtualCCAPIEndpoint & {\n\t\t\tnodeId: typeof NODE_ID_BROADCAST | typeof NODE_ID_BROADCAST_LR;\n\t\t};\n\t} {\n\t\treturn (\n\t\t\tthis.endpoint.virtual\n\t\t\t&& (this.endpoint.nodeId === NODE_ID_BROADCAST\n\t\t\t\t|| this.endpoint.nodeId === NODE_ID_BROADCAST_LR)\n\t\t);\n\t}\n\n\t/** Returns the value DB for this CC API's node (if it can be safely accessed) */\n\tprotected tryGetValueDB(): ValueDB | undefined {\n\t\tif (!this.isSinglecast()) return;\n\t\ttry {\n\t\t\treturn this.host.getValueDB(this.endpoint.nodeId);\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/** Returns the value DB for this CC's node (or throws if it cannot be accessed) */\n\tprotected getValueDB(): ValueDB {\n\t\tif (this.isSinglecast()) {\n\t\t\ttry {\n\t\t\t\treturn this.host.getValueDB(this.endpoint.nodeId);\n\t\t\t} catch {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\"The node for this CC does not exist or the driver is not ready yet\",\n\t\t\t\t\tZWaveErrorCodes.Driver_NotReady,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthrow new ZWaveError(\n\t\t\t\"Cannot retrieve the value DB for non-singlecast CCs\",\n\t\t\tZWaveErrorCodes.CC_NoNodeID,\n\t\t);\n\t}\n}\n\nfunction overrideQueriesWrapper(\n\tctx: GetValueDB & LogNode,\n\tendpoint: PhysicalCCAPIEndpoint,\n\tccId: CommandClasses,\n\tmethod: string,\n\toverrides: CompatOverrideQueries,\n\tfallback: (...args: any[]) => any,\n): (...args: any[]) => any {\n\t// We must not capture the `this` context here, because the API methods are bound on use\n\treturn function(this: any, ...args: any[]) {\n\t\tconst match = overrides.matchOverride(\n\t\t\tccId,\n\t\t\tendpoint.index,\n\t\t\tmethod,\n\t\t\targs,\n\t\t);\n\t\tif (!match) return fallback.call(this, ...args);\n\n\t\tctx.logNode(endpoint.nodeId, {\n\t\t\tmessage: `API call ${method} for ${\n\t\t\t\tgetCCName(\n\t\t\t\t\tccId,\n\t\t\t\t)\n\t\t\t} CC overridden by a compat flag.`,\n\t\t\tlevel: \"debug\",\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tconst ccValues = getCCValues(ccId);\n\t\tif (ccValues) {\n\t\t\tconst valueDB = ctx.getValueDB(endpoint.nodeId);\n\n\t\t\tconst prop2value = (prop: string): CCValue | undefined => {\n\t\t\t\t// We use a simplistic parser to support dynamic value IDs:\n\t\t\t\t// If end with round brackets with something inside, they are considered dynamic\n\t\t\t\t// Otherwise static\n\t\t\t\tconst argsMatch = prop.match(/^(.*)\\((.*)\\)$/);\n\t\t\t\tif (argsMatch) {\n\t\t\t\t\tconst methodName = argsMatch[1];\n\t\t\t\t\tconst methodArgs = JSON.parse(`[${argsMatch[2]}]`);\n\n\t\t\t\t\tconst dynValue = ccValues[methodName];\n\t\t\t\t\tif (typeof dynValue === \"function\") {\n\t\t\t\t\t\treturn dynValue(...methodArgs);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst staticValue = ccValues[prop] as\n\t\t\t\t\t\t| StaticCCValue\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (typeof staticValue?.endpoint === \"function\") {\n\t\t\t\t\t\treturn staticValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Persist values if necessary\n\t\t\tif (match.persistValues) {\n\t\t\t\tfor (\n\t\t\t\t\tconst [prop, value] of Object.entries(\n\t\t\t\t\t\tmatch.persistValues,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst ccValue = prop2value(prop);\n\t\t\t\t\t\tif (ccValue) {\n\t\t\t\t\t\t\tvalueDB.setValue(\n\t\t\t\t\t\t\t\tccValue.endpoint(endpoint.index),\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 {\n\t\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Failed to persist value ${prop} during overridden API call: value does not exist`,\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Failed to persist value ${prop} during overridden API call: ${\n\t\t\t\t\t\t\t\t\tgetErrorMessage(\n\t\t\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// As well as metadata\n\t\t\tif (match.extendMetadata) {\n\t\t\t\tfor (\n\t\t\t\t\tconst [prop, meta] of Object.entries(\n\t\t\t\t\t\tmatch.extendMetadata,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst ccValue = prop2value(prop);\n\t\t\t\t\t\tif (ccValue) {\n\t\t\t\t\t\t\tvalueDB.setMetadata(\n\t\t\t\t\t\t\t\tccValue.endpoint(endpoint.index),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...ccValue.meta,\n\t\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Failed to extend value metadata ${prop} during overridden API call: value does not exist`,\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Failed to extend value metadata ${prop} during overridden API call: ${\n\t\t\t\t\t\t\t\t\tgetErrorMessage(\n\t\t\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tdirection: \"none\",\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\n\t\t// API methods are always async\n\t\treturn Promise.resolve(match.result);\n\t};\n}\n\n/** A CC API that is only available for physical endpoints */\nexport class PhysicalCCAPI extends CCAPI {\n\tpublic constructor(\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t) {\n\t\tsuper(host, endpoint);\n\t\tthis.assertPhysicalEndpoint(endpoint);\n\t}\n\n\tdeclare protected readonly endpoint: PhysicalCCAPIEndpoint;\n}\n\nexport type APIConstructor<T extends CCAPI = CCAPI> = new (\n\thost: CCAPIHost,\n\tendpoint: CCAPIEndpoint,\n) => T;\n\n// This type is auto-generated by maintenance/generateCCAPIInterface.ts\n// Do not edit it by hand or your changes will be lost\ntype CCNameMap = {\n\t\"Alarm Sensor\": typeof CommandClasses[\"Alarm Sensor\"];\n\t\"Application Status\": typeof CommandClasses[\"Application Status\"];\n\tAssociation: typeof CommandClasses[\"Association\"];\n\t\"Association Group Information\":\n\t\ttypeof CommandClasses[\"Association Group Information\"];\n\t\"Barrier Operator\": typeof CommandClasses[\"Barrier Operator\"];\n\tBasic: typeof CommandClasses[\"Basic\"];\n\t\"Basic Window Covering\": typeof CommandClasses[\"Basic Window Covering\"];\n\tBattery: typeof CommandClasses[\"Battery\"];\n\t\"Binary Sensor\": typeof CommandClasses[\"Binary Sensor\"];\n\t\"Binary Switch\": typeof CommandClasses[\"Binary Switch\"];\n\t\"CRC-16 Encapsulation\": typeof CommandClasses[\"CRC-16 Encapsulation\"];\n\t\"Central Scene\": typeof CommandClasses[\"Central Scene\"];\n\t\"Climate Control Schedule\":\n\t\ttypeof CommandClasses[\"Climate Control Schedule\"];\n\tClock: typeof CommandClasses[\"Clock\"];\n\t\"Color Switch\": typeof CommandClasses[\"Color Switch\"];\n\tConfiguration: typeof CommandClasses[\"Configuration\"];\n\t\"Device Reset Locally\": typeof CommandClasses[\"Device Reset Locally\"];\n\t\"Door Lock\": typeof CommandClasses[\"Door Lock\"];\n\t\"Door Lock Logging\": typeof CommandClasses[\"Door Lock Logging\"];\n\t\"Energy Production\": typeof CommandClasses[\"Energy Production\"];\n\t\"Entry Control\": typeof CommandClasses[\"Entry Control\"];\n\t\"Firmware Update Meta Data\":\n\t\ttypeof CommandClasses[\"Firmware Update Meta Data\"];\n\t\"Humidity Control Mode\": typeof CommandClasses[\"Humidity Control Mode\"];\n\t\"Humidity Control Operating State\":\n\t\ttypeof CommandClasses[\"Humidity Control Operating State\"];\n\t\"Humidity Control Setpoint\":\n\t\ttypeof CommandClasses[\"Humidity Control Setpoint\"];\n\t\"Inclusion Controller\": typeof CommandClasses[\"Inclusion Controller\"];\n\tIndicator: typeof CommandClasses[\"Indicator\"];\n\tIrrigation: typeof CommandClasses[\"Irrigation\"];\n\tLanguage: typeof CommandClasses[\"Language\"];\n\tLock: typeof CommandClasses[\"Lock\"];\n\t\"Manufacturer Proprietary\":\n\t\ttypeof CommandClasses[\"Manufacturer Proprietary\"];\n\t\"Manufacturer Specific\": typeof CommandClasses[\"Manufacturer Specific\"];\n\tMeter: typeof CommandClasses[\"Meter\"];\n\t\"Multi Channel Association\":\n\t\ttypeof CommandClasses[\"Multi Channel Association\"];\n\t\"Multi Channel\": typeof CommandClasses[\"Multi Channel\"];\n\t\"Multi Command\": typeof CommandClasses[\"Multi Command\"];\n\t\"Multilevel Sensor\": typeof CommandClasses[\"Multilevel Sensor\"];\n\t\"Multilevel Switch\": typeof CommandClasses[\"Multilevel Switch\"];\n\t\"No Operation\": typeof CommandClasses[\"No Operation\"];\n\t\"Node Naming and Location\":\n\t\ttypeof CommandClasses[\"Node Naming and Location\"];\n\tNotification: typeof CommandClasses[\"Notification\"];\n\tPowerlevel: typeof CommandClasses[\"Powerlevel\"];\n\tProtection: typeof CommandClasses[\"Protection\"];\n\t\"Scene Activation\": typeof CommandClasses[\"Scene Activation\"];\n\t\"Scene Actuator Configuration\":\n\t\ttypeof CommandClasses[\"Scene Actuator Configuration\"];\n\t\"Scene Controller Configuration\":\n\t\ttypeof CommandClasses[\"Scene Controller Configuration\"];\n\t\"Schedule Entry Lock\": typeof CommandClasses[\"Schedule Entry Lock\"];\n\t\"Security 2\": typeof CommandClasses[\"Security 2\"];\n\tSecurity: typeof CommandClasses[\"Security\"];\n\t\"Sound Switch\": typeof CommandClasses[\"Sound Switch\"];\n\tSupervision: typeof CommandClasses[\"Supervision\"];\n\t\"Thermostat Fan Mode\": typeof CommandClasses[\"Thermostat Fan Mode\"];\n\t\"Thermostat Fan State\": typeof CommandClasses[\"Thermostat Fan State\"];\n\t\"Thermostat Mode\": typeof CommandClasses[\"Thermostat Mode\"];\n\t\"Thermostat Operating State\":\n\t\ttypeof CommandClasses[\"Thermostat Operating State\"];\n\t\"Thermostat Setback\": typeof CommandClasses[\"Thermostat Setback\"];\n\t\"Thermostat Setpoint\": typeof CommandClasses[\"Thermostat Setpoint\"];\n\tTime: typeof CommandClasses[\"Time\"];\n\t\"Time Parameters\": typeof CommandClasses[\"Time Parameters\"];\n\t\"User Code\": typeof CommandClasses[\"User Code\"];\n\tVersion: typeof CommandClasses[\"Version\"];\n\t\"Wake Up\": typeof CommandClasses[\"Wake Up\"];\n\t\"Window Covering\": typeof CommandClasses[\"Window Covering\"];\n\t\"Z-Wave Plus Info\": typeof CommandClasses[\"Z-Wave Plus Info\"];\n};\nexport type CCToName<CC extends CommandClasses> = {\n\t[K in keyof CCNameMap]: CCNameMap[K] extends CC ? K : never;\n}[keyof CCNameMap];\n\nexport type CCNameOrId = CommandClasses | Extract<keyof CCAPIs, string>;\n\nexport type CCToAPI<CC extends CCNameOrId> = CC extends CommandClasses\n\t? CCToName<CC> extends keyof CCAPIs ? CCAPIs[CCToName<CC>]\n\t: never\n\t: CC extends keyof CCAPIs ? CCAPIs[CC]\n\t: never;\n\nexport type APIMethodsOf<CC extends CCNameOrId> = Omit<\n\tOnlyMethods<CCToAPI<CC>>,\n\t| \"ccId\"\n\t| \"getNode\"\n\t| \"tryGetNode\"\n\t| \"isSetValueOptimistic\"\n\t| \"isSupported\"\n\t| \"pollValue\"\n\t| \"setValue\"\n\t| \"version\"\n\t| \"supportsCommand\"\n\t| \"withOptions\"\n\t| \"withTXReport\"\n>;\n\nexport type OwnMethodsOf<API extends CCAPI> = Omit<\n\tOnlyMethods<API>,\n\tkeyof OnlyMethods<CCAPI>\n>;\n\n// Wraps the given type in an object that contains a TX report\nexport type WrapWithTXReport<T> = [T] extends [Promise<infer U>]\n\t? Promise<WrapWithTXReport<U>>\n\t: [T] extends [void] ? { txReport: TXReport | undefined }\n\t: { result: T; txReport: TXReport | undefined };\n\nexport type ReturnWithTXReport<T> = T extends (...args: any[]) => any\n\t? (...args: Parameters<T>) => WrapWithTXReport<ReturnType<T>>\n\t: undefined;\n\n// Converts the type of the given API implementation so the API methods return an object including the TX report\nexport type WithTXReport<API extends CCAPI> =\n\t& Omit<\n\t\tAPI,\n\t\tkeyof OwnMethodsOf<API> | \"withOptions\" | \"withTXReport\" | \"setValue\"\n\t>\n\t& {\n\t\t[\n\t\t\tK in\n\t\t\t\t| keyof OwnMethodsOf<API>\n\t\t\t\t| \"setValue\"\n\t\t\t\t| \"pollValue\"\n\t\t]: ReturnWithTXReport<API[K]>;\n\t};\n\nexport function normalizeCCNameOrId(\n\tccNameOrId: number | string,\n): CommandClasses | undefined {\n\tif (!(ccNameOrId in CommandClasses)) return undefined;\n\n\tlet ret: CommandClasses | undefined;\n\tif (typeof ccNameOrId === \"string\") {\n\t\tif (/^\\d+$/.test(ccNameOrId)) {\n\t\t\t// This can happen on property access\n\t\t\tret = +ccNameOrId;\n\t\t} else if (typeof (CommandClasses as any)[ccNameOrId] === \"number\") {\n\t\t\tret = (CommandClasses as any)[ccNameOrId];\n\t\t}\n\t} else {\n\t\tret = ccNameOrId;\n\t}\n\n\treturn ret;\n}\n\n// This interface is auto-generated by maintenance/generateCCAPIInterface.ts\n// Do not edit it by hand or your changes will be lost\nexport interface CCAPIs {\n\t[Symbol.iterator](): Iterator<CCAPI>;\n\n\t// AUTO GENERATION BELOW\n\t\"Alarm Sensor\": import(\"../cc/AlarmSensorCC.js\").AlarmSensorCCAPI;\n\t\"Application Status\":\n\t\timport(\"../cc/ApplicationStatusCC.js\").ApplicationStatusCCAPI;\n\tAssociation: import(\"../cc/AssociationCC.js\").AssociationCCAPI;\n\t\"Association Group Information\":\n\t\timport(\"../cc/AssociationGroupInfoCC.js\").AssociationGroupInfoCCAPI;\n\t\"Barrier Operator\":\n\t\timport(\"../cc/BarrierOperatorCC.js\").BarrierOperatorCCAPI;\n\tBasic: import(\"../cc/BasicCC.js\").BasicCCAPI;\n\t\"Basic Window Covering\":\n\t\timport(\"../cc/BasicWindowCoveringCC.js\").BasicWindowCoveringCCAPI;\n\tBattery: import(\"../cc/BatteryCC.js\").BatteryCCAPI;\n\t\"Binary Sensor\": import(\"../cc/BinarySensorCC.js\").BinarySensorCCAPI;\n\t\"Binary Switch\": import(\"../cc/BinarySwitchCC.js\").BinarySwitchCCAPI;\n\t\"CRC-16 Encapsulation\": import(\"../cc/CRC16CC.js\").CRC16CCAPI;\n\t\"Central Scene\": import(\"../cc/CentralSceneCC.js\").CentralSceneCCAPI;\n\t\"Climate Control Schedule\":\n\t\timport(\"../cc/ClimateControlScheduleCC.js\").ClimateControlScheduleCCAPI;\n\tClock: import(\"../cc/ClockCC.js\").ClockCCAPI;\n\t\"Color Switch\": import(\"../cc/ColorSwitchCC.js\").ColorSwitchCCAPI;\n\tConfiguration: import(\"../cc/ConfigurationCC.js\").ConfigurationCCAPI;\n\t\"Device Reset Locally\":\n\t\timport(\"../cc/DeviceResetLocallyCC.js\").DeviceResetLocallyCCAPI;\n\t\"Door Lock\": import(\"../cc/DoorLockCC.js\").DoorLockCCAPI;\n\t\"Door Lock Logging\":\n\t\timport(\"../cc/DoorLockLoggingCC.js\").DoorLockLoggingCCAPI;\n\t\"Energy Production\":\n\t\timport(\"../cc/EnergyProductionCC.js\").EnergyProductionCCAPI;\n\t\"Entry Control\": import(\"../cc/EntryControlCC.js\").EntryControlCCAPI;\n\t\"Firmware Update Meta Data\":\n\t\timport(\"../cc/FirmwareUpdateMetaDataCC.js\").FirmwareUpdateMetaDataCCAPI;\n\t\"Humidity Control Mode\":\n\t\timport(\"../cc/HumidityControlModeCC.js\").HumidityControlModeCCAPI;\n\t\"Humidity Control Operating State\":\n\t\timport(\"../cc/HumidityControlOperatingStateCC.js\").HumidityControlOperatingStateCCAPI;\n\t\"Humidity Control Setpoint\":\n\t\timport(\"../cc/HumidityControlSetpointCC.js\").HumidityControlSetpointCCAPI;\n\t\"Inclusion Controller\":\n\t\timport(\"../cc/InclusionControllerCC.js\").InclusionControllerCCAPI;\n\tIndicator: import(\"../cc/IndicatorCC.js\").IndicatorCCAPI;\n\tIrrigation: import(\"../cc/IrrigationCC.js\").IrrigationCCAPI;\n\tLanguage: import(\"../cc/LanguageCC.js\").LanguageCCAPI;\n\tLock: import(\"../cc/LockCC.js\").LockCCAPI;\n\t\"Manufacturer Proprietary\":\n\t\timport(\"../cc/ManufacturerProprietaryCC.js\").ManufacturerProprietaryCCAPI;\n\t\"Manufacturer Specific\":\n\t\timport(\"../cc/ManufacturerSpecificCC.js\").ManufacturerSpecificCCAPI;\n\tMeter: import(\"../cc/MeterCC.js\").MeterCCAPI;\n\t\"Multi Channel Association\":\n\t\timport(\"../cc/MultiChannelAssociationCC.js\").MultiChannelAssociationCCAPI;\n\t\"Multi Channel\": import(\"../cc/MultiChannelCC.js\").MultiChannelCCAPI;\n\t\"Multi Command\": import(\"../cc/MultiCommandCC.js\").MultiCommandCCAPI;\n\t\"Multilevel Sensor\":\n\t\timport(\"../cc/MultilevelSensorCC.js\").MultilevelSensorCCAPI;\n\t\"Multilevel Switch\":\n\t\timport(\"../cc/MultilevelSwitchCC.js\").MultilevelSwitchCCAPI;\n\t\"No Operation\": import(\"../cc/NoOperationCC.js\").NoOperationCCAPI;\n\t\"Node Naming and Location\":\n\t\timport(\"../cc/NodeNamingCC.js\").NodeNamingAndLocationCCAPI;\n\tNotification: import(\"../cc/NotificationCC.js\").NotificationCCAPI;\n\tPowerlevel: import(\"../cc/PowerlevelCC.js\").PowerlevelCCAPI;\n\tProtection: import(\"../cc/ProtectionCC.js\").ProtectionCCAPI;\n\t\"Scene Activation\":\n\t\timport(\"../cc/SceneActivationCC.js\").SceneActivationCCAPI;\n\t\"Scene Actuator Configuration\":\n\t\timport(\"../cc/SceneActuatorConfigurationCC.js\").SceneActuatorConfigurationCCAPI;\n\t\"Scene Controller Configuration\":\n\t\timport(\"../cc/SceneControllerConfigurationCC.js\").SceneControllerConfigurationCCAPI;\n\t\"Schedule Entry Lock\":\n\t\timport(\"../cc/ScheduleEntryLockCC.js\").ScheduleEntryLockCCAPI;\n\t\"Security 2\": import(\"../cc/Security2CC.js\").Security2CCAPI;\n\tSecurity: import(\"../cc/SecurityCC.js\").SecurityCCAPI;\n\t\"Sound Switch\": import(\"../cc/SoundSwitchCC.js\").SoundSwitchCCAPI;\n\tSupervision: import(\"../cc/SupervisionCC.js\").SupervisionCCAPI;\n\t\"Thermostat Fan Mode\":\n\t\timport(\"../cc/ThermostatFanModeCC.js\").ThermostatFanModeCCAPI;\n\t\"Thermostat Fan State\":\n\t\timport(\"../cc/ThermostatFanStateCC.js\").ThermostatFanStateCCAPI;\n\t\"Thermostat Mode\": import(\"../cc/ThermostatModeCC.js\").ThermostatModeCCAPI;\n\t\"Thermostat Operating State\":\n\t\timport(\"../cc/ThermostatOperatingStateCC.js\").ThermostatOperatingStateCCAPI;\n\t\"Thermostat Setback\":\n\t\timport(\"../cc/ThermostatSetbackCC.js\").ThermostatSetbackCCAPI;\n\t\"Thermostat Setpoint\":\n\t\timport(\"../cc/ThermostatSetpointCC.js\").ThermostatSetpointCCAPI;\n\tTime: import(\"../cc/TimeCC.js\").TimeCCAPI;\n\t\"Time Parameters\": import(\"../cc/TimeParametersCC.js\").TimeParametersCCAPI;\n\t\"User Code\": import(\"../cc/UserCodeCC.js\").UserCodeCCAPI;\n\tVersion: import(\"../cc/VersionCC.js\").VersionCCAPI;\n\t\"Wake Up\": import(\"../cc/WakeUpCC.js\").WakeUpCCAPI;\n\t\"Window Covering\": import(\"../cc/WindowCoveringCC.js\").WindowCoveringCCAPI;\n\t\"Z-Wave Plus Info\": import(\"../cc/ZWavePlusCC.js\").ZWavePlusCCAPI;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;AAAA,kBAiCO;AACP,oBAMO;AACP,wBAAwB;AACxB,oCAKO;AAWA,MAAM,YAA2B,OAAO,IAAI,iBAAiB;AAQ7D,MAAM,kBAAiC,OAAO,IACpD,uBAAuB;AAqCjB,MAAM,aAA4B,OAAO,IAAI,kBAAkB;AAOhE,SAAU,yBACf,IACA,UAAyB;AAEzB,QAAM,IAAI,uBACT,GAAG,2BAAe,EAAE,CAAC,MAAM,QAAQ,iCACnC,4BAAgB,gBAAgB;AAElC;AARgB;AAUV,SAAU,4BACf,IACA,UACA,aAA4B;AAE5B,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,MAAM,WAAW,mDAAmD,QAAQ,KAC5E,4BAAgB,gBAAgB;AAElC;AAXgB;AAaV,SAAU,wBACf,IACA,UAAyB;AAEzB,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,eAAe,QAAQ,iDACvB,4BAAgB,gBAAgB;AAElC;AAVgB;AAYV,SAAU,oBACf,IACA,UACA,cACA,cAAoB;AAEpB,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,MAAM,QAAQ,sBAAsB,YAAY,gBAAgB,YAAY,KAC5E,4BAAgB,gBAAgB;AAElC;AAZgB;AAmEV,MAAO,MAAK;EArNlB,OAqNkB;;;EAEG;EACA;EAFpB,YACoB,MACA,UAAuB;AADvB,SAAA,OAAA;AACA,SAAA,WAAA;AAEnB,SAAK,WAAO,+CAAgB,IAAI;EACjC;EAEO,OAAO,OACb,MACA,MACA,UACA,gBAAwB;AAExB,UAAM,qBAAiB,sCAAO,IAAI;AAClC,UAAM,SAAS,2BAAe,IAAI;AAClC,QAAI,kBAAkB,QAAW;AAChC,YAAM,I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AW,IAAI;AAC/B,gBAAI,SAAS;AACZ,sBAAQ,YACP,QAAQ,SAAS,SAAS,KAAK,GAC/B;gBACC,GAAG,QAAQ;gBACX,GAAG;eACH;YAEH,OAAO;AACN,kBAAI,QAAQ,SAAS,QAAQ;gBAC5B,SACC,mCAAmC,IAAI;gBACxC,OAAO;gBACP,WAAW;eACX;YACF;UACD,SAAS,GAAG;AACX,gBAAI,QAAQ,SAAS,QAAQ;cAC5B,SACC,mCAAmC,IAAI,oCACtC,+BACC,CAAC,CAEH;cACD,OAAO;cACP,WAAW;aACX;UACF;QACD;MACD;IACD;AAGA,WAAO,QAAQ,QAAQ,MAAM,MAAM;EACpC;AACD;AAxIS;AA2IH,MAAO,sBAAsB,MAAK;EAzwBxC,OAywBwC;;;EACvC,YACC,MACA,UAAuB;AAEvB,UAAM,MAAM,QAAQ;AACpB,SAAK,uBAAuB,QAAQ;EACrC;;AAkJK,SAAU,oBACf,YAA2B;AAE3B,MAAI,EAAE,cAAc;AAAiB,WAAO;AAE5C,MAAI;AACJ,MAAI,OAAO,eAAe,UAAU;AACnC,QAAI,QAAQ,KAAK,UAAU,GAAG;AAE7B,YAAM,CAAC;IACR,WAAW,OAAQ,2BAAuB,UAAU,MAAM,UAAU;AACnE,YAAO,2BAAuB,UAAU;IACzC;EACD,OAAO;AACN,UAAM;EACP;AAEA,SAAO;AACR;AAlBgB;",
4
+ "sourcesContent": ["import type { SendCommand } from \"@zwave-js/cc\";\nimport type { CompatOverrideQueries, GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype Duration,\n\ttype EndpointId,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSafeCCVersion,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype MaybeNotKnown,\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\tNOT_KNOWN,\n\ttype NodeId,\n\ttype PhysicalNodes,\n\ttype QueryNodeInterviewStage,\n\ttype QueryNodeStatus,\n\ttype SecurityManagers,\n\ttype SendCommandOptions,\n\ttype SupervisionResult,\n\ttype SupportsCC,\n\ttype TXReport,\n\ttype ValueChangeOptions,\n\ttype ValueDB,\n\ttype ValueID,\n\ttype VirtualEndpointId,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tstripUndefined,\n} from \"@zwave-js/core\";\nimport {\n\ttype AllOrNone,\n\ttype OnlyMethods,\n\tgetEnumMemberName,\n\tgetErrorMessage,\n\tnum2hex,\n} from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport {\n\tgetAPI,\n\tgetCCValues,\n\tgetCommandClass,\n\tgetImplementedVersion,\n} from \"./CommandClassDecorators.js\";\nimport type { CCValue, StaticCCValue } from \"./Values.js\";\nimport type {\n\tGetRefreshValueTimeouts,\n\tGetUserPreferences,\n\tSchedulePoll,\n} from \"./traits.js\";\n\nexport type ValueIDProperties = Pick<ValueID, \"property\" | \"propertyKey\">;\n\n/** Used to identify the method on the CC API class that handles setting values on nodes directly */\nexport const SET_VALUE: unique symbol = Symbol.for(\"CCAPI_SET_VALUE\");\n\nexport type SetValueImplementation = (\n\tproperty: ValueIDProperties,\n\tvalue: unknown,\n\toptions?: SetValueAPIOptions,\n) => Promise<SupervisionResult | undefined>;\n\nexport const SET_VALUE_HOOKS: unique symbol = Symbol.for(\n\t\"CCAPI_SET_VALUE_HOOKS\",\n);\n\nexport type SetValueImplementationHooks =\n\t& AllOrNone<{\n\t\t// Opt-in to and handle delayed supervision updates\n\t\tsupervisionDelayedUpdates: boolean;\n\t\tsupervisionOnSuccess: () => void | Promise<void>;\n\t\tsupervisionOnFailure: () => void | Promise<void>;\n\t}>\n\t& {\n\t\t// Optimistically update related cached values (if allowed)\n\t\toptimisticallyUpdateRelatedValues?: (\n\t\t\tsupervisedAndSuccessful: boolean,\n\t\t) => void;\n\t\t// Check if a verification of the set value is required, even if the API response suggests otherwise\n\t\tforceVerifyChanges?: () => boolean;\n\t\t// Verify the changes\n\t\tverifyChanges?: (result?: SupervisionResult) => void | Promise<void>;\n\t};\n\nexport type SetValueImplementationHooksFactory = (\n\tproperty: ValueIDProperties,\n\tvalue: unknown,\n\toptions?: SetValueAPIOptions,\n) => SetValueImplementationHooks | undefined;\n\n/**\n * A generic options bag for the `setValue` API.\n * Each implementation will choose the options that are relevant for it, so you can use the same options everywhere.\n * @publicAPI\n */\nexport type SetValueAPIOptions =\n\t& Partial<ValueChangeOptions>\n\t& Pick<SendCommandOptions, \"onProgress\">;\n\n/** Used to identify the method on the CC API class that handles polling values from nodes */\nexport const POLL_VALUE: unique symbol = Symbol.for(\"CCAPI_POLL_VALUE\");\nexport type PollValueImplementation<T = unknown> = (\n\tproperty: ValueIDProperties,\n) => Promise<T | undefined>;\n\n// Since the setValue API is called from a point with very generic parameters,\n// we must do narrowing inside the API calls. These three methods are for convenience\nexport function throwUnsupportedProperty(\n\tcc: CommandClasses,\n\tproperty: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${CommandClasses[cc]}: \"${property}\" is not a supported property`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwUnsupportedPropertyKey(\n\tcc: CommandClasses,\n\tproperty: string | number,\n\tpropertyKey: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: \"${propertyKey}\" is not a supported property key for property \"${property}\"`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwMissingPropertyKey(\n\tcc: CommandClasses,\n\tproperty: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: property \"${property}\" requires a property key, but none was given`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwWrongValueType(\n\tcc: CommandClasses,\n\tproperty: string | number,\n\texpectedType: string,\n\treceivedType: string,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: \"${property}\" must be of type \"${expectedType}\", received \"${receivedType}\"`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport interface CCAPISchedulePollOptions {\n\tduration?: Duration;\n\ttransition?: \"fast\" | \"slow\";\n}\n\n// Defines the necessary traits the host passed to a CC API must have\nexport type CCAPIHost<TNode extends CCAPINode = CCAPINode> =\n\t& HostIDs\n\t& GetNode<TNode>\n\t& GetValueDB\n\t& GetSupportedCCVersion\n\t& GetSafeCCVersion\n\t& SecurityManagers\n\t& GetDeviceConfig\n\t& SendCommand\n\t& GetRefreshValueTimeouts\n\t& GetUserPreferences\n\t& SchedulePoll\n\t& LogNode;\n\n// Defines the necessary traits a node passed to a CC API must have\nexport type CCAPINode =\n\t& NodeId\n\t& ListenBehavior\n\t& QueryNodeStatus\n\t& QueryNodeInterviewStage;\n\n// Defines the necessary traits an endpoint passed to a CC API must have\nexport type CCAPIEndpoint =\n\t& (\n\t\t| (\n\t\t\t// Physical endpoints must let us query their controlled CCs\n\t\t\tEndpointId & ControlsCC\n\t\t)\n\t\t| (\n\t\t\t// Virtual endpoints must let us query their physical nodes,\n\t\t\t// the CCs those nodes implement, and access the endpoints of those\n\t\t\t// physical nodes\n\t\t\tVirtualEndpointId & {\n\t\t\t\tnode: PhysicalNodes<\n\t\t\t\t\t& NodeId\n\t\t\t\t\t& SupportsCC\n\t\t\t\t\t& ControlsCC\n\t\t\t\t\t& GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t\t>;\n\t\t\t}\n\t\t)\n\t)\n\t& SupportsCC;\n\nexport type PhysicalCCAPIEndpoint = CCAPIEndpoint & EndpointId;\nexport type VirtualCCAPIEndpoint = CCAPIEndpoint & VirtualEndpointId;\n\n/**\n * The base class for all CC APIs exposed via `Node.commandClasses.<CCName>`\n * @publicAPI\n */\nexport class CCAPI {\n\tpublic constructor(\n\t\tprotected readonly host: CCAPIHost,\n\t\tprotected readonly endpoint: CCAPIEndpoint,\n\t) {\n\t\tthis.ccId = getCommandClass(this);\n\t}\n\n\tpublic static create<T extends CommandClasses>(\n\t\tccId: T,\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t\trequireSupport?: boolean,\n\t): CommandClasses extends T ? CCAPI : CCToAPI<T> {\n\t\tconst APIConstructor = getAPI(ccId);\n\t\tconst ccName = CommandClasses[ccId];\n\t\tif (APIConstructor == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Command Class ${ccName} (${\n\t\t\t\t\tnum2hex(\n\t\t\t\t\t\tccId,\n\t\t\t\t\t)\n\t\t\t\t}) has no associated API!`,\n\t\t\t\tZWaveErrorCodes.CC_NoAPI,\n\t\t\t);\n\t\t}\n\t\tconst apiInstance = new APIConstructor(host, endpoint);\n\n\t\t// Only require support for physical endpoints by default\n\t\trequireSupport ??= !endpoint.virtual;\n\n\t\tif (requireSupport) {\n\t\t\t// @ts-expect-error TS doesn't like assigning to conditional types\n\t\t\treturn new Proxy(apiInstance, {\n\t\t\t\tget: (target, property) => {\n\t\t\t\t\t// Forbid access to the API if it is not supported by the node\n\t\t\t\t\tif (\n\t\t\t\t\t\tproperty !== \"ccId\"\n\t\t\t\t\t\t&& property !== \"endpoint\"\n\t\t\t\t\t\t&& property !== \"isSupported\"\n\t\t\t\t\t\t&& property !== \"withOptions\"\n\t\t\t\t\t\t&& property !== \"commandOptions\"\n\t\t\t\t\t\t&& !target.isSupported()\n\t\t\t\t\t) {\n\t\t\t\t\t\tlet messageStart: string;\n\t\t\t\t\t\tif (endpoint.virtual) {\n\t\t\t\t\t\t\tconst hasNodeId =\n\t\t\t\t\t\t\t\ttypeof endpoint.nodeId === \"number\"\n\t\t\t\t\t\t\t\t&& endpoint.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t\t\t\t\t&& endpoint.nodeId !== NODE_ID_BROADCAST_LR;\n\t\t\t\t\t\t\tmessageStart = `${\n\t\t\t\t\t\t\t\thasNodeId ? \"The\" : \"This\"\n\t\t\t\t\t\t\t} virtual node${\n\t\t\t\t\t\t\t\thasNodeId ? ` ${endpoint.nodeId}` : \"\"\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmessageStart = `Node ${endpoint.nodeId}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\t\t`${messageStart}${\n\t\t\t\t\t\t\t\tendpoint.index === 0\n\t\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t\t: ` (endpoint ${endpoint.index})`\n\t\t\t\t\t\t\t} does not support the Command Class ${ccName}!`,\n\t\t\t\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If a device config defines overrides for an API call, return a wrapper method that applies them first before calling the actual method\n\t\t\t\t\tconst fallback = target[property as keyof CCAPI];\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof property === \"string\"\n\t\t\t\t\t\t&& !endpoint.virtual\n\t\t\t\t\t\t&& typeof fallback === \"function\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst overrides = host.getDeviceConfig?.(\n\t\t\t\t\t\t\tendpoint.nodeId,\n\t\t\t\t\t\t)?.compat?.overrideQueries;\n\t\t\t\t\t\tif (overrides?.hasOverride(ccId)) {\n\t\t\t\t\t\t\treturn overrideQueriesWrapper(\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tendpoint,\n\t\t\t\t\t\t\t\tccId,\n\t\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\t\toverrides,\n\t\t\t\t\t\t\t\tfallback,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Else just access the property\n\t\t\t\t\treturn fallback;\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\t// @ts-expect-error TS doesn't like assigning to conditional types\n\t\t\treturn apiInstance;\n\t\t}\n\t}\n\n\t/**\n\t * The identifier of the Command Class this API is for\n\t */\n\tpublic readonly ccId: CommandClasses;\n\n\tprotected get [SET_VALUE](): SetValueImplementation | undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Can be used on supported CC APIs to set a CC value by property name (and optionally the property key).\n\t * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!\n\t */\n\tpublic get setValue(): SetValueImplementation | undefined {\n\t\treturn this[SET_VALUE];\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory | undefined;\n\t/**\n\t * Can be implemented by CC APIs to influence the behavior of the setValue API in regards to Supervision and verifying values.\n\t */\n\tpublic get setValueHooks(): SetValueImplementationHooksFactory | undefined {\n\t\treturn this[SET_VALUE_HOOKS];\n\t}\n\n\t/** Whether a successful setValue call should imply that the value was successfully updated */\n\t// oxlint-disable-next-line no-unused-vars\n\tpublic isSetValueOptimistic(valueId: ValueID): boolean {\n\t\treturn true;\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation | undefined {\n\t\treturn undefined;\n\t}\n\t/**\n\t * Can be used on supported CC APIs to poll a CC value by property name (and optionally the property key)\n\t * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!\n\t */\n\tpublic get pollValue(): PollValueImplementation | undefined {\n\t\treturn this[POLL_VALUE];\n\t}\n\n\t/**\n\t * Schedules a value to be polled after a given time. Schedules are deduplicated on a per-property basis.\n\t * @returns `true` if the poll was scheduled, `false` otherwise\n\t */\n\tprotected schedulePoll(\n\t\t{ property, propertyKey }: ValueIDProperties,\n\t\texpectedValue: unknown,\n\t\t{ duration, transition = \"slow\" }: CCAPISchedulePollOptions = {},\n\t): boolean {\n\t\t// Figure out the delay. If a non-zero duration was given or this is a \"fast\" transition,\n\t\t// use/add the short delay. Otherwise, default to the long delay.\n\t\tconst durationMs = duration?.toMilliseconds() ?? 0;\n\t\tconst timeouts = this.host.getRefreshValueTimeouts();\n\t\tconst additionalDelay = !!durationMs || transition === \"fast\"\n\t\t\t? timeouts.refreshValueAfterTransition\n\t\t\t: timeouts.refreshValue;\n\t\tconst timeoutMs = durationMs + additionalDelay;\n\n\t\tif (this.isSinglecast()) {\n\t\t\tconst node = this.host.getNode(this.endpoint.nodeId);\n\t\t\tif (!node) return false;\n\n\t\t\treturn this.host.schedulePoll(\n\t\t\t\tnode.id,\n\t\t\t\t{\n\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\tproperty,\n\t\t\t\t\tpropertyKey,\n\t\t\t\t},\n\t\t\t\t{ timeoutMs, expectedValue },\n\t\t\t);\n\t\t} else if (this.isMulticast()) {\n\t\t\t// Only poll supporting nodes in multicast\n\t\t\tconst supportingNodes = this.endpoint.node.physicalNodes.filter(\n\t\t\t\t(node) =>\n\t\t\t\t\tnode\n\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t?.supportsCC(this.ccId),\n\t\t\t);\n\t\t\tlet ret = false;\n\t\t\tfor (const node of supportingNodes) {\n\t\t\t\tret ||= this.host.schedulePoll(\n\t\t\t\t\tnode.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t},\n\t\t\t\t\t{ timeoutMs, expectedValue },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn ret;\n\t\t} else {\n\t\t\t// Don't poll the broadcast node\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the version of the given CommandClass this endpoint implements\n\t */\n\tpublic get version(): number {\n\t\tif (this.isSinglecast()) {\n\t\t\treturn this.host.getSafeCCVersion(\n\t\t\t\tthis.ccId,\n\t\t\t\tthis.endpoint.nodeId,\n\t\t\t\tthis.endpoint.index,\n\t\t\t) ?? 0;\n\t\t} else {\n\t\t\treturn getImplementedVersion(this.ccId);\n\t\t}\n\t}\n\n\t/** Determines if this simplified API instance may be used. */\n\tpublic isSupported(): boolean {\n\t\treturn (\n\t\t\t// NoOperation is always supported\n\t\t\tthis.ccId === CommandClasses[\"No Operation\"]\n\t\t\t// Basic should always be supported. Since we are trying to hide it from library consumers\n\t\t\t// we cannot trust supportsCC to test it\n\t\t\t|| this.ccId === CommandClasses.Basic\n\t\t\t|| this.endpoint.supportsCC(this.ccId)\n\t\t);\n\t}\n\n\t/**\n\t * Determine whether the linked node supports a specific command of this command class.\n\t * {@link NOT_KNOWN} (`undefined`) means that the information has not been received yet\n\t */\n\t// oxlint-disable-next-line no-unused-vars\n\tpublic supportsCommand(command: number): MaybeNotKnown<boolean> {\n\t\t// This needs to be overwritten per command class. In the default implementation, we don't know anything!\n\t\treturn NOT_KNOWN;\n\t}\n\n\tprotected assertSupportsCommand(\n\t\tcommandEnum: unknown,\n\t\tcommand: number,\n\t): void {\n\t\tif (this.supportsCommand(command) !== true) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`${\n\t\t\t\t\tthis.isSinglecast()\n\t\t\t\t\t\t? `Node #${this.endpoint.nodeId}`\n\t\t\t\t\t\t: \"This virtual node\"\n\t\t\t\t}${\n\t\t\t\t\tthis.endpoint.index > 0\n\t\t\t\t\t\t? ` (Endpoint ${this.endpoint.index})`\n\t\t\t\t\t\t: \"\"\n\t\t\t\t} does not support the command ${\n\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\tcommandEnum,\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t)\n\t\t\t\t}!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected assertPhysicalEndpoint(\n\t\tendpoint: EndpointId | VirtualEndpointId,\n\t): asserts endpoint is EndpointId {\n\t\tif (endpoint.virtual) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`This method is not supported for virtual nodes!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Returns the command options to use for sendCommand calls */\n\tprotected get commandOptions(): SendCommandOptions {\n\t\t// No default options\n\t\treturn {};\n\t}\n\n\t/** Creates an instance of this API, scoped to use the given options */\n\tpublic withOptions(options: SendCommandOptions): this {\n\t\tconst mergedOptions = {\n\t\t\t...this.commandOptions,\n\t\t\t...options,\n\t\t};\n\t\treturn new Proxy(this, {\n\t\t\tget: (target, property) => {\n\t\t\t\tif (property === \"commandOptions\") {\n\t\t\t\t\treturn mergedOptions;\n\t\t\t\t} else {\n\t\t\t\t\treturn (target as any)[property];\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/** Creates an instance of this API which (if supported) will return TX reports along with the result. */\n\tpublic withTXReport<T extends this>(): WithTXReport<T> {\n\t\tif (this.constructor === CCAPI) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The withTXReport method may only be called on specific CC API implementations.\",\n\t\t\t\tZWaveErrorCodes.Driver_NotSupported,\n\t\t\t);\n\t\t}\n\n\t\t// Remember which properties need to be proxied\n\t\tconst proxiedProps = new Set([\n\t\t\t// These are the CC-specific methods\n\t\t\t...Object.getOwnPropertyNames(this.constructor.prototype),\n\t\t\t// as well as setValue and pollValue\n\t\t\t\"setValue\",\n\t\t\t\"pollValue\",\n\t\t]);\n\t\tproxiedProps.delete(\"constructor\");\n\n\t\tfunction wrapResult<T>(result: T, txReport: TXReport): any {\n\t\t\t// Both the result and the TX report may be undefined (no response, no support)\n\t\t\treturn stripUndefined({\n\t\t\t\tresult,\n\t\t\t\ttxReport,\n\t\t\t});\n\t\t}\n\n\t\treturn new Proxy(this, {\n\t\t\tget: (target, prop) => {\n\t\t\t\tif (prop === \"withTXReport\") return undefined;\n\n\t\t\t\tlet original: any = (target as any)[prop];\n\t\t\t\tif (\n\t\t\t\t\tproxiedProps.has(prop as string)\n\t\t\t\t\t&& typeof original === \"function\"\n\t\t\t\t) {\n\t\t\t\t\t// This is a method that only exists in the specific implementation\n\n\t\t\t\t\t// Wrap each call with its own API proxy, so we don't mix up TX reports\n\t\t\t\t\tlet txReport: TXReport;\n\t\t\t\t\tconst api = target.withOptions({\n\t\t\t\t\t\tonTXReport: (report) => {\n\t\t\t\t\t\t\t// Remember the last status report\n\t\t\t\t\t\t\ttxReport = report;\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\toriginal = (api as any)[prop].bind(api);\n\n\t\t\t\t\t// Return a wrapper function that will add the status report after the call is complete\n\t\t\t\t\treturn (...args: any) => {\n\t\t\t\t\t\tlet result = original(...args);\n\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\tresult = result.then((res) =>\n\t\t\t\t\t\t\t\twrapResult(res, txReport)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult = wrapResult(result, txReport);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn original;\n\t\t\t\t}\n\t\t\t},\n\t\t}) as any;\n\t}\n\n\tprotected isSinglecast(): this is this & {\n\t\tendpoint: PhysicalCCAPIEndpoint;\n\t} {\n\t\treturn (\n\t\t\t!this.endpoint.virtual\n\t\t\t&& typeof this.endpoint.nodeId === \"number\"\n\t\t\t&& this.endpoint.nodeId !== NODE_ID_BROADCAST\n\t\t\t&& this.endpoint.nodeId !== NODE_ID_BROADCAST_LR\n\t\t);\n\t}\n\n\tprotected isMulticast(): this is this & {\n\t\tendpoint: VirtualCCAPIEndpoint & {\n\t\t\tnodeId: number[];\n\t\t};\n\t} {\n\t\treturn this.endpoint.virtual && isArray(this.endpoint.nodeId);\n\t}\n\n\tprotected isBroadcast(): this is this & {\n\t\tendpoint: VirtualCCAPIEndpoint & {\n\t\t\tnodeId: typeof NODE_ID_BROADCAST | typeof NODE_ID_BROADCAST_LR;\n\t\t};\n\t} {\n\t\treturn (\n\t\t\tthis.endpoint.virtual\n\t\t\t&& (this.endpoint.nodeId === NODE_ID_BROADCAST\n\t\t\t\t|| this.endpoint.nodeId === NODE_ID_BROADCAST_LR)\n\t\t);\n\t}\n\n\t/** Returns the value DB for this CC API's node (if it can be safely accessed) */\n\tprotected tryGetValueDB(): ValueDB | undefined {\n\t\tif (!this.isSinglecast()) return;\n\t\ttry {\n\t\t\treturn this.host.getValueDB(this.endpoint.nodeId);\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/** Returns the value DB for this CC's node (or throws if it cannot be accessed) */\n\tprotected getValueDB(): ValueDB {\n\t\tif (this.isSinglecast()) {\n\t\t\ttry {\n\t\t\t\treturn this.host.getValueDB(this.endpoint.nodeId);\n\t\t\t} catch {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\"The node for this CC does not exist or the driver is not ready yet\",\n\t\t\t\t\tZWaveErrorCodes.Driver_NotReady,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthrow new ZWaveError(\n\t\t\t\"Cannot retrieve the value DB for non-singlecast CCs\",\n\t\t\tZWaveErrorCodes.CC_NoNodeID,\n\t\t);\n\t}\n}\n\nfunction overrideQueriesWrapper(\n\tctx: GetValueDB & LogNode,\n\tendpoint: PhysicalCCAPIEndpoint,\n\tccId: CommandClasses,\n\tmethod: string,\n\toverrides: CompatOverrideQueries,\n\tfallback: (...args: any[]) => any,\n): (...args: any[]) => any {\n\t// We must not capture the `this` context here, because the API methods are bound on use\n\treturn function(this: any, ...args: any[]) {\n\t\tconst match = overrides.matchOverride(\n\t\t\tccId,\n\t\t\tendpoint.index,\n\t\t\tmethod,\n\t\t\targs,\n\t\t);\n\t\tif (!match) return fallback.call(this, ...args);\n\n\t\tctx.logNode(endpoint.nodeId, {\n\t\t\tmessage: `API call ${method} for ${\n\t\t\t\tgetCCName(\n\t\t\t\t\tccId,\n\t\t\t\t)\n\t\t\t} CC overridden by a compat flag.`,\n\t\t\tlevel: \"debug\",\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tconst ccValues = getCCValues(ccId);\n\t\tif (ccValues) {\n\t\t\tconst valueDB = ctx.getValueDB(endpoint.nodeId);\n\n\t\t\tconst prop2value = (prop: string): CCValue | undefined => {\n\t\t\t\t// We use a simplistic parser to support dynamic value IDs:\n\t\t\t\t// If end with round brackets with something inside, they are considered dynamic\n\t\t\t\t// Otherwise static\n\t\t\t\tconst argsMatch = prop.match(/^(.*)\\((.*)\\)$/);\n\t\t\t\tif (argsMatch) {\n\t\t\t\t\tconst methodName = argsMatch[1];\n\t\t\t\t\tconst methodArgs = JSON.parse(`[${argsMatch[2]}]`);\n\n\t\t\t\t\tconst dynValue = ccValues[methodName];\n\t\t\t\t\tif (typeof dynValue === \"function\") {\n\t\t\t\t\t\treturn dynValue(...methodArgs);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst staticValue = ccValues[prop] as\n\t\t\t\t\t\t| StaticCCValue\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (typeof staticValue?.endpoint === \"function\") {\n\t\t\t\t\t\treturn staticValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Persist values if necessary\n\t\t\tif (match.persistValues) {\n\t\t\t\tfor (\n\t\t\t\t\tconst [prop, value] of Object.entries(\n\t\t\t\t\t\tmatch.persistValues,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst ccValue = prop2value(prop);\n\t\t\t\t\t\tif (ccValue) {\n\t\t\t\t\t\t\tvalueDB.setValue(\n\t\t\t\t\t\t\t\tccValue.endpoint(endpoint.index),\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 {\n\t\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Failed to persist value ${prop} during overridden API call: value does not exist`,\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Failed to persist value ${prop} during overridden API call: ${\n\t\t\t\t\t\t\t\t\tgetErrorMessage(\n\t\t\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// As well as metadata\n\t\t\tif (match.extendMetadata) {\n\t\t\t\tfor (\n\t\t\t\t\tconst [prop, meta] of Object.entries(\n\t\t\t\t\t\tmatch.extendMetadata,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst ccValue = prop2value(prop);\n\t\t\t\t\t\tif (ccValue) {\n\t\t\t\t\t\t\tvalueDB.setMetadata(\n\t\t\t\t\t\t\t\tccValue.endpoint(endpoint.index),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...ccValue.meta,\n\t\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Failed to extend value metadata ${prop} during overridden API call: value does not exist`,\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Failed to extend value metadata ${prop} during overridden API call: ${\n\t\t\t\t\t\t\t\t\tgetErrorMessage(\n\t\t\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tdirection: \"none\",\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\n\t\t// API methods are always async\n\t\treturn Promise.resolve(match.result);\n\t};\n}\n\n/** A CC API that is only available for physical endpoints */\nexport class PhysicalCCAPI extends CCAPI {\n\tpublic constructor(\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t) {\n\t\tsuper(host, endpoint);\n\t\tthis.assertPhysicalEndpoint(endpoint);\n\t}\n\n\tdeclare protected readonly endpoint: PhysicalCCAPIEndpoint;\n}\n\nexport type APIConstructor<T extends CCAPI = CCAPI> = new (\n\thost: CCAPIHost,\n\tendpoint: CCAPIEndpoint,\n) => T;\n\n// This type is auto-generated by maintenance/generateCCAPIInterface.ts\n// Do not edit it by hand or your changes will be lost\ntype CCNameMap = {\n\t\"Alarm Sensor\": typeof CommandClasses[\"Alarm Sensor\"];\n\t\"Application Status\": typeof CommandClasses[\"Application Status\"];\n\tAssociation: typeof CommandClasses[\"Association\"];\n\t\"Association Group Information\":\n\t\ttypeof CommandClasses[\"Association Group Information\"];\n\t\"Barrier Operator\": typeof CommandClasses[\"Barrier Operator\"];\n\tBasic: typeof CommandClasses[\"Basic\"];\n\t\"Basic Window Covering\": typeof CommandClasses[\"Basic Window Covering\"];\n\tBattery: typeof CommandClasses[\"Battery\"];\n\t\"Binary Sensor\": typeof CommandClasses[\"Binary Sensor\"];\n\t\"Binary Switch\": typeof CommandClasses[\"Binary Switch\"];\n\t\"CRC-16 Encapsulation\": typeof CommandClasses[\"CRC-16 Encapsulation\"];\n\t\"Central Scene\": typeof CommandClasses[\"Central Scene\"];\n\t\"Climate Control Schedule\":\n\t\ttypeof CommandClasses[\"Climate Control Schedule\"];\n\tClock: typeof CommandClasses[\"Clock\"];\n\t\"Color Switch\": typeof CommandClasses[\"Color Switch\"];\n\tConfiguration: typeof CommandClasses[\"Configuration\"];\n\t\"Device Reset Locally\": typeof CommandClasses[\"Device Reset Locally\"];\n\t\"Door Lock\": typeof CommandClasses[\"Door Lock\"];\n\t\"Door Lock Logging\": typeof CommandClasses[\"Door Lock Logging\"];\n\t\"Energy Production\": typeof CommandClasses[\"Energy Production\"];\n\t\"Entry Control\": typeof CommandClasses[\"Entry Control\"];\n\t\"Firmware Update Meta Data\":\n\t\ttypeof CommandClasses[\"Firmware Update Meta Data\"];\n\t\"Humidity Control Mode\": typeof CommandClasses[\"Humidity Control Mode\"];\n\t\"Humidity Control Operating State\":\n\t\ttypeof CommandClasses[\"Humidity Control Operating State\"];\n\t\"Humidity Control Setpoint\":\n\t\ttypeof CommandClasses[\"Humidity Control Setpoint\"];\n\t\"Inclusion Controller\": typeof CommandClasses[\"Inclusion Controller\"];\n\tIndicator: typeof CommandClasses[\"Indicator\"];\n\tIrrigation: typeof CommandClasses[\"Irrigation\"];\n\tLanguage: typeof CommandClasses[\"Language\"];\n\tLock: typeof CommandClasses[\"Lock\"];\n\t\"Manufacturer Proprietary\":\n\t\ttypeof CommandClasses[\"Manufacturer Proprietary\"];\n\t\"Manufacturer Specific\": typeof CommandClasses[\"Manufacturer Specific\"];\n\tMeter: typeof CommandClasses[\"Meter\"];\n\t\"Multi Channel Association\":\n\t\ttypeof CommandClasses[\"Multi Channel Association\"];\n\t\"Multi Channel\": typeof CommandClasses[\"Multi Channel\"];\n\t\"Multi Command\": typeof CommandClasses[\"Multi Command\"];\n\t\"Multilevel Sensor\": typeof CommandClasses[\"Multilevel Sensor\"];\n\t\"Multilevel Switch\": typeof CommandClasses[\"Multilevel Switch\"];\n\t\"No Operation\": typeof CommandClasses[\"No Operation\"];\n\t\"Node Naming and Location\":\n\t\ttypeof CommandClasses[\"Node Naming and Location\"];\n\tNotification: typeof CommandClasses[\"Notification\"];\n\tPowerlevel: typeof CommandClasses[\"Powerlevel\"];\n\tProtection: typeof CommandClasses[\"Protection\"];\n\t\"Scene Activation\": typeof CommandClasses[\"Scene Activation\"];\n\t\"Scene Actuator Configuration\":\n\t\ttypeof CommandClasses[\"Scene Actuator Configuration\"];\n\t\"Scene Controller Configuration\":\n\t\ttypeof CommandClasses[\"Scene Controller Configuration\"];\n\t\"Schedule Entry Lock\": typeof CommandClasses[\"Schedule Entry Lock\"];\n\t\"Security 2\": typeof CommandClasses[\"Security 2\"];\n\tSecurity: typeof CommandClasses[\"Security\"];\n\t\"Sound Switch\": typeof CommandClasses[\"Sound Switch\"];\n\tSupervision: typeof CommandClasses[\"Supervision\"];\n\t\"Thermostat Fan Mode\": typeof CommandClasses[\"Thermostat Fan Mode\"];\n\t\"Thermostat Fan State\": typeof CommandClasses[\"Thermostat Fan State\"];\n\t\"Thermostat Mode\": typeof CommandClasses[\"Thermostat Mode\"];\n\t\"Thermostat Operating State\":\n\t\ttypeof CommandClasses[\"Thermostat Operating State\"];\n\t\"Thermostat Setback\": typeof CommandClasses[\"Thermostat Setback\"];\n\t\"Thermostat Setpoint\": typeof CommandClasses[\"Thermostat Setpoint\"];\n\tTime: typeof CommandClasses[\"Time\"];\n\t\"Time Parameters\": typeof CommandClasses[\"Time Parameters\"];\n\t\"User Code\": typeof CommandClasses[\"User Code\"];\n\tVersion: typeof CommandClasses[\"Version\"];\n\t\"Wake Up\": typeof CommandClasses[\"Wake Up\"];\n\t\"Window Covering\": typeof CommandClasses[\"Window Covering\"];\n\t\"Z-Wave Plus Info\": typeof CommandClasses[\"Z-Wave Plus Info\"];\n};\nexport type CCToName<CC extends CommandClasses> = {\n\t[K in keyof CCNameMap]: CCNameMap[K] extends CC ? K : never;\n}[keyof CCNameMap];\n\nexport type CCNameOrId = CommandClasses | Extract<keyof CCAPIs, string>;\n\nexport type CCToAPI<CC extends CCNameOrId> = CC extends CommandClasses\n\t? CCToName<CC> extends keyof CCAPIs ? CCAPIs[CCToName<CC>]\n\t: never\n\t: CC extends keyof CCAPIs ? CCAPIs[CC]\n\t: never;\n\nexport type APIMethodsOf<CC extends CCNameOrId> = Omit<\n\tOnlyMethods<CCToAPI<CC>>,\n\t| \"ccId\"\n\t| \"getNode\"\n\t| \"tryGetNode\"\n\t| \"isSetValueOptimistic\"\n\t| \"isSupported\"\n\t| \"pollValue\"\n\t| \"setValue\"\n\t| \"version\"\n\t| \"supportsCommand\"\n\t| \"withOptions\"\n\t| \"withTXReport\"\n>;\n\nexport type OwnMethodsOf<API extends CCAPI> = Omit<\n\tOnlyMethods<API>,\n\tkeyof OnlyMethods<CCAPI>\n>;\n\n// Wraps the given type in an object that contains a TX report\nexport type WrapWithTXReport<T> = [T] extends [Promise<infer U>]\n\t? Promise<WrapWithTXReport<U>>\n\t: [T] extends [void] ? { txReport: TXReport | undefined }\n\t: { result: T; txReport: TXReport | undefined };\n\nexport type ReturnWithTXReport<T> = T extends (...args: any[]) => any\n\t? (...args: Parameters<T>) => WrapWithTXReport<ReturnType<T>>\n\t: undefined;\n\n// Converts the type of the given API implementation so the API methods return an object including the TX report\nexport type WithTXReport<API extends CCAPI> =\n\t& Omit<\n\t\tAPI,\n\t\tkeyof OwnMethodsOf<API> | \"withOptions\" | \"withTXReport\" | \"setValue\"\n\t>\n\t& {\n\t\t[\n\t\t\tK in\n\t\t\t\t| keyof OwnMethodsOf<API>\n\t\t\t\t| \"setValue\"\n\t\t\t\t| \"pollValue\"\n\t\t]: ReturnWithTXReport<API[K]>;\n\t};\n\nexport function normalizeCCNameOrId(\n\tccNameOrId: number | string,\n): CommandClasses | undefined {\n\tif (!(ccNameOrId in CommandClasses)) return undefined;\n\n\tlet ret: CommandClasses | undefined;\n\tif (typeof ccNameOrId === \"string\") {\n\t\tif (/^\\d+$/.test(ccNameOrId)) {\n\t\t\t// This can happen on property access\n\t\t\tret = +ccNameOrId;\n\t\t} else if (typeof (CommandClasses as any)[ccNameOrId] === \"number\") {\n\t\t\tret = (CommandClasses as any)[ccNameOrId];\n\t\t}\n\t} else {\n\t\tret = ccNameOrId;\n\t}\n\n\treturn ret;\n}\n\n// This interface is auto-generated by maintenance/generateCCAPIInterface.ts\n// Do not edit it by hand or your changes will be lost\nexport interface CCAPIs {\n\t[Symbol.iterator](): Iterator<CCAPI>;\n\n\t// AUTO GENERATION BELOW\n\t\"Alarm Sensor\": import(\"../cc/AlarmSensorCC.js\").AlarmSensorCCAPI;\n\t\"Application Status\":\n\t\timport(\"../cc/ApplicationStatusCC.js\").ApplicationStatusCCAPI;\n\tAssociation: import(\"../cc/AssociationCC.js\").AssociationCCAPI;\n\t\"Association Group Information\":\n\t\timport(\"../cc/AssociationGroupInfoCC.js\").AssociationGroupInfoCCAPI;\n\t\"Barrier Operator\":\n\t\timport(\"../cc/BarrierOperatorCC.js\").BarrierOperatorCCAPI;\n\tBasic: import(\"../cc/BasicCC.js\").BasicCCAPI;\n\t\"Basic Window Covering\":\n\t\timport(\"../cc/BasicWindowCoveringCC.js\").BasicWindowCoveringCCAPI;\n\tBattery: import(\"../cc/BatteryCC.js\").BatteryCCAPI;\n\t\"Binary Sensor\": import(\"../cc/BinarySensorCC.js\").BinarySensorCCAPI;\n\t\"Binary Switch\": import(\"../cc/BinarySwitchCC.js\").BinarySwitchCCAPI;\n\t\"CRC-16 Encapsulation\": import(\"../cc/CRC16CC.js\").CRC16CCAPI;\n\t\"Central Scene\": import(\"../cc/CentralSceneCC.js\").CentralSceneCCAPI;\n\t\"Climate Control Schedule\":\n\t\timport(\"../cc/ClimateControlScheduleCC.js\").ClimateControlScheduleCCAPI;\n\tClock: import(\"../cc/ClockCC.js\").ClockCCAPI;\n\t\"Color Switch\": import(\"../cc/ColorSwitchCC.js\").ColorSwitchCCAPI;\n\tConfiguration: import(\"../cc/ConfigurationCC.js\").ConfigurationCCAPI;\n\t\"Device Reset Locally\":\n\t\timport(\"../cc/DeviceResetLocallyCC.js\").DeviceResetLocallyCCAPI;\n\t\"Door Lock\": import(\"../cc/DoorLockCC.js\").DoorLockCCAPI;\n\t\"Door Lock Logging\":\n\t\timport(\"../cc/DoorLockLoggingCC.js\").DoorLockLoggingCCAPI;\n\t\"Energy Production\":\n\t\timport(\"../cc/EnergyProductionCC.js\").EnergyProductionCCAPI;\n\t\"Entry Control\": import(\"../cc/EntryControlCC.js\").EntryControlCCAPI;\n\t\"Firmware Update Meta Data\":\n\t\timport(\"../cc/FirmwareUpdateMetaDataCC.js\").FirmwareUpdateMetaDataCCAPI;\n\t\"Humidity Control Mode\":\n\t\timport(\"../cc/HumidityControlModeCC.js\").HumidityControlModeCCAPI;\n\t\"Humidity Control Operating State\":\n\t\timport(\"../cc/HumidityControlOperatingStateCC.js\").HumidityControlOperatingStateCCAPI;\n\t\"Humidity Control Setpoint\":\n\t\timport(\"../cc/HumidityControlSetpointCC.js\").HumidityControlSetpointCCAPI;\n\t\"Inclusion Controller\":\n\t\timport(\"../cc/InclusionControllerCC.js\").InclusionControllerCCAPI;\n\tIndicator: import(\"../cc/IndicatorCC.js\").IndicatorCCAPI;\n\tIrrigation: import(\"../cc/IrrigationCC.js\").IrrigationCCAPI;\n\tLanguage: import(\"../cc/LanguageCC.js\").LanguageCCAPI;\n\tLock: import(\"../cc/LockCC.js\").LockCCAPI;\n\t\"Manufacturer Proprietary\":\n\t\timport(\"../cc/ManufacturerProprietaryCC.js\").ManufacturerProprietaryCCAPI;\n\t\"Manufacturer Specific\":\n\t\timport(\"../cc/ManufacturerSpecificCC.js\").ManufacturerSpecificCCAPI;\n\tMeter: import(\"../cc/MeterCC.js\").MeterCCAPI;\n\t\"Multi Channel Association\":\n\t\timport(\"../cc/MultiChannelAssociationCC.js\").MultiChannelAssociationCCAPI;\n\t\"Multi Channel\": import(\"../cc/MultiChannelCC.js\").MultiChannelCCAPI;\n\t\"Multi Command\": import(\"../cc/MultiCommandCC.js\").MultiCommandCCAPI;\n\t\"Multilevel Sensor\":\n\t\timport(\"../cc/MultilevelSensorCC.js\").MultilevelSensorCCAPI;\n\t\"Multilevel Switch\":\n\t\timport(\"../cc/MultilevelSwitchCC.js\").MultilevelSwitchCCAPI;\n\t\"No Operation\": import(\"../cc/NoOperationCC.js\").NoOperationCCAPI;\n\t\"Node Naming and Location\":\n\t\timport(\"../cc/NodeNamingCC.js\").NodeNamingAndLocationCCAPI;\n\tNotification: import(\"../cc/NotificationCC.js\").NotificationCCAPI;\n\tPowerlevel: import(\"../cc/PowerlevelCC.js\").PowerlevelCCAPI;\n\tProtection: import(\"../cc/ProtectionCC.js\").ProtectionCCAPI;\n\t\"Scene Activation\":\n\t\timport(\"../cc/SceneActivationCC.js\").SceneActivationCCAPI;\n\t\"Scene Actuator Configuration\":\n\t\timport(\"../cc/SceneActuatorConfigurationCC.js\").SceneActuatorConfigurationCCAPI;\n\t\"Scene Controller Configuration\":\n\t\timport(\"../cc/SceneControllerConfigurationCC.js\").SceneControllerConfigurationCCAPI;\n\t\"Schedule Entry Lock\":\n\t\timport(\"../cc/ScheduleEntryLockCC.js\").ScheduleEntryLockCCAPI;\n\t\"Security 2\": import(\"../cc/Security2CC.js\").Security2CCAPI;\n\tSecurity: import(\"../cc/SecurityCC.js\").SecurityCCAPI;\n\t\"Sound Switch\": import(\"../cc/SoundSwitchCC.js\").SoundSwitchCCAPI;\n\tSupervision: import(\"../cc/SupervisionCC.js\").SupervisionCCAPI;\n\t\"Thermostat Fan Mode\":\n\t\timport(\"../cc/ThermostatFanModeCC.js\").ThermostatFanModeCCAPI;\n\t\"Thermostat Fan State\":\n\t\timport(\"../cc/ThermostatFanStateCC.js\").ThermostatFanStateCCAPI;\n\t\"Thermostat Mode\": import(\"../cc/ThermostatModeCC.js\").ThermostatModeCCAPI;\n\t\"Thermostat Operating State\":\n\t\timport(\"../cc/ThermostatOperatingStateCC.js\").ThermostatOperatingStateCCAPI;\n\t\"Thermostat Setback\":\n\t\timport(\"../cc/ThermostatSetbackCC.js\").ThermostatSetbackCCAPI;\n\t\"Thermostat Setpoint\":\n\t\timport(\"../cc/ThermostatSetpointCC.js\").ThermostatSetpointCCAPI;\n\tTime: import(\"../cc/TimeCC.js\").TimeCCAPI;\n\t\"Time Parameters\": import(\"../cc/TimeParametersCC.js\").TimeParametersCCAPI;\n\t\"User Code\": import(\"../cc/UserCodeCC.js\").UserCodeCCAPI;\n\tVersion: import(\"../cc/VersionCC.js\").VersionCCAPI;\n\t\"Wake Up\": import(\"../cc/WakeUpCC.js\").WakeUpCCAPI;\n\t\"Window Covering\": import(\"../cc/WindowCoveringCC.js\").WindowCoveringCCAPI;\n\t\"Z-Wave Plus Info\": import(\"../cc/ZWavePlusCC.js\").ZWavePlusCCAPI;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;AAAA,kBAkCO;AACP,oBAMO;AACP,wBAAwB;AACxB,oCAKO;AAWA,MAAM,YAA2B,OAAO,IAAI,iBAAiB;AAQ7D,MAAM,kBAAiC,OAAO,IACpD,uBAAuB;AAqCjB,MAAM,aAA4B,OAAO,IAAI,kBAAkB;AAOhE,SAAU,yBACf,IACA,UAAyB;AAEzB,QAAM,IAAI,uBACT,GAAG,2BAAe,EAAE,CAAC,MAAM,QAAQ,iCACnC,4BAAgB,gBAAgB;AAElC;AARgB;AAUV,SAAU,4BACf,IACA,UACA,aAA4B;AAE5B,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,MAAM,WAAW,mDAAmD,QAAQ,KAC5E,4BAAgB,gBAAgB;AAElC;AAXgB;AAaV,SAAU,wBACf,IACA,UAAyB;AAEzB,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,eAAe,QAAQ,iDACvB,4BAAgB,gBAAgB;AAElC;AAVgB;AAYV,SAAU,oBACf,IACA,UACA,cACA,cAAoB;AAEpB,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,MAAM,QAAQ,sBAAsB,YAAY,gBAA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13 @@ export declare function getAllAssociations(ctx: GetValueDB, node: NodeId & GetAl
8
8
  export declare function checkAssociation(ctx: HostIDs & GetValueDB & GetNode<NodeId & SupportsCC & GetEndpoint<EndpointId & SupportsCC> & QuerySecurityClasses>, endpoint: EndpointId & SupportsCC & ControlsCC, group: number, destination: AssociationAddress): AssociationCheckResult;
9
9
  export declare function getAssociationGroups(ctx: GetValueDB & GetDeviceConfig, endpoint: EndpointId & SupportsCC): ReadonlyMap<number, AssociationGroup>;
10
10
  export declare function getAllAssociationGroups(ctx: GetValueDB & GetDeviceConfig, node: NodeId & GetAllEndpoints<EndpointId & SupportsCC>): ReadonlyMap<number, ReadonlyMap<number, AssociationGroup>>;
11
- export declare function addAssociations(ctx: CCAPIHost<CCAPINode & SupportsCC & GetEndpoint<EndpointId & SupportsCC> & QuerySecurityClasses>, endpoint: EndpointId & SupportsCC & ControlsCC, group: number, destinations: AssociationAddress[]): Promise<void>;
11
+ export declare function addAssociations(ctx: CCAPIHost<CCAPINode & SupportsCC & GetEndpoint<EndpointId & SupportsCC> & QuerySecurityClasses>, endpoint: EndpointId & SupportsCC & ControlsCC, group: number, destinations: AssociationAddress[], options?: {
12
+ /**
13
+ * Whether to force creating associations even if they are not allowed.
14
+ * **Note:** Invalid associations will most likely not work
15
+ */
16
+ force?: boolean;
17
+ }): Promise<void>;
12
18
  export declare function removeAssociations(ctx: CCAPIHost, endpoint: EndpointId & SupportsCC & ControlsCC, group: number, destinations: AssociationAddress[]): Promise<void>;
13
19
  export declare function getLifelineGroupIds(ctx: GetValueDB & GetDeviceConfig, endpoint: EndpointId & SupportsCC): number[];
14
20
  export declare function configureLifelineAssociations(ctx: CCAPIHost<CCAPINode & SupportsCC & ControlsCC & GetAllEndpoints<EndpointId & SupportsCC & ControlsCC>>, endpoint: EndpointId & SupportsCC & ControlsCC): Promise<void>;
@@ -199,7 +199,7 @@ function getAllAssociationGroups(ctx, node) {
199
199
  return ret;
200
200
  }
201
201
  __name(getAllAssociationGroups, "getAllAssociationGroups");
202
- async function addAssociations(ctx, endpoint, group, destinations) {
202
+ async function addAssociations(ctx, endpoint, group, destinations, options) {
203
203
  const nodeAndEndpointString = `${endpoint.nodeId}${endpoint.index > 0 ? `, endpoint ${endpoint.index}` : ""}`;
204
204
  let assocInstance;
205
205
  let mcInstance;
@@ -231,15 +231,17 @@ async function addAssociations(ctx, endpoint, group, destinations) {
231
231
  const deviceConfig = ctx.getDeviceConfig?.(endpoint.nodeId);
232
232
  const groupIsMultiChannel = !!mcInstance && group <= mcGroupCount && deviceConfig?.associations?.get(group)?.multiChannel !== false;
233
233
  if (groupIsMultiChannel) {
234
- const disallowedAssociations = destinations.map((a) => ({
235
- ...a,
236
- checkResult: checkAssociation(ctx, endpoint, group, a)
237
- })).filter(({ checkResult }) => checkResult !== import_Types.AssociationCheckResult.OK);
238
- if (disallowedAssociations.length) {
239
- let message = `The following associations are not allowed:`;
240
- message += disallowedAssociations.map((a) => `
234
+ if (!options?.force) {
235
+ const disallowedAssociations = destinations.map((a) => ({
236
+ ...a,
237
+ checkResult: checkAssociation(ctx, endpoint, group, a)
238
+ })).filter(({ checkResult }) => checkResult !== import_Types.AssociationCheckResult.OK);
239
+ if (disallowedAssociations.length) {
240
+ let message = `The following associations are not allowed:`;
241
+ message += disallowedAssociations.map((a) => `
241
242
  \xB7 Node ${a.nodeId}${a.endpoint ? `, endpoint ${a.endpoint}` : ""}: ${(0, import_shared.getEnumMemberName)(import_Types.AssociationCheckResult, a.checkResult).replace("Forbidden_", "")}`).join("");
242
- throw new import_core.ZWaveError(message, import_core.ZWaveErrorCodes.AssociationCC_NotAllowed, disallowedAssociations);
243
+ throw new import_core.ZWaveError(message, import_core.ZWaveErrorCodes.AssociationCC_NotAllowed, disallowedAssociations);
244
+ }
243
245
  }
244
246
  const api = import_API.CCAPI.create(import_core.CommandClasses["Multi Channel Association"], ctx, endpoint);
245
247
  await api.addDestinations({
@@ -252,15 +254,17 @@ async function addAssociations(ctx, endpoint, group, destinations) {
252
254
  if (destinations.some((a) => a.endpoint != void 0)) {
253
255
  throw new import_core.ZWaveError(`Node ${nodeAndEndpointString}, group ${group} does not support multi channel associations!`, import_core.ZWaveErrorCodes.CC_NotSupported);
254
256
  }
255
- const disallowedAssociations = destinations.map((a) => ({
256
- ...a,
257
- checkResult: checkAssociation(ctx, endpoint, group, a)
258
- })).filter(({ checkResult }) => checkResult !== import_Types.AssociationCheckResult.OK);
259
- if (disallowedAssociations.length) {
260
- let message = `The associations to the following nodes are not allowed`;
261
- message += disallowedAssociations.map((a) => `
257
+ if (!options?.force) {
258
+ const disallowedAssociations = destinations.map((a) => ({
259
+ ...a,
260
+ checkResult: checkAssociation(ctx, endpoint, group, a)
261
+ })).filter(({ checkResult }) => checkResult !== import_Types.AssociationCheckResult.OK);
262
+ if (disallowedAssociations.length) {
263
+ let message = `The associations to the following nodes are not allowed`;
264
+ message += disallowedAssociations.map((a) => `
262
265
  \xB7 Node ${a.nodeId}: ${(0, import_shared.getEnumMemberName)(import_Types.AssociationCheckResult, a.checkResult).replace("Forbidden_", "")}`).join("");
263
- throw new import_core.ZWaveError(message, import_core.ZWaveErrorCodes.AssociationCC_NotAllowed, disallowedAssociations);
266
+ throw new import_core.ZWaveError(message, import_core.ZWaveErrorCodes.AssociationCC_NotAllowed, disallowedAssociations);
267
+ }
264
268
  }
265
269
  const api = import_API.CCAPI.create(import_core.CommandClasses.Association, ctx, endpoint);
266
270
  await api.addNodeIds(group, ...destinations.map((a) => a.nodeId));