@zwave-js/cc 15.16.0 → 15.18.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/AlarmSensorCC.js +1 -1
- package/build/cjs/cc/AlarmSensorCC.js.map +1 -1
- package/build/cjs/cc/ApplicationStatusCC.d.ts +33 -0
- package/build/cjs/cc/ApplicationStatusCC.js +229 -0
- package/build/cjs/cc/ApplicationStatusCC.js.map +7 -0
- package/build/cjs/cc/AssociationCC.js.map +1 -1
- package/build/cjs/cc/AssociationGroupInfoCC.js +4 -4
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.js +9 -2
- package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
- package/build/cjs/cc/BasicCC.js +1 -1
- package/build/cjs/cc/BasicCC.js.map +1 -1
- package/build/cjs/cc/BatteryCC.js +2 -2
- package/build/cjs/cc/BatteryCC.js.map +1 -1
- package/build/cjs/cc/BinarySwitchCC.js +1 -1
- package/build/cjs/cc/BinarySwitchCC.js.map +1 -1
- package/build/cjs/cc/CRC16CC.js +2 -2
- package/build/cjs/cc/CRC16CC.js.map +2 -2
- package/build/cjs/cc/CentralSceneCC.js +2 -2
- package/build/cjs/cc/CentralSceneCC.js.map +1 -1
- package/build/cjs/cc/ClimateControlScheduleCC.js +5 -5
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ClockCC.js +1 -1
- package/build/cjs/cc/ClockCC.js.map +1 -1
- package/build/cjs/cc/ColorSwitchCC.js.map +1 -1
- package/build/cjs/cc/ConfigurationCC.js +10 -3
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/DoorLockCC.js +3 -3
- package/build/cjs/cc/DoorLockCC.js.map +1 -1
- package/build/cjs/cc/EntryControlCC.js +3 -6
- package/build/cjs/cc/EntryControlCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.js +5 -5
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.js +3 -3
- package/build/cjs/cc/IrrigationCC.js.map +1 -1
- package/build/cjs/cc/LanguageCC.js +1 -1
- package/build/cjs/cc/LanguageCC.js.map +1 -1
- package/build/cjs/cc/ManufacturerProprietaryCC.js +1 -1
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.js +1 -1
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/cjs/cc/MeterCC.js +3 -3
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/cjs/cc/MultiChannelCC.js +8 -8
- package/build/cjs/cc/MultiChannelCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSensorCC.js.map +1 -1
- package/build/cjs/cc/MultilevelSwitchCC.js +1 -1
- package/build/cjs/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/cjs/cc/NotificationCC.js +29 -23
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/ProtectionCC.js +10 -3
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +0 -1
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.js +0 -1
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.js +1 -1
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/cjs/cc/Security2CC.js +6 -5
- package/build/cjs/cc/Security2CC.js.map +2 -2
- package/build/cjs/cc/SecurityCC.js +3 -3
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC._validateArgs.js +1 -1
- package/build/cjs/cc/SoundSwitchCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/SoundSwitchCC.d.ts +7 -3
- package/build/cjs/cc/SoundSwitchCC.js +6 -6
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/SupervisionCC.js +1 -1
- package/build/cjs/cc/SupervisionCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanModeCC.js +1 -1
- package/build/cjs/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/cjs/cc/ThermostatFanStateCC.js +1 -1
- package/build/cjs/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/cjs/cc/ThermostatModeCC.js +2 -2
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetbackCC.js +1 -1
- package/build/cjs/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/cjs/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/cjs/cc/TimeCC.js +2 -2
- package/build/cjs/cc/TimeCC.js.map +1 -1
- package/build/cjs/cc/TransportServiceCC.js +1 -1
- package/build/cjs/cc/TransportServiceCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC.d.ts +9 -1
- package/build/cjs/cc/UserCodeCC.js +50 -8
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.js +3 -3
- package/build/cjs/cc/VersionCC.js.map +1 -1
- package/build/cjs/cc/WakeUpCC.js +2 -2
- package/build/cjs/cc/WakeUpCC.js.map +1 -1
- package/build/cjs/cc/WindowCoveringCC.d.ts +3 -1
- package/build/cjs/cc/WindowCoveringCC.js +28 -8
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.js +1 -1
- package/build/cjs/cc/ZWavePlusCC.js.map +1 -1
- package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.js.map +1 -1
- package/build/cjs/cc/index.d.ts +3 -0
- package/build/cjs/cc/index.js +553 -65
- package/build/cjs/cc/index.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/cjs/lib/API.d.ts +2 -0
- package/build/cjs/lib/API.js +2 -2
- package/build/cjs/lib/API.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +3 -3
- package/build/cjs/lib/CommandClass.js +6 -6
- package/build/cjs/lib/CommandClass.js.map +2 -2
- package/build/cjs/lib/_Types.d.ts +9 -0
- package/build/cjs/lib/_Types.js +15 -0
- package/build/cjs/lib/_Types.js.map +3 -3
- package/build/cjs/lib/utils.js +1 -1
- package/build/cjs/lib/utils.js.map +2 -2
- package/build/esm/cc/AlarmSensorCC.js +1 -1
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/ApplicationStatusCC.d.ts +33 -0
- package/build/esm/cc/ApplicationStatusCC.d.ts.map +1 -0
- package/build/esm/cc/ApplicationStatusCC.js +175 -0
- package/build/esm/cc/ApplicationStatusCC.js.map +1 -0
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +4 -4
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +13 -2
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.js +1 -1
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.js +2 -2
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +1 -1
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.d.ts.map +1 -1
- package/build/esm/cc/CRC16CC.js +2 -2
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +2 -2
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +5 -5
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.js +1 -1
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +12 -4
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.js +3 -3
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +4 -6
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +6 -6
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.js +3 -3
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.js +1 -1
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +3 -3
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +8 -8
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +43 -31
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +16 -3
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +0 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +0 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +6 -5
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +3 -3
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC._validateArgs.js +1 -1
- package/build/esm/cc/SoundSwitchCC._validateArgs.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts +7 -3
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +6 -6
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.js +1 -1
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +2 -2
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/TimeCC.js +2 -2
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +2 -1
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts +9 -1
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +61 -12
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.js +3 -3
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.js +2 -2
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts +3 -1
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +30 -9
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +1 -1
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/index.d.ts +3 -0
- package/build/esm/cc/index.d.ts.map +1 -1
- package/build/esm/cc/index.js +548 -524
- package/build/esm/cc/index.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/API.d.ts +2 -0
- package/build/esm/lib/API.d.ts.map +1 -1
- package/build/esm/lib/API.js +2 -2
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +3 -3
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +6 -6
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/_Types.d.ts +9 -0
- package/build/esm/lib/_Types.d.ts.map +1 -1
- package/build/esm/lib/_Types.js +11 -0
- package/build/esm/lib/_Types.js.map +1 -1
- package/build/esm/lib/utils.js +1 -1
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +10 -11
- package/build/cjs/lib/ICommandClassContainer.d.ts +0 -2
- package/build/cjs/lib/ICommandClassContainer.js +0 -17
- package/build/cjs/lib/ICommandClassContainer.js.map +0 -7
- package/build/esm/lib/ICommandClassContainer.d.ts +0 -2
- package/build/esm/lib/ICommandClassContainer.d.ts.map +0 -1
- package/build/esm/lib/ICommandClassContainer.js +0 -2
- package/build/esm/lib/ICommandClassContainer.js.map +0 -1
package/build/cjs/lib/API.js.map
CHANGED
|
@@ -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// eslint-disable-next-line @typescript-eslint/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// eslint-disable-next-line @typescript-eslint/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\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\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;;;;;;;;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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;;
|
|
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;;;;;;;;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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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -182,8 +182,8 @@ export declare class CommandClass implements CCId {
|
|
|
182
182
|
/** Include previously received partial responses into a final CC */
|
|
183
183
|
mergePartialCCs(_partials: CommandClass[], _ctx: CCParsingContext): Promise<void>;
|
|
184
184
|
/** Tests whether this CC expects at least one command in return */
|
|
185
|
-
expectsCCResponse(): boolean;
|
|
186
|
-
isExpectedCCResponse(received: CommandClass): boolean;
|
|
185
|
+
expectsCCResponse(ctx: GetNode<NodeId & SupportsCC>): boolean;
|
|
186
|
+
isExpectedCCResponse(ctx: GetNode<NodeId & SupportsCC>, received: CommandClass): boolean;
|
|
187
187
|
/**
|
|
188
188
|
* Translates a property identifier into a speaking name for use in an external API
|
|
189
189
|
* @param property The property identifier that should be translated
|
|
@@ -225,7 +225,7 @@ export type CCConstructor<T extends CommandClass> = typeof CommandClass & {
|
|
|
225
225
|
* @publicAPI
|
|
226
226
|
* May be used to define different expected CC responses depending on the sent CC
|
|
227
227
|
*/
|
|
228
|
-
export type DynamicCCResponse<TSent extends CommandClass, TReceived extends CommandClass = CommandClass> = (sentCC: TSent) => CCConstructor<TReceived> | CCConstructor<TReceived>[] | undefined;
|
|
228
|
+
export type DynamicCCResponse<TSent extends CommandClass, TReceived extends CommandClass = CommandClass> = (ctx: GetNode<NodeId & SupportsCC>, sentCC: TSent) => CCConstructor<TReceived> | CCConstructor<TReceived>[] | undefined;
|
|
229
229
|
/** @publicAPI */
|
|
230
230
|
export type CCResponseRole = boolean | "checkEncapsulated";
|
|
231
231
|
/**
|
|
@@ -180,7 +180,7 @@ class CommandClass {
|
|
|
180
180
|
/**
|
|
181
181
|
* Serializes this CommandClass to be embedded in a message payload or another CC
|
|
182
182
|
*/
|
|
183
|
-
//
|
|
183
|
+
// oxlint-disable-next-line no-unused-vars, @typescript-eslint/require-await
|
|
184
184
|
async serialize(ctx) {
|
|
185
185
|
if (this.ccId === import_core.CommandClasses["No Operation"]) {
|
|
186
186
|
return import_shared.Bytes.from([this.ccId]);
|
|
@@ -560,10 +560,10 @@ class CommandClass {
|
|
|
560
560
|
async mergePartialCCs(_partials, _ctx) {
|
|
561
561
|
}
|
|
562
562
|
/** Tests whether this CC expects at least one command in return */
|
|
563
|
-
expectsCCResponse() {
|
|
563
|
+
expectsCCResponse(ctx) {
|
|
564
564
|
let expected = (0, import_CommandClassDecorators.getExpectedCCResponse)(this);
|
|
565
565
|
if (typeof expected === "function" && !(0, import_shared.staticExtends)(expected, CommandClass)) {
|
|
566
|
-
expected = expected(this);
|
|
566
|
+
expected = expected(ctx, this);
|
|
567
567
|
}
|
|
568
568
|
if (expected === void 0)
|
|
569
569
|
return false;
|
|
@@ -573,12 +573,12 @@ class CommandClass {
|
|
|
573
573
|
return (0, import_shared.staticExtends)(expected, CommandClass);
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
isExpectedCCResponse(received) {
|
|
576
|
+
isExpectedCCResponse(ctx, received) {
|
|
577
577
|
if (received.nodeId !== this.nodeId)
|
|
578
578
|
return false;
|
|
579
579
|
let expected = (0, import_CommandClassDecorators.getExpectedCCResponse)(this);
|
|
580
580
|
if (typeof expected === "function" && !(0, import_shared.staticExtends)(expected, CommandClass)) {
|
|
581
|
-
expected = expected(this);
|
|
581
|
+
expected = expected(ctx, this);
|
|
582
582
|
}
|
|
583
583
|
if (expected == void 0) {
|
|
584
584
|
return false;
|
|
@@ -594,7 +594,7 @@ class CommandClass {
|
|
|
594
594
|
const ret = predicate?.(this, received) ?? true;
|
|
595
595
|
if (ret === "checkEncapsulated") {
|
|
596
596
|
if ((0, import_EncapsulatingCommandClass.isEncapsulatingCommandClass)(this) && (0, import_EncapsulatingCommandClass.isEncapsulatingCommandClass)(received)) {
|
|
597
|
-
return this.encapsulated.isExpectedCCResponse(received.encapsulated);
|
|
597
|
+
return this.encapsulated.isExpectedCCResponse(ctx, received.encapsulated);
|
|
598
598
|
} else {
|
|
599
599
|
return false;
|
|
600
600
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/CommandClass.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport type { GetDeviceConfig, LookupManufacturer } from \"@zwave-js/config\";\nimport {\n\ttype BroadcastCC,\n\ttype CCAddress,\n\ttype CCId,\n\tCommandClasses,\n\ttype ControlsCC,\n\tEncapsulationFlags,\n\ttype EndpointId,\n\ttype FrameType,\n\ttype GetAllEndpoints,\n\ttype GetCCs,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype MessageOrCCLogEntry,\n\ttype MessageRecord,\n\ttype ModifyCCs,\n\ttype MulticastCC,\n\ttype MulticastDestination,\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\ttype NodeId,\n\ttype QueryNodeStatus,\n\ttype QuerySecurityClasses,\n\ttype SetSecurityClass,\n\ttype SinglecastCC,\n\ttype SupportsCC,\n\ttype ValueDB,\n\ttype ValueID,\n\ttype ValueMetadata,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tisZWaveError,\n\tparseCCId,\n\tvalueIdToString,\n} from \"@zwave-js/core\";\nimport {\n\tBytes,\n\ttype BytesView,\n\ttype JSONObject,\n\tbuffer2hex,\n\tgetEnumMemberName,\n\tnum2hex,\n\tstaticExtends,\n} from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport type { CCAPIHost, CCAPINode, ValueIDProperties } from \"./API.js\";\nimport {\n\tgetCCCommand,\n\tgetCCCommandConstructor,\n\tgetCCConstructor,\n\tgetCCResponsePredicate,\n\tgetCCValueProperties,\n\tgetCCValues,\n\tgetCommandClass,\n\tgetExpectedCCResponse,\n\tgetImplementedVersion,\n} from \"./CommandClassDecorators.js\";\nimport {\n\ttype EncapsulatingCommandClass,\n\tisEncapsulatingCommandClass,\n\tisMultiEncapsulatingCommandClass,\n} from \"./EncapsulatingCommandClass.js\";\nimport {\n\ttype CCValue,\n\ttype DynamicCCValue,\n\ttype StaticCCValue,\n\tdefaultCCValueOptions,\n} from \"./Values.js\";\nimport type { GetInterviewOptions } from \"./traits.js\";\n\nexport interface CommandClassOptions extends CCAddress {\n\tccId?: number; // Used to overwrite the declared CC ID\n\tccCommand?: number; // undefined = NoOp\n\tpayload?: BytesView;\n}\n\n// Defines the necessary traits an endpoint passed to a CC instance must have\nexport type CCEndpoint =\n\t& EndpointId\n\t& SupportsCC\n\t& ControlsCC\n\t& GetCCs\n\t& ModifyCCs;\n\n// Defines the necessary traits a node passed to a CC instance must have\nexport type CCNode =\n\t& NodeId\n\t& SupportsCC\n\t& ControlsCC\n\t& GetCCs\n\t& GetEndpoint<CCEndpoint>\n\t& GetAllEndpoints<CCEndpoint>\n\t& QuerySecurityClasses\n\t& SetSecurityClass\n\t& ListenBehavior\n\t& QueryNodeStatus;\n\nexport type InterviewContext =\n\t& CCAPIHost<\n\t\t& CCAPINode\n\t\t& GetCCs\n\t\t& SupportsCC\n\t\t& ControlsCC\n\t\t& QuerySecurityClasses\n\t\t& SetSecurityClass\n\t\t& GetEndpoint<EndpointId & GetCCs & SupportsCC & ControlsCC & ModifyCCs>\n\t\t& GetAllEndpoints<EndpointId & SupportsCC & ControlsCC>\n\t>\n\t& GetInterviewOptions\n\t& LookupManufacturer;\n\nexport type RefreshValuesContext = CCAPIHost<\n\tCCAPINode & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n>;\n\nexport type PersistValuesContext =\n\t& HostIDs\n\t& GetValueDB\n\t& GetSupportedCCVersion\n\t& GetDeviceConfig\n\t& GetNode<\n\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t>\n\t& LogNode;\n\nexport function getEffectiveCCVersion(\n\tctx: GetSupportedCCVersion,\n\tcc: CCId,\n\tdefaultVersion?: number,\n): number {\n\t// For multicast and broadcast CCs, just use the highest implemented version to serialize\n\t// Older nodes will ignore the additional fields\n\tif (\n\t\ttypeof cc.nodeId !== \"number\"\n\t\t|| cc.nodeId === NODE_ID_BROADCAST\n\t\t|| cc.nodeId === NODE_ID_BROADCAST_LR\n\t) {\n\t\treturn getImplementedVersion(cc.ccId);\n\t}\n\t// For singlecast CCs, set the CC version as high as possible\n\treturn ctx.getSupportedCCVersion(cc.ccId, cc.nodeId, cc.endpointIndex)\n\t\t|| (defaultVersion ?? getImplementedVersion(cc.ccId));\n}\n\nexport class CCRaw {\n\tpublic constructor(\n\t\tpublic ccId: CommandClasses,\n\t\tpublic ccCommand: number | undefined,\n\t\tpublic payload: Bytes,\n\t) {}\n\n\tpublic static parse(data: BytesView): CCRaw {\n\t\tconst { ccId, bytesRead: ccIdLength } = parseCCId(data);\n\t\t// There are so few exceptions that we can handle them here manually\n\t\tif (ccId === CommandClasses[\"No Operation\"]) {\n\t\t\treturn new CCRaw(ccId, undefined, new Bytes());\n\t\t}\n\t\tlet ccCommand: number | undefined = data[ccIdLength];\n\t\tlet payload = Bytes.view(data.subarray(ccIdLength + 1));\n\t\tif (ccId === CommandClasses[\"Transport Service\"]) {\n\t\t\t// Transport Service only uses the higher 5 bits for the command\n\t\t\t// and re-uses the lower 3 bits of the ccCommand as payload\n\t\t\tpayload = Bytes.concat([\n\t\t\t\tBytes.from([ccCommand & 0b111]),\n\t\t\t\tpayload,\n\t\t\t]);\n\t\t\tccCommand = ccCommand & 0b11111_000;\n\t\t} else if (ccId === CommandClasses[\"Manufacturer Proprietary\"]) {\n\t\t\t// ManufacturerProprietaryCC has no CC command, so the first\n\t\t\t// payload byte is stored in ccCommand.\n\t\t\tpayload = Bytes.concat([\n\t\t\t\tBytes.from([ccCommand]),\n\t\t\t\tpayload,\n\t\t\t]);\n\t\t\tccCommand = undefined;\n\t\t}\n\n\t\treturn new CCRaw(ccId, ccCommand, payload);\n\t}\n\n\tpublic withPayload(payload: Bytes): CCRaw {\n\t\treturn new CCRaw(this.ccId, this.ccCommand, payload);\n\t}\n}\n\n// @publicAPI\nexport class CommandClass implements CCId {\n\t// empty constructor to parse messages\n\tpublic constructor(options: CommandClassOptions) {\n\t\tconst {\n\t\t\tnodeId,\n\t\t\tendpointIndex = 0,\n\t\t\tccId = getCommandClass(this),\n\t\t\tccCommand = getCCCommand(this),\n\t\t\tpayload = new Uint8Array(),\n\t\t} = options;\n\n\t\tthis.nodeId = nodeId;\n\t\tthis.endpointIndex = endpointIndex;\n\t\tthis.ccId = ccId;\n\t\tthis.ccCommand = ccCommand;\n\t\tthis.payload = Bytes.view(payload);\n\t}\n\n\tpublic static async parse(\n\t\tdata: BytesView,\n\t\tctx: CCParsingContext,\n\t): Promise<CommandClass> {\n\t\tconst raw = CCRaw.parse(data);\n\n\t\t// Find the correct subclass constructor to invoke\n\t\tconst CCConstructor = getCCConstructor(raw.ccId);\n\t\tif (!CCConstructor) {\n\t\t\t// None -> fall back to the default constructor\n\t\t\treturn await CommandClass.from(raw, ctx);\n\t\t}\n\n\t\tlet CommandConstructor: CCConstructor<CommandClass> | undefined;\n\t\tif (raw.ccCommand != undefined) {\n\t\t\tCommandConstructor = getCCCommandConstructor(\n\t\t\t\traw.ccId,\n\t\t\t\traw.ccCommand,\n\t\t\t);\n\t\t}\n\t\t// Not every CC has a constructor for its commands. In that case,\n\t\t// call the CC constructor directly\n\t\ttry {\n\t\t\treturn await (CommandConstructor ?? CCConstructor).from(raw, ctx);\n\t\t} catch (e) {\n\t\t\t// Indicate invalid payloads with a special CC type\n\t\t\tif (\n\t\t\t\tisZWaveError(e)\n\t\t\t\t&& e.code === ZWaveErrorCodes.PacketFormat_InvalidPayload\n\t\t\t) {\n\t\t\t\tconst ccName = CommandConstructor?.name\n\t\t\t\t\t?? `${getCCName(raw.ccId)} CC`;\n\n\t\t\t\t// Preserve why the command was invalid\n\t\t\t\tlet reason: string | ZWaveErrorCodes | undefined;\n\t\t\t\tif (\n\t\t\t\t\ttypeof e.context === \"string\"\n\t\t\t\t\t|| (typeof e.context === \"number\"\n\t\t\t\t\t\t&& ZWaveErrorCodes[e.context] != undefined)\n\t\t\t\t) {\n\t\t\t\t\treason = e.context;\n\t\t\t\t}\n\n\t\t\t\tconst ret = new InvalidCC({\n\t\t\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t\t\tccId: raw.ccId,\n\t\t\t\t\tccCommand: raw.ccCommand,\n\t\t\t\t\tccName,\n\t\t\t\t\treason,\n\t\t\t\t});\n\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CommandClass | Promise<CommandClass> {\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tccId: raw.ccId,\n\t\t\tccCommand: raw.ccCommand,\n\t\t\tpayload: raw.payload,\n\t\t});\n\t}\n\n\t/** This CC's identifier */\n\tpublic ccId!: CommandClasses;\n\tpublic ccCommand?: number;\n\tpublic get ccName(): string {\n\t\treturn getCCName(this.ccId);\n\t}\n\n\t/** The ID of the target node(s) */\n\tpublic nodeId!: number | MulticastDestination;\n\n\tpublic payload: Bytes;\n\n\t/** Which endpoint of the node this CC belongs to. 0 for the root device. */\n\tpublic endpointIndex: number;\n\n\t/**\n\t * Which encapsulation CCs this CC is/was/should be encapsulated with.\n\t *\n\t * Don't use this directly, this is used internally.\n\t */\n\tpublic encapsulationFlags: EncapsulationFlags = EncapsulationFlags.None;\n\n\t/** Activates or deactivates the given encapsulation flag(s) */\n\tpublic toggleEncapsulationFlag(\n\t\tflag: EncapsulationFlags,\n\t\tactive: boolean,\n\t): void {\n\t\tif (active) {\n\t\t\tthis.encapsulationFlags |= flag;\n\t\t} else {\n\t\t\tthis.encapsulationFlags &= ~flag;\n\t\t}\n\t}\n\n\t/** Contains a reference to the encapsulating CC if this CC is encapsulated */\n\tpublic encapsulatingCC?: EncapsulatingCommandClass;\n\n\t/** The type of Z-Wave frame this CC was sent with */\n\tpublic readonly frameType?: FrameType;\n\n\t/** Returns true if this CC is an extended CC (0xF100..0xFFFF) */\n\tpublic isExtended(): boolean {\n\t\treturn this.ccId >= 0xf100;\n\t}\n\n\t/** Whether the interview for this CC was previously completed */\n\tpublic isInterviewComplete(host: GetValueDB): boolean {\n\t\treturn !!this.getValueDB(host).getValue<boolean>({\n\t\t\tcommandClass: this.ccId,\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tproperty: \"interviewComplete\",\n\t\t});\n\t}\n\n\t/** Marks the interview for this CC as complete or not */\n\tpublic setInterviewComplete(\n\t\thost: GetValueDB,\n\t\tcomplete: boolean,\n\t): void {\n\t\tthis.getValueDB(host).setValue(\n\t\t\t{\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tproperty: \"interviewComplete\",\n\t\t\t},\n\t\t\tcomplete,\n\t\t);\n\t}\n\n\t/**\n\t * Serializes this CommandClass to be embedded in a message payload or another CC\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/require-await\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\t// NoOp CCs have no command and no payload\n\t\tif (this.ccId === CommandClasses[\"No Operation\"]) {\n\t\t\treturn Bytes.from([this.ccId]);\n\t\t} else if (this.ccCommand == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"Cannot serialize a Command Class without a command\",\n\t\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t\t);\n\t\t}\n\n\t\tconst payloadLength = this.payload.length;\n\t\tconst ccIdLength = this.isExtended() ? 2 : 1;\n\t\tconst data = new Bytes(ccIdLength + 1 + payloadLength);\n\t\tdata.writeUIntBE(this.ccId, 0, ccIdLength);\n\t\tdata[ccIdLength] = this.ccCommand;\n\t\tif (payloadLength > 0 /* implies payload != undefined */) {\n\t\t\tdata.set(this.payload, 1 + ccIdLength);\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic prepareRetransmission(): void {\n\t\t// Do nothing by default\n\t}\n\n\t/**\n\t * Create an instance of the given CC without checking whether it is supported.\n\t * If the CC is implemented, this returns an instance of the given CC which is linked to the given endpoint.\n\t *\n\t * **INTERNAL:** Applications should not use this directly.\n\t */\n\tpublic static createInstanceUnchecked<T extends CommandClass>(\n\t\tendpoint: EndpointId,\n\t\tcc: CommandClasses | CCConstructor<T>,\n\t): T | undefined {\n\t\tconst Constructor = typeof cc === \"number\" ? getCCConstructor(cc) : cc;\n\t\tif (Constructor) {\n\t\t\treturn new Constructor({\n\t\t\t\tnodeId: endpoint.nodeId,\n\t\t\t\tendpointIndex: endpoint.index,\n\t\t\t}) as T;\n\t\t}\n\t}\n\n\t/** Generates a representation of this CC for the log */\n\tpublic toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tlet tag = this.constructor.name;\n\t\tconst message: MessageRecord = {};\n\t\tif (this.constructor === CommandClass) {\n\t\t\ttag = `${\n\t\t\t\tgetEnumMemberName(\n\t\t\t\t\tCommandClasses,\n\t\t\t\t\tthis.ccId,\n\t\t\t\t)\n\t\t\t} CC (not implemented)`;\n\t\t\tif (this.ccCommand != undefined) {\n\t\t\t\tmessage.command = num2hex(this.ccCommand);\n\t\t\t}\n\t\t}\n\t\tif (this.payload.length > 0) {\n\t\t\tmessage.payload = buffer2hex(this.payload);\n\t\t}\n\t\treturn {\n\t\t\ttags: [tag],\n\t\t\tmessage,\n\t\t};\n\t}\n\n\t/** Generates the JSON representation of this CC */\n\tpublic toJSON(): JSONObject {\n\t\treturn this.toJSONInternal();\n\t}\n\n\tprivate toJSONInternal(): JSONObject {\n\t\tconst ret: JSONObject = {\n\t\t\tnodeId: this.nodeId,\n\t\t\tccId: CommandClasses[this.ccId] || num2hex(this.ccId),\n\t\t};\n\t\tif (this.ccCommand != undefined) {\n\t\t\tret.ccCommand = num2hex(this.ccCommand);\n\t\t}\n\t\tif (this.payload.length > 0) {\n\t\t\tret.payload = buffer2hex(this.payload);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tprotected throwMissingCriticalInterviewResponse(): never {\n\t\tthrow new ZWaveError(\n\t\t\t`The node did not respond to a critical interview query in time.`,\n\t\t\tZWaveErrorCodes.Controller_NodeTimeout,\n\t\t);\n\t}\n\n\t/**\n\t * Performs the interview procedure for this CC according to SDS14223\n\t */\n\tpublic async interview(_ctx: InterviewContext): Promise<void> {\n\t\t// This needs to be overwritten per command class. In the default implementation, don't do anything\n\t}\n\n\t/**\n\t * Refreshes all dynamic values of this CC\n\t */\n\tpublic async refreshValues(_ctx: RefreshValuesContext): Promise<void> {\n\t\t// This needs to be overwritten per command class. In the default implementation, don't do anything\n\t}\n\n\t/**\n\t * Checks if the CC values need to be manually refreshed.\n\t * This should be called regularly and when sleeping nodes wake up\n\t */\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\t_ctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// This needs to be overwritten per command class.\n\t\t// In the default implementation, don't require a refresh\n\t\treturn false;\n\t}\n\n\t/** Determines which CC interviews must be performed before this CC can be interviewed */\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// By default, all CCs require the VersionCC interview\n\n\t\t// There are two exceptions to this rule:\n\t\t// * ManufacturerSpecific must be interviewed first\n\t\t// * VersionCC itself must be done after that\n\t\t// These exceptions are defined in the overrides of this method of each corresponding CC\n\n\t\treturn [CommandClasses.Version];\n\t}\n\n\t/**\n\t * Whether the endpoint interview may be skipped by a CC. Can be overwritten by a subclass.\n\t */\n\tpublic skipEndpointInterview(): boolean {\n\t\t// By default no interview may be skipped\n\t\treturn false;\n\t}\n\n\t/**\n\t * Maps a BasicCC value to a more specific CC implementation. Returns true if the value was mapped, false otherwise.\n\t * @param _value The value of the received BasicCC\n\t */\n\tpublic setMappedBasicValue(\n\t\t_ctx: GetValueDB,\n\t\t_value: number,\n\t): boolean {\n\t\t// By default, don't map\n\t\treturn false;\n\t}\n\n\tpublic isSinglecast(): this is SinglecastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"singlecast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined\n\t\t\t\t&& typeof this.nodeId === \"number\"\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST_LR)\n\t\t);\n\t}\n\n\tpublic isMulticast(): this is MulticastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"multicast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined && isArray(this.nodeId))\n\t\t);\n\t}\n\n\tpublic isBroadcast(): this is BroadcastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"broadcast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined\n\t\t\t\t&& (this.nodeId === NODE_ID_BROADCAST\n\t\t\t\t\t|| this.nodeId === NODE_ID_BROADCAST_LR))\n\t\t);\n\t}\n\n\t/**\n\t * Returns the node this CC is linked to. Throws if the controller is not yet ready.\n\t */\n\tpublic getNode<T extends NodeId>(\n\t\tctx: GetNode<T>,\n\t): T | undefined {\n\t\tif (this.isSinglecast()) {\n\t\t\treturn ctx.getNode(this.nodeId);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t * Returns the node this CC is linked to (or undefined if the node doesn't exist)\n\t */\n\tpublic tryGetNode<T extends NodeId>(\n\t\tctx: GetNode<T>,\n\t): T | undefined {\n\t\ttry {\n\t\t\treturn this.getNode(ctx);\n\t\t} catch (e) {\n\t\t\t// This was expected\n\t\t\tif (isZWaveError(e) && e.code === ZWaveErrorCodes.Driver_NotReady) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Something else happened\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tpublic getEndpoint<T extends EndpointId>(\n\t\tctx: GetNode<NodeId & GetEndpoint<T>>,\n\t): T | undefined {\n\t\treturn this.getNode(ctx)?.getEndpoint(this.endpointIndex);\n\t}\n\n\t/** Returns the value DB for this CC's node */\n\tprotected getValueDB(ctx: GetValueDB): ValueDB {\n\t\tif (this.isSinglecast()) {\n\t\t\ttry {\n\t\t\t\treturn ctx.getValueDB(this.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\t/**\n\t * Ensures that the metadata for the given CC value exists in the Value DB or creates it if it does not.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t * @param meta Will be used in place of the predefined metadata when given\n\t */\n\tprotected ensureMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tmeta?: ValueMetadata,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tif (!valueDB.hasMetadata(valueId)) {\n\t\t\tvalueDB.setMetadata(valueId, meta ?? ccValue.meta);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the metadata for the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected removeMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setMetadata(valueId, undefined);\n\t}\n\n\t/**\n\t * Writes the metadata for the given CC value into the Value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t * @param meta Will be used in place of the predefined metadata when given\n\t */\n\tprotected setMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tmeta?: ValueMetadata,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setMetadata(valueId, meta ?? ccValue.meta);\n\t}\n\n\t/**\n\t * Reads the metadata for the given CC value from the Value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getMetadata<T extends ValueMetadata>(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): T | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getMetadata(valueId) as any;\n\t}\n\n\t/**\n\t * Stores the given value under the value ID for the given CC value in the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected setValue(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tvalue: unknown,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setValue(valueId, value);\n\t}\n\n\t/**\n\t * Removes the value for the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected removeValue(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.removeValue(valueId);\n\t}\n\n\t/**\n\t * Reads the value stored for the value ID of the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getValue<T>(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): T | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getValue(valueId);\n\t}\n\n\t/**\n\t * Reads when the value stored for the value ID of the given CC value was last updated in the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getValueTimestamp(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): number | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getTimestamp(valueId);\n\t}\n\n\t/** Returns the CC value definition for the current CC which matches the given value ID */\n\tprotected getCCValue(\n\t\tvalueId: ValueID,\n\t): StaticCCValue | DynamicCCValue | undefined {\n\t\tconst ccValues = getCCValues(this);\n\t\tif (!ccValues) return;\n\n\t\tfor (const value of Object.values(ccValues)) {\n\t\t\tif (value?.is(valueId)) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getAllCCValues(): (StaticCCValue | DynamicCCValue)[] {\n\t\treturn Object.values(getCCValues(this) ?? {}) as (\n\t\t\t| StaticCCValue\n\t\t\t| DynamicCCValue\n\t\t)[];\n\t}\n\n\tprivate getCCValueForValueId(\n\t\tproperties: ValueIDProperties,\n\t): StaticCCValue | DynamicCCValue | undefined {\n\t\treturn this.getAllCCValues().find((value) =>\n\t\t\tvalue.is({\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t...properties,\n\t\t\t})\n\t\t);\n\t}\n\n\tprivate shouldAutoCreateValue(\n\t\tctx: GetValueDB & GetDeviceConfig,\n\t\tvalue: StaticCCValue,\n\t): boolean {\n\t\treturn (\n\t\t\tvalue.options.autoCreate === true\n\t\t\t|| (typeof value.options.autoCreate === \"function\"\n\t\t\t\t&& value.options.autoCreate(\n\t\t\t\t\tctx,\n\t\t\t\t\t{\n\t\t\t\t\t\tvirtual: false,\n\t\t\t\t\t\tnodeId: this.nodeId as number,\n\t\t\t\t\t\tindex: this.endpointIndex,\n\t\t\t\t\t},\n\t\t\t\t))\n\t\t);\n\t}\n\n\t/** Returns a list of all value names that are defined for this CommandClass */\n\tpublic getDefinedValueIDs(\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t\tincludeInternal: boolean = false,\n\t): ValueID[] {\n\t\t// In order to compare value ids, we need them to be strings\n\t\tconst ret = new Map<string, ValueID>();\n\n\t\tconst addValueId = (\n\t\t\tproperty: string | number,\n\t\t\tpropertyKey?: string | number,\n\t\t): void => {\n\t\t\tconst valueId: ValueID = {\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tproperty,\n\t\t\t\tpropertyKey,\n\t\t\t};\n\t\t\tconst dbKey = valueIdToString(valueId);\n\t\t\tif (!ret.has(dbKey)) ret.set(dbKey, valueId);\n\t\t};\n\n\t\t// Return all value IDs for this CC...\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\t// ...which either have metadata or a value\n\t\tconst existingValueIds: ValueID[] = [\n\t\t\t...valueDB.getValues(this.ccId),\n\t\t\t...valueDB.getAllMetadata(this.ccId),\n\t\t];\n\n\t\t// To determine which value IDs to expose, we need to know the CC version\n\t\t// that we're doing this for\n\t\tconst supportedVersion = typeof this.nodeId === \"number\"\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST_LR\n\t\t\t// On singlecast CCs, use the version the node reported support for,\n\t\t\t? ctx.getSupportedCCVersion(\n\t\t\t\tthis.ccId,\n\t\t\t\tthis.nodeId,\n\t\t\t\tthis.endpointIndex,\n\t\t\t)\n\t\t\t// on multicast/broadcast, use the highest version we implement\n\t\t\t: getImplementedVersion(this.ccId);\n\n\t\t// ...or which are statically defined using @ccValues(...)\n\t\tfor (const value of Object.values(getCCValues(this) ?? {})) {\n\t\t\t// Skip dynamic CC values - they need a specific subclass instance to be evaluated\n\t\t\tif (!value || typeof value === \"function\") continue;\n\n\t\t\t// Skip those values that are only supported in higher versions of the CC\n\t\t\tif (\n\t\t\t\tvalue.options.minVersion != undefined\n\t\t\t\t&& value.options.minVersion > supportedVersion\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip internal values\n\t\t\tif (value.options.internal && !includeInternal) continue;\n\n\t\t\t// And determine if this value should be automatically \"created\"\n\t\t\tif (!this.shouldAutoCreateValue(ctx, value)) continue;\n\n\t\t\texistingValueIds.push(value.endpoint(this.endpointIndex));\n\t\t}\n\n\t\t// TODO: this is a bit awkward for the statically defined ones\n\t\tconst ccValues = this.getAllCCValues();\n\t\tfor (const valueId of existingValueIds) {\n\t\t\t// ...belonging to the current endpoint\n\t\t\tif ((valueId.endpoint ?? 0) !== this.endpointIndex) continue;\n\n\t\t\t// Hard-coded: interviewComplete is always internal\n\t\t\tif (valueId.property === \"interviewComplete\") continue;\n\n\t\t\t// ... which don't have a CC value definition\n\t\t\t// ... or one that does not mark the value ID as internal\n\t\t\tconst ccValue = ccValues.find((value) => value.is(valueId));\n\t\t\tif (!ccValue || !ccValue.options.internal || includeInternal) {\n\t\t\t\taddValueId(valueId.property, valueId.propertyKey);\n\t\t\t}\n\t\t}\n\n\t\treturn [...ret.values()];\n\t}\n\n\t/** Determines if the given value is an internal value */\n\tpublic isInternalValue(properties: ValueIDProperties): boolean {\n\t\t// Hard-coded: interviewComplete is always internal\n\t\tif (properties.property === \"interviewComplete\") return true;\n\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.internal ?? defaultCCValueOptions.internal;\n\t}\n\n\t/** Determines if the given value is an secret value */\n\tpublic isSecretValue(properties: ValueIDProperties): boolean {\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.secret ?? defaultCCValueOptions.secret;\n\t}\n\n\t/** Determines if the given value should be persisted or represents an event */\n\tpublic isStatefulValue(properties: ValueIDProperties): boolean {\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.stateful ?? defaultCCValueOptions.stateful;\n\t}\n\n\t/**\n\t * Persists all values for this CC instance into the value DB which are annotated with @ccValue.\n\t * Returns `true` if the process succeeded, `false` if the value DB cannot be accessed.\n\t */\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tlet valueDB: ValueDB;\n\t\ttry {\n\t\t\tvalueDB = this.getValueDB(ctx);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\n\t\t// To determine which value IDs to expose, we need to know the CC version\n\t\t// that we're doing this for\n\t\tconst supportedVersion = ctx.getSupportedCCVersion(\n\t\t\tthis.ccId,\n\t\t\t// Values are only persisted for singlecast, so we know nodeId is a number\n\t\t\tthis.nodeId as number,\n\t\t\tthis.endpointIndex,\n\t\t\t// If the version isn't known yet, limit the created values to V1\n\t\t) || 1;\n\n\t\t// Get all properties of this CC which are annotated with a @ccValue decorator and store them.\n\t\tfor (const [prop, _value] of getCCValueProperties(this)) {\n\t\t\t// Evaluate dynamic CC values first\n\t\t\tconst value = typeof _value === \"function\" ? _value(this) : _value;\n\n\t\t\t// Skip those values that are only supported in higher versions of the CC\n\t\t\tif (\n\t\t\t\tvalue.options.minVersion != undefined\n\t\t\t\t&& value.options.minVersion > supportedVersion\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst valueId: ValueID = value.endpoint(this.endpointIndex);\n\t\t\tconst sourceValue = this[prop as keyof this];\n\n\t\t\t// Metadata gets created for non-internal values...\n\t\t\tconst createMetadata = !value.options.internal\n\t\t\t\t// ... but only if the value is included in the report we are persisting\n\t\t\t\t&& (sourceValue != undefined\n\t\t\t\t\t// ... or if we know which CC version the node supports\n\t\t\t\t\t// and the value may be automatically created\n\t\t\t\t\t|| (supportedVersion >= value.options.minVersion\n\t\t\t\t\t\t&& this.shouldAutoCreateValue(ctx, value)));\n\n\t\t\tif (createMetadata && !valueDB.hasMetadata(valueId)) {\n\t\t\t\tvalueDB.setMetadata(valueId, value.meta);\n\t\t\t}\n\n\t\t\t// The value only gets written if it is not undefined. null is a valid value!\n\t\t\tif (sourceValue === undefined) continue;\n\n\t\t\tvalueDB.setValue(valueId, sourceValue, {\n\t\t\t\tstateful: value.options.stateful,\n\t\t\t});\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * When a CC supports to be split into multiple partial CCs, this can be used to identify the\n\t * session the partial CCs belong to.\n\t * If a CC expects `mergePartialCCs` to be always called, you should return an empty object here.\n\t */\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\treturn undefined; // Only select CCs support to be split\n\t}\n\n\t/**\n\t * When a CC supports to be split into multiple partial CCs, this indicates that the last report hasn't been received yet.\n\t * @param _session The previously received set of messages received in this partial CC session\n\t */\n\tpublic expectMoreMessages(_session: CommandClass[]): boolean {\n\t\treturn false; // By default, all CCs are monolithic\n\t}\n\n\t/** Include previously received partial responses into a final CC */\n\tpublic async mergePartialCCs(\n\t\t_partials: CommandClass[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// This is highly CC dependent\n\t\t// Overwrite this in derived classes, by default do nothing\n\t}\n\n\t/** Tests whether this CC expects at least one command in return */\n\tpublic expectsCCResponse(): boolean {\n\t\tlet expected:\n\t\t\t| DynamicCCResponse<this>\n\t\t\t| ReturnType<DynamicCCResponse<this>> = getExpectedCCResponse(this);\n\n\t\t// Evaluate dynamic CC responses\n\t\tif (\n\t\t\ttypeof expected === \"function\"\n\t\t\t&& !staticExtends(expected, CommandClass)\n\t\t) {\n\t\t\texpected = expected(this);\n\t\t}\n\t\tif (expected === undefined) return false;\n\t\tif (isArray(expected)) {\n\t\t\treturn expected.every((cc) => staticExtends(cc, CommandClass));\n\t\t} else {\n\t\t\treturn staticExtends(expected, CommandClass);\n\t\t}\n\t}\n\n\tpublic isExpectedCCResponse(received: CommandClass): boolean {\n\t\tif (received.nodeId !== this.nodeId) return false;\n\n\t\tlet expected:\n\t\t\t| DynamicCCResponse<this>\n\t\t\t| ReturnType<DynamicCCResponse<this>> = getExpectedCCResponse(this);\n\n\t\t// Evaluate dynamic CC responses\n\t\tif (\n\t\t\ttypeof expected === \"function\"\n\t\t\t&& !staticExtends(expected, CommandClass)\n\t\t) {\n\t\t\texpected = expected(this);\n\t\t}\n\n\t\tif (expected == undefined) {\n\t\t\t// Fallback, should not happen if the expected response is defined correctly\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tisArray(expected)\n\t\t\t&& expected.every((cc) => staticExtends(cc, CommandClass))\n\t\t) {\n\t\t\t// The CC always expects a response from the given list, check if the received\n\t\t\t// message is in that list\n\t\t\tif (expected.every((base) => !(received instanceof base))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (staticExtends(expected, CommandClass)) {\n\t\t\t// The CC always expects the same single response, check if this is the one\n\t\t\tif (!(received instanceof expected)) return false;\n\t\t}\n\n\t\t// If the CC wants to test the response, let it\n\t\tconst predicate = getCCResponsePredicate(this);\n\t\tconst ret = predicate?.(this, received) ?? true;\n\n\t\tif (ret === \"checkEncapsulated\") {\n\t\t\tif (\n\t\t\t\tisEncapsulatingCommandClass(this)\n\t\t\t\t&& isEncapsulatingCommandClass(received)\n\t\t\t) {\n\t\t\t\treturn this.encapsulated.isExpectedCCResponse(\n\t\t\t\t\treceived.encapsulated,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Fallback, should not happen if the expected response is defined correctly\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t}\n\n\t/**\n\t * Translates a property identifier into a speaking name for use in an external API\n\t * @param property The property identifier that should be translated\n\t * @param _propertyKey The (optional) property key the translated name may depend on\n\t */\n\tpublic translateProperty(\n\t\t_ctx: GetValueDB,\n\t\tproperty: string | number,\n\t\t_propertyKey?: string | number,\n\t): string {\n\t\t// Overwrite this in derived classes, by default just return the property key\n\t\treturn property.toString();\n\t}\n\n\t/**\n\t * Translates a property key into a speaking name for use in an external API\n\t * @param _property The property the key in question belongs to\n\t * @param propertyKey The property key for which the speaking name should be retrieved\n\t */\n\tpublic translatePropertyKey(\n\t\t_ctx: GetValueDB,\n\t\t_property: string | number,\n\t\tpropertyKey: string | number,\n\t): string | undefined {\n\t\t// Overwrite this in derived classes, by default just return the property key\n\t\treturn propertyKey.toString();\n\t}\n\n\t/** Returns the number of bytes that are added to the payload by this CC */\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// Default is ccId (+ ccCommand):\n\t\treturn (this.isExtended() ? 2 : 1) + 1;\n\t}\n\n\t/** Computes the maximum net payload size that can be transmitted inside this CC */\n\tpublic getMaxPayloadLength(baseLength: number): number {\n\t\tlet ret = baseLength;\n\t\tlet cur: CommandClass | undefined = this;\n\t\twhile (cur) {\n\t\t\tret -= cur.computeEncapsulationOverhead();\n\t\t\tcur = isEncapsulatingCommandClass(cur)\n\t\t\t\t? cur.encapsulated\n\t\t\t\t: undefined;\n\t\t}\n\t\treturn ret;\n\t}\n\n\t/** Checks whether this CC is encapsulated with one that has the given CC id and (optionally) CC Command */\n\tpublic isEncapsulatedWith(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): boolean {\n\t\tlet cc: CommandClass = this;\n\t\t// Check whether there was a S0 encapsulation\n\t\twhile (cc.encapsulatingCC) {\n\t\t\tcc = cc.encapsulatingCC;\n\t\t\tif (\n\t\t\t\tcc.ccId === ccId\n\t\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Traverses the encapsulation stack of this CC outwards and returns the one that has the given CC id and (optionally) CC Command if that exists. */\n\tpublic getEncapsulatingCC(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): CommandClass | undefined {\n\t\tlet cc: CommandClass = this;\n\t\twhile (cc.encapsulatingCC) {\n\t\t\tcc = cc.encapsulatingCC;\n\t\t\tif (\n\t\t\t\tcc.ccId === ccId\n\t\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand)\n\t\t\t) {\n\t\t\t\treturn cc;\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Traverses the encapsulation stack of this CC inwards and returns the one that has the given CC id and (optionally) CC Command if that exists. */\n\tpublic getEncapsulatedCC(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): CommandClass | undefined {\n\t\tconst predicate = (cc: CommandClass): boolean =>\n\t\t\tcc.ccId === ccId\n\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand);\n\n\t\tif (isEncapsulatingCommandClass(this)) {\n\t\t\tif (predicate(this.encapsulated)) return this.encapsulated;\n\t\t\treturn this.encapsulated.getEncapsulatedCC(ccId, ccCommand);\n\t\t} else if (isMultiEncapsulatingCommandClass(this)) {\n\t\t\tfor (const encapsulated of this.encapsulated) {\n\t\t\t\tif (predicate(encapsulated)) return encapsulated;\n\t\t\t\tconst ret = encapsulated.getEncapsulatedCC(ccId, ccCommand);\n\t\t\t\tif (ret) return ret;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface InvalidCCOptions extends CommandClassOptions {\n\tccName: string;\n\treason?: string | ZWaveErrorCodes;\n}\n\nexport class InvalidCC extends CommandClass {\n\tpublic constructor(options: InvalidCCOptions) {\n\t\tsuper(options);\n\t\tthis._ccName = options.ccName;\n\t\t// Numeric reasons are used internally to communicate problems with a CC\n\t\t// without ignoring them entirely\n\t\tthis.reason = options.reason;\n\t}\n\n\tprivate _ccName: string;\n\tpublic get ccName(): string {\n\t\treturn this._ccName;\n\t}\n\tpublic readonly reason?: string | ZWaveErrorCodes;\n\n\tpublic toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\ttags: [this.ccName, \"INVALID\"],\n\t\t\tmessage: this.reason != undefined\n\t\t\t\t? {\n\t\t\t\t\terror: typeof this.reason === \"string\"\n\t\t\t\t\t\t? this.reason\n\t\t\t\t\t\t: getEnumMemberName(\n\t\t\t\t\t\t\tZWaveErrorCodes,\n\t\t\t\t\t\t\tthis.reason,\n\t\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t};\n\t}\n}\n\nexport type CCConstructor<T extends CommandClass> = typeof CommandClass & {\n\t// I don't like the any, but we need it to support half-implemented CCs (e.g. report classes)\n\tnew (options: any): T;\n};\n\n/**\n * @publicAPI\n * May be used to define different expected CC responses depending on the sent CC\n */\nexport type DynamicCCResponse<\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass = CommandClass,\n> = (\n\tsentCC: TSent,\n) => CCConstructor<TReceived> | CCConstructor<TReceived>[] | undefined;\n\n/** @publicAPI */\nexport type CCResponseRole =\n\t| boolean // The response was either expected or unexpected\n\t| \"checkEncapsulated\"; // The response role depends on the encapsulated CC\n\n/**\n * @publicAPI\n * A predicate function to test if a received CC matches the sent CC\n */\nexport type CCResponsePredicate<\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass = CommandClass,\n> = (sentCommand: TSent, receivedCommand: TReceived) => CCResponseRole;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;AAAA,kBAwCO;AACP,oBAQO;AACP,wBAAwB;AAExB,oCAUO;AACP,uCAIO;AACP,oBAKO;AA0DD,SAAU,sBACf,KACA,IACA,gBAAuB;AAIvB,MACC,OAAO,GAAG,WAAW,YAClB,GAAG,WAAW,iCACd,GAAG,WAAW,kCAChB;AACD,eAAO,qDAAsB,GAAG,IAAI;EACrC;AAEA,SAAO,IAAI,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,MAChE,sBAAkB,qDAAsB,GAAG,IAAI;AACrD;AAjBgB;AAmBV,MAAO,MAAK;EAtJlB,OAsJkB;;;EAET;EACA;EACA;EAHR,YACQ,MACA,WACA,SAAc;AAFd,SAAA,OAAA;AACA,SAAA,YAAA;AACA,SAAA,UAAA;EACL;EAEI,OAAO,MAAM,MAAe;AAClC,UAAM,EAAE,MAAM,WAAW,WAAU,QAAK,uBAAU,IAAI;AAEtD,QAAI,SAAS,2BAAe,cAAc,GAAG;AAC5C,aAAO,IAAI,MAAM,MAAM,QAAW,IAAI,oBAAK,CAAE;IAC9C;AACA,QAAI,YAAgC,KAAK,UAAU;AACnD,QAAI,UAAU,oBAAM,KAAK,KAAK,SAAS,aAAa,CAAC,CAAC;AACtD,QAAI,SAAS,2BAAe,mBAAmB,GAAG;AAGjD,gBAAU,oBAAM,OAAO;QACtB,oBAAM,KAAK,CAAC,YAAY,CAAK,CAAC;QAC9B;OACA;AACD,kBAAY,YAAY;IACzB,WAAW,SAAS,2BAAe,0BAA0B,GAAG;AAG/D,gBAAU,oBAAM,OAAO;QACtB,oBAAM,KAAK,CAAC,SAAS,CAAC;QACtB;OACA;AACD,kBAAY;IACb;AAEA,WAAO,IAAI,MAAM,MAAM,WAAW,O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U,QAAQ;AAGvB,SAAK,SAAS,QAAQ;EACvB;EAEQ;EACR,IAAW,SAAM;AAChB,WAAO,KAAK;EACb;EACgB;EAET,WAAW,MAAiB;AAClC,WAAO;MACN,MAAM,CAAC,KAAK,QAAQ,SAAS;MAC7B,SAAS,KAAK,UAAU,SACrB;QACD,OAAO,OAAO,KAAK,WAAW,WAC3B,KAAK,aACL,iCACD,6BACA,KAAK,MAAM;UAGZ;;EAEL;;",
|
|
4
|
+
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport type { GetDeviceConfig, LookupManufacturer } from \"@zwave-js/config\";\nimport {\n\ttype BroadcastCC,\n\ttype CCAddress,\n\ttype CCId,\n\tCommandClasses,\n\ttype ControlsCC,\n\tEncapsulationFlags,\n\ttype EndpointId,\n\ttype FrameType,\n\ttype GetAllEndpoints,\n\ttype GetCCs,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype MessageOrCCLogEntry,\n\ttype MessageRecord,\n\ttype ModifyCCs,\n\ttype MulticastCC,\n\ttype MulticastDestination,\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\ttype NodeId,\n\ttype QueryNodeStatus,\n\ttype QuerySecurityClasses,\n\ttype SetSecurityClass,\n\ttype SinglecastCC,\n\ttype SupportsCC,\n\ttype ValueDB,\n\ttype ValueID,\n\ttype ValueMetadata,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tisZWaveError,\n\tparseCCId,\n\tvalueIdToString,\n} from \"@zwave-js/core\";\nimport {\n\tBytes,\n\ttype BytesView,\n\ttype JSONObject,\n\tbuffer2hex,\n\tgetEnumMemberName,\n\tnum2hex,\n\tstaticExtends,\n} from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport type { CCAPIHost, CCAPINode, ValueIDProperties } from \"./API.js\";\nimport {\n\tgetCCCommand,\n\tgetCCCommandConstructor,\n\tgetCCConstructor,\n\tgetCCResponsePredicate,\n\tgetCCValueProperties,\n\tgetCCValues,\n\tgetCommandClass,\n\tgetExpectedCCResponse,\n\tgetImplementedVersion,\n} from \"./CommandClassDecorators.js\";\nimport {\n\ttype EncapsulatingCommandClass,\n\tisEncapsulatingCommandClass,\n\tisMultiEncapsulatingCommandClass,\n} from \"./EncapsulatingCommandClass.js\";\nimport {\n\ttype CCValue,\n\ttype DynamicCCValue,\n\ttype StaticCCValue,\n\tdefaultCCValueOptions,\n} from \"./Values.js\";\nimport type { GetInterviewOptions } from \"./traits.js\";\n\nexport interface CommandClassOptions extends CCAddress {\n\tccId?: number; // Used to overwrite the declared CC ID\n\tccCommand?: number; // undefined = NoOp\n\tpayload?: BytesView;\n}\n\n// Defines the necessary traits an endpoint passed to a CC instance must have\nexport type CCEndpoint =\n\t& EndpointId\n\t& SupportsCC\n\t& ControlsCC\n\t& GetCCs\n\t& ModifyCCs;\n\n// Defines the necessary traits a node passed to a CC instance must have\nexport type CCNode =\n\t& NodeId\n\t& SupportsCC\n\t& ControlsCC\n\t& GetCCs\n\t& GetEndpoint<CCEndpoint>\n\t& GetAllEndpoints<CCEndpoint>\n\t& QuerySecurityClasses\n\t& SetSecurityClass\n\t& ListenBehavior\n\t& QueryNodeStatus;\n\nexport type InterviewContext =\n\t& CCAPIHost<\n\t\t& CCAPINode\n\t\t& GetCCs\n\t\t& SupportsCC\n\t\t& ControlsCC\n\t\t& QuerySecurityClasses\n\t\t& SetSecurityClass\n\t\t& GetEndpoint<EndpointId & GetCCs & SupportsCC & ControlsCC & ModifyCCs>\n\t\t& GetAllEndpoints<EndpointId & SupportsCC & ControlsCC>\n\t>\n\t& GetInterviewOptions\n\t& LookupManufacturer;\n\nexport type RefreshValuesContext = CCAPIHost<\n\tCCAPINode & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n>;\n\nexport type PersistValuesContext =\n\t& HostIDs\n\t& GetValueDB\n\t& GetSupportedCCVersion\n\t& GetDeviceConfig\n\t& GetNode<\n\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t>\n\t& LogNode;\n\nexport function getEffectiveCCVersion(\n\tctx: GetSupportedCCVersion,\n\tcc: CCId,\n\tdefaultVersion?: number,\n): number {\n\t// For multicast and broadcast CCs, just use the highest implemented version to serialize\n\t// Older nodes will ignore the additional fields\n\tif (\n\t\ttypeof cc.nodeId !== \"number\"\n\t\t|| cc.nodeId === NODE_ID_BROADCAST\n\t\t|| cc.nodeId === NODE_ID_BROADCAST_LR\n\t) {\n\t\treturn getImplementedVersion(cc.ccId);\n\t}\n\t// For singlecast CCs, set the CC version as high as possible\n\treturn ctx.getSupportedCCVersion(cc.ccId, cc.nodeId, cc.endpointIndex)\n\t\t|| (defaultVersion ?? getImplementedVersion(cc.ccId));\n}\n\nexport class CCRaw {\n\tpublic constructor(\n\t\tpublic ccId: CommandClasses,\n\t\tpublic ccCommand: number | undefined,\n\t\tpublic payload: Bytes,\n\t) {}\n\n\tpublic static parse(data: BytesView): CCRaw {\n\t\tconst { ccId, bytesRead: ccIdLength } = parseCCId(data);\n\t\t// There are so few exceptions that we can handle them here manually\n\t\tif (ccId === CommandClasses[\"No Operation\"]) {\n\t\t\treturn new CCRaw(ccId, undefined, new Bytes());\n\t\t}\n\t\tlet ccCommand: number | undefined = data[ccIdLength];\n\t\tlet payload = Bytes.view(data.subarray(ccIdLength + 1));\n\t\tif (ccId === CommandClasses[\"Transport Service\"]) {\n\t\t\t// Transport Service only uses the higher 5 bits for the command\n\t\t\t// and re-uses the lower 3 bits of the ccCommand as payload\n\t\t\tpayload = Bytes.concat([\n\t\t\t\tBytes.from([ccCommand & 0b111]),\n\t\t\t\tpayload,\n\t\t\t]);\n\t\t\tccCommand = ccCommand & 0b11111_000;\n\t\t} else if (ccId === CommandClasses[\"Manufacturer Proprietary\"]) {\n\t\t\t// ManufacturerProprietaryCC has no CC command, so the first\n\t\t\t// payload byte is stored in ccCommand.\n\t\t\tpayload = Bytes.concat([\n\t\t\t\tBytes.from([ccCommand]),\n\t\t\t\tpayload,\n\t\t\t]);\n\t\t\tccCommand = undefined;\n\t\t}\n\n\t\treturn new CCRaw(ccId, ccCommand, payload);\n\t}\n\n\tpublic withPayload(payload: Bytes): CCRaw {\n\t\treturn new CCRaw(this.ccId, this.ccCommand, payload);\n\t}\n}\n\n// @publicAPI\nexport class CommandClass implements CCId {\n\t// empty constructor to parse messages\n\tpublic constructor(options: CommandClassOptions) {\n\t\tconst {\n\t\t\tnodeId,\n\t\t\tendpointIndex = 0,\n\t\t\tccId = getCommandClass(this),\n\t\t\tccCommand = getCCCommand(this),\n\t\t\tpayload = new Uint8Array(),\n\t\t} = options;\n\n\t\tthis.nodeId = nodeId;\n\t\tthis.endpointIndex = endpointIndex;\n\t\tthis.ccId = ccId;\n\t\tthis.ccCommand = ccCommand;\n\t\tthis.payload = Bytes.view(payload);\n\t}\n\n\tpublic static async parse(\n\t\tdata: BytesView,\n\t\tctx: CCParsingContext,\n\t): Promise<CommandClass> {\n\t\tconst raw = CCRaw.parse(data);\n\n\t\t// Find the correct subclass constructor to invoke\n\t\tconst CCConstructor = getCCConstructor(raw.ccId);\n\t\tif (!CCConstructor) {\n\t\t\t// None -> fall back to the default constructor\n\t\t\treturn await CommandClass.from(raw, ctx);\n\t\t}\n\n\t\tlet CommandConstructor: CCConstructor<CommandClass> | undefined;\n\t\tif (raw.ccCommand != undefined) {\n\t\t\tCommandConstructor = getCCCommandConstructor(\n\t\t\t\traw.ccId,\n\t\t\t\traw.ccCommand,\n\t\t\t);\n\t\t}\n\t\t// Not every CC has a constructor for its commands. In that case,\n\t\t// call the CC constructor directly\n\t\ttry {\n\t\t\treturn await (CommandConstructor ?? CCConstructor).from(raw, ctx);\n\t\t} catch (e) {\n\t\t\t// Indicate invalid payloads with a special CC type\n\t\t\tif (\n\t\t\t\tisZWaveError(e)\n\t\t\t\t&& e.code === ZWaveErrorCodes.PacketFormat_InvalidPayload\n\t\t\t) {\n\t\t\t\tconst ccName = CommandConstructor?.name\n\t\t\t\t\t?? `${getCCName(raw.ccId)} CC`;\n\n\t\t\t\t// Preserve why the command was invalid\n\t\t\t\tlet reason: string | ZWaveErrorCodes | undefined;\n\t\t\t\tif (\n\t\t\t\t\ttypeof e.context === \"string\"\n\t\t\t\t\t|| (typeof e.context === \"number\"\n\t\t\t\t\t\t&& ZWaveErrorCodes[e.context] != undefined)\n\t\t\t\t) {\n\t\t\t\t\treason = e.context;\n\t\t\t\t}\n\n\t\t\t\tconst ret = new InvalidCC({\n\t\t\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t\t\tccId: raw.ccId,\n\t\t\t\t\tccCommand: raw.ccCommand,\n\t\t\t\t\tccName,\n\t\t\t\t\treason,\n\t\t\t\t});\n\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CommandClass | Promise<CommandClass> {\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tccId: raw.ccId,\n\t\t\tccCommand: raw.ccCommand,\n\t\t\tpayload: raw.payload,\n\t\t});\n\t}\n\n\t/** This CC's identifier */\n\tpublic ccId!: CommandClasses;\n\tpublic ccCommand?: number;\n\tpublic get ccName(): string {\n\t\treturn getCCName(this.ccId);\n\t}\n\n\t/** The ID of the target node(s) */\n\tpublic nodeId!: number | MulticastDestination;\n\n\tpublic payload: Bytes;\n\n\t/** Which endpoint of the node this CC belongs to. 0 for the root device. */\n\tpublic endpointIndex: number;\n\n\t/**\n\t * Which encapsulation CCs this CC is/was/should be encapsulated with.\n\t *\n\t * Don't use this directly, this is used internally.\n\t */\n\tpublic encapsulationFlags: EncapsulationFlags = EncapsulationFlags.None;\n\n\t/** Activates or deactivates the given encapsulation flag(s) */\n\tpublic toggleEncapsulationFlag(\n\t\tflag: EncapsulationFlags,\n\t\tactive: boolean,\n\t): void {\n\t\tif (active) {\n\t\t\tthis.encapsulationFlags |= flag;\n\t\t} else {\n\t\t\tthis.encapsulationFlags &= ~flag;\n\t\t}\n\t}\n\n\t/** Contains a reference to the encapsulating CC if this CC is encapsulated */\n\tpublic encapsulatingCC?: EncapsulatingCommandClass;\n\n\t/** The type of Z-Wave frame this CC was sent with */\n\tpublic readonly frameType?: FrameType;\n\n\t/** Returns true if this CC is an extended CC (0xF100..0xFFFF) */\n\tpublic isExtended(): boolean {\n\t\treturn this.ccId >= 0xf100;\n\t}\n\n\t/** Whether the interview for this CC was previously completed */\n\tpublic isInterviewComplete(host: GetValueDB): boolean {\n\t\treturn !!this.getValueDB(host).getValue<boolean>({\n\t\t\tcommandClass: this.ccId,\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tproperty: \"interviewComplete\",\n\t\t});\n\t}\n\n\t/** Marks the interview for this CC as complete or not */\n\tpublic setInterviewComplete(\n\t\thost: GetValueDB,\n\t\tcomplete: boolean,\n\t): void {\n\t\tthis.getValueDB(host).setValue(\n\t\t\t{\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tproperty: \"interviewComplete\",\n\t\t\t},\n\t\t\tcomplete,\n\t\t);\n\t}\n\n\t/**\n\t * Serializes this CommandClass to be embedded in a message payload or another CC\n\t */\n\t// oxlint-disable-next-line no-unused-vars, @typescript-eslint/require-await\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\t// NoOp CCs have no command and no payload\n\t\tif (this.ccId === CommandClasses[\"No Operation\"]) {\n\t\t\treturn Bytes.from([this.ccId]);\n\t\t} else if (this.ccCommand == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"Cannot serialize a Command Class without a command\",\n\t\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t\t);\n\t\t}\n\n\t\tconst payloadLength = this.payload.length;\n\t\tconst ccIdLength = this.isExtended() ? 2 : 1;\n\t\tconst data = new Bytes(ccIdLength + 1 + payloadLength);\n\t\tdata.writeUIntBE(this.ccId, 0, ccIdLength);\n\t\tdata[ccIdLength] = this.ccCommand;\n\t\tif (payloadLength > 0 /* implies payload != undefined */) {\n\t\t\tdata.set(this.payload, 1 + ccIdLength);\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic prepareRetransmission(): void {\n\t\t// Do nothing by default\n\t}\n\n\t/**\n\t * Create an instance of the given CC without checking whether it is supported.\n\t * If the CC is implemented, this returns an instance of the given CC which is linked to the given endpoint.\n\t *\n\t * **INTERNAL:** Applications should not use this directly.\n\t */\n\tpublic static createInstanceUnchecked<T extends CommandClass>(\n\t\tendpoint: EndpointId,\n\t\tcc: CommandClasses | CCConstructor<T>,\n\t): T | undefined {\n\t\tconst Constructor = typeof cc === \"number\" ? getCCConstructor(cc) : cc;\n\t\tif (Constructor) {\n\t\t\treturn new Constructor({\n\t\t\t\tnodeId: endpoint.nodeId,\n\t\t\t\tendpointIndex: endpoint.index,\n\t\t\t}) as T;\n\t\t}\n\t}\n\n\t/** Generates a representation of this CC for the log */\n\tpublic toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tlet tag = this.constructor.name;\n\t\tconst message: MessageRecord = {};\n\t\tif (this.constructor === CommandClass) {\n\t\t\ttag = `${\n\t\t\t\tgetEnumMemberName(\n\t\t\t\t\tCommandClasses,\n\t\t\t\t\tthis.ccId,\n\t\t\t\t)\n\t\t\t} CC (not implemented)`;\n\t\t\tif (this.ccCommand != undefined) {\n\t\t\t\tmessage.command = num2hex(this.ccCommand);\n\t\t\t}\n\t\t}\n\t\tif (this.payload.length > 0) {\n\t\t\tmessage.payload = buffer2hex(this.payload);\n\t\t}\n\t\treturn {\n\t\t\ttags: [tag],\n\t\t\tmessage,\n\t\t};\n\t}\n\n\t/** Generates the JSON representation of this CC */\n\tpublic toJSON(): JSONObject {\n\t\treturn this.toJSONInternal();\n\t}\n\n\tprivate toJSONInternal(): JSONObject {\n\t\tconst ret: JSONObject = {\n\t\t\tnodeId: this.nodeId,\n\t\t\tccId: CommandClasses[this.ccId] || num2hex(this.ccId),\n\t\t};\n\t\tif (this.ccCommand != undefined) {\n\t\t\tret.ccCommand = num2hex(this.ccCommand);\n\t\t}\n\t\tif (this.payload.length > 0) {\n\t\t\tret.payload = buffer2hex(this.payload);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tprotected throwMissingCriticalInterviewResponse(): never {\n\t\tthrow new ZWaveError(\n\t\t\t`The node did not respond to a critical interview query in time.`,\n\t\t\tZWaveErrorCodes.Controller_NodeTimeout,\n\t\t);\n\t}\n\n\t/**\n\t * Performs the interview procedure for this CC according to SDS14223\n\t */\n\tpublic async interview(_ctx: InterviewContext): Promise<void> {\n\t\t// This needs to be overwritten per command class. In the default implementation, don't do anything\n\t}\n\n\t/**\n\t * Refreshes all dynamic values of this CC\n\t */\n\tpublic async refreshValues(_ctx: RefreshValuesContext): Promise<void> {\n\t\t// This needs to be overwritten per command class. In the default implementation, don't do anything\n\t}\n\n\t/**\n\t * Checks if the CC values need to be manually refreshed.\n\t * This should be called regularly and when sleeping nodes wake up\n\t */\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\t_ctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// This needs to be overwritten per command class.\n\t\t// In the default implementation, don't require a refresh\n\t\treturn false;\n\t}\n\n\t/** Determines which CC interviews must be performed before this CC can be interviewed */\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// By default, all CCs require the VersionCC interview\n\n\t\t// There are two exceptions to this rule:\n\t\t// * ManufacturerSpecific must be interviewed first\n\t\t// * VersionCC itself must be done after that\n\t\t// These exceptions are defined in the overrides of this method of each corresponding CC\n\n\t\treturn [CommandClasses.Version];\n\t}\n\n\t/**\n\t * Whether the endpoint interview may be skipped by a CC. Can be overwritten by a subclass.\n\t */\n\tpublic skipEndpointInterview(): boolean {\n\t\t// By default no interview may be skipped\n\t\treturn false;\n\t}\n\n\t/**\n\t * Maps a BasicCC value to a more specific CC implementation. Returns true if the value was mapped, false otherwise.\n\t * @param _value The value of the received BasicCC\n\t */\n\tpublic setMappedBasicValue(\n\t\t_ctx: GetValueDB,\n\t\t_value: number,\n\t): boolean {\n\t\t// By default, don't map\n\t\treturn false;\n\t}\n\n\tpublic isSinglecast(): this is SinglecastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"singlecast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined\n\t\t\t\t&& typeof this.nodeId === \"number\"\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST_LR)\n\t\t);\n\t}\n\n\tpublic isMulticast(): this is MulticastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"multicast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined && isArray(this.nodeId))\n\t\t);\n\t}\n\n\tpublic isBroadcast(): this is BroadcastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"broadcast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined\n\t\t\t\t&& (this.nodeId === NODE_ID_BROADCAST\n\t\t\t\t\t|| this.nodeId === NODE_ID_BROADCAST_LR))\n\t\t);\n\t}\n\n\t/**\n\t * Returns the node this CC is linked to. Throws if the controller is not yet ready.\n\t */\n\tpublic getNode<T extends NodeId>(\n\t\tctx: GetNode<T>,\n\t): T | undefined {\n\t\tif (this.isSinglecast()) {\n\t\t\treturn ctx.getNode(this.nodeId);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t * Returns the node this CC is linked to (or undefined if the node doesn't exist)\n\t */\n\tpublic tryGetNode<T extends NodeId>(\n\t\tctx: GetNode<T>,\n\t): T | undefined {\n\t\ttry {\n\t\t\treturn this.getNode(ctx);\n\t\t} catch (e) {\n\t\t\t// This was expected\n\t\t\tif (isZWaveError(e) && e.code === ZWaveErrorCodes.Driver_NotReady) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Something else happened\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tpublic getEndpoint<T extends EndpointId>(\n\t\tctx: GetNode<NodeId & GetEndpoint<T>>,\n\t): T | undefined {\n\t\treturn this.getNode(ctx)?.getEndpoint(this.endpointIndex);\n\t}\n\n\t/** Returns the value DB for this CC's node */\n\tprotected getValueDB(ctx: GetValueDB): ValueDB {\n\t\tif (this.isSinglecast()) {\n\t\t\ttry {\n\t\t\t\treturn ctx.getValueDB(this.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\t/**\n\t * Ensures that the metadata for the given CC value exists in the Value DB or creates it if it does not.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t * @param meta Will be used in place of the predefined metadata when given\n\t */\n\tprotected ensureMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tmeta?: ValueMetadata,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tif (!valueDB.hasMetadata(valueId)) {\n\t\t\tvalueDB.setMetadata(valueId, meta ?? ccValue.meta);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the metadata for the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected removeMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setMetadata(valueId, undefined);\n\t}\n\n\t/**\n\t * Writes the metadata for the given CC value into the Value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t * @param meta Will be used in place of the predefined metadata when given\n\t */\n\tprotected setMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tmeta?: ValueMetadata,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setMetadata(valueId, meta ?? ccValue.meta);\n\t}\n\n\t/**\n\t * Reads the metadata for the given CC value from the Value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getMetadata<T extends ValueMetadata>(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): T | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getMetadata(valueId) as any;\n\t}\n\n\t/**\n\t * Stores the given value under the value ID for the given CC value in the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected setValue(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tvalue: unknown,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setValue(valueId, value);\n\t}\n\n\t/**\n\t * Removes the value for the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected removeValue(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.removeValue(valueId);\n\t}\n\n\t/**\n\t * Reads the value stored for the value ID of the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getValue<T>(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): T | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getValue(valueId);\n\t}\n\n\t/**\n\t * Reads when the value stored for the value ID of the given CC value was last updated in the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getValueTimestamp(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): number | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getTimestamp(valueId);\n\t}\n\n\t/** Returns the CC value definition for the current CC which matches the given value ID */\n\tprotected getCCValue(\n\t\tvalueId: ValueID,\n\t): StaticCCValue | DynamicCCValue | undefined {\n\t\tconst ccValues = getCCValues(this);\n\t\tif (!ccValues) return;\n\n\t\tfor (const value of Object.values(ccValues)) {\n\t\t\tif (value?.is(valueId)) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getAllCCValues(): (StaticCCValue | DynamicCCValue)[] {\n\t\treturn Object.values(getCCValues(this) ?? {}) as (\n\t\t\t| StaticCCValue\n\t\t\t| DynamicCCValue\n\t\t)[];\n\t}\n\n\tprivate getCCValueForValueId(\n\t\tproperties: ValueIDProperties,\n\t): StaticCCValue | DynamicCCValue | undefined {\n\t\treturn this.getAllCCValues().find((value) =>\n\t\t\tvalue.is({\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t...properties,\n\t\t\t})\n\t\t);\n\t}\n\n\tprivate shouldAutoCreateValue(\n\t\tctx: GetValueDB & GetDeviceConfig,\n\t\tvalue: StaticCCValue,\n\t): boolean {\n\t\treturn (\n\t\t\tvalue.options.autoCreate === true\n\t\t\t|| (typeof value.options.autoCreate === \"function\"\n\t\t\t\t&& value.options.autoCreate(\n\t\t\t\t\tctx,\n\t\t\t\t\t{\n\t\t\t\t\t\tvirtual: false,\n\t\t\t\t\t\tnodeId: this.nodeId as number,\n\t\t\t\t\t\tindex: this.endpointIndex,\n\t\t\t\t\t},\n\t\t\t\t))\n\t\t);\n\t}\n\n\t/** Returns a list of all value names that are defined for this CommandClass */\n\tpublic getDefinedValueIDs(\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t\tincludeInternal: boolean = false,\n\t): ValueID[] {\n\t\t// In order to compare value ids, we need them to be strings\n\t\tconst ret = new Map<string, ValueID>();\n\n\t\tconst addValueId = (\n\t\t\tproperty: string | number,\n\t\t\tpropertyKey?: string | number,\n\t\t): void => {\n\t\t\tconst valueId: ValueID = {\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tproperty,\n\t\t\t\tpropertyKey,\n\t\t\t};\n\t\t\tconst dbKey = valueIdToString(valueId);\n\t\t\tif (!ret.has(dbKey)) ret.set(dbKey, valueId);\n\t\t};\n\n\t\t// Return all value IDs for this CC...\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\t// ...which either have metadata or a value\n\t\tconst existingValueIds: ValueID[] = [\n\t\t\t...valueDB.getValues(this.ccId),\n\t\t\t...valueDB.getAllMetadata(this.ccId),\n\t\t];\n\n\t\t// To determine which value IDs to expose, we need to know the CC version\n\t\t// that we're doing this for\n\t\tconst supportedVersion = typeof this.nodeId === \"number\"\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST_LR\n\t\t\t// On singlecast CCs, use the version the node reported support for,\n\t\t\t? ctx.getSupportedCCVersion(\n\t\t\t\tthis.ccId,\n\t\t\t\tthis.nodeId,\n\t\t\t\tthis.endpointIndex,\n\t\t\t)\n\t\t\t// on multicast/broadcast, use the highest version we implement\n\t\t\t: getImplementedVersion(this.ccId);\n\n\t\t// ...or which are statically defined using @ccValues(...)\n\t\tfor (const value of Object.values(getCCValues(this) ?? {})) {\n\t\t\t// Skip dynamic CC values - they need a specific subclass instance to be evaluated\n\t\t\tif (!value || typeof value === \"function\") continue;\n\n\t\t\t// Skip those values that are only supported in higher versions of the CC\n\t\t\tif (\n\t\t\t\tvalue.options.minVersion != undefined\n\t\t\t\t&& value.options.minVersion > supportedVersion\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip internal values\n\t\t\tif (value.options.internal && !includeInternal) continue;\n\n\t\t\t// And determine if this value should be automatically \"created\"\n\t\t\tif (!this.shouldAutoCreateValue(ctx, value)) continue;\n\n\t\t\texistingValueIds.push(value.endpoint(this.endpointIndex));\n\t\t}\n\n\t\t// TODO: this is a bit awkward for the statically defined ones\n\t\tconst ccValues = this.getAllCCValues();\n\t\tfor (const valueId of existingValueIds) {\n\t\t\t// ...belonging to the current endpoint\n\t\t\tif ((valueId.endpoint ?? 0) !== this.endpointIndex) continue;\n\n\t\t\t// Hard-coded: interviewComplete is always internal\n\t\t\tif (valueId.property === \"interviewComplete\") continue;\n\n\t\t\t// ... which don't have a CC value definition\n\t\t\t// ... or one that does not mark the value ID as internal\n\t\t\tconst ccValue = ccValues.find((value) => value.is(valueId));\n\t\t\tif (!ccValue || !ccValue.options.internal || includeInternal) {\n\t\t\t\taddValueId(valueId.property, valueId.propertyKey);\n\t\t\t}\n\t\t}\n\n\t\treturn [...ret.values()];\n\t}\n\n\t/** Determines if the given value is an internal value */\n\tpublic isInternalValue(properties: ValueIDProperties): boolean {\n\t\t// Hard-coded: interviewComplete is always internal\n\t\tif (properties.property === \"interviewComplete\") return true;\n\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.internal ?? defaultCCValueOptions.internal;\n\t}\n\n\t/** Determines if the given value is an secret value */\n\tpublic isSecretValue(properties: ValueIDProperties): boolean {\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.secret ?? defaultCCValueOptions.secret;\n\t}\n\n\t/** Determines if the given value should be persisted or represents an event */\n\tpublic isStatefulValue(properties: ValueIDProperties): boolean {\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.stateful ?? defaultCCValueOptions.stateful;\n\t}\n\n\t/**\n\t * Persists all values for this CC instance into the value DB which are annotated with @ccValue.\n\t * Returns `true` if the process succeeded, `false` if the value DB cannot be accessed.\n\t */\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tlet valueDB: ValueDB;\n\t\ttry {\n\t\t\tvalueDB = this.getValueDB(ctx);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\n\t\t// To determine which value IDs to expose, we need to know the CC version\n\t\t// that we're doing this for\n\t\tconst supportedVersion = ctx.getSupportedCCVersion(\n\t\t\tthis.ccId,\n\t\t\t// Values are only persisted for singlecast, so we know nodeId is a number\n\t\t\tthis.nodeId as number,\n\t\t\tthis.endpointIndex,\n\t\t\t// If the version isn't known yet, limit the created values to V1\n\t\t) || 1;\n\n\t\t// Get all properties of this CC which are annotated with a @ccValue decorator and store them.\n\t\tfor (const [prop, _value] of getCCValueProperties(this)) {\n\t\t\t// Evaluate dynamic CC values first\n\t\t\tconst value = typeof _value === \"function\" ? _value(this) : _value;\n\n\t\t\t// Skip those values that are only supported in higher versions of the CC\n\t\t\tif (\n\t\t\t\tvalue.options.minVersion != undefined\n\t\t\t\t&& value.options.minVersion > supportedVersion\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst valueId: ValueID = value.endpoint(this.endpointIndex);\n\t\t\tconst sourceValue = this[prop as keyof this];\n\n\t\t\t// Metadata gets created for non-internal values...\n\t\t\tconst createMetadata = !value.options.internal\n\t\t\t\t// ... but only if the value is included in the report we are persisting\n\t\t\t\t&& (sourceValue != undefined\n\t\t\t\t\t// ... or if we know which CC version the node supports\n\t\t\t\t\t// and the value may be automatically created\n\t\t\t\t\t|| (supportedVersion >= value.options.minVersion\n\t\t\t\t\t\t&& this.shouldAutoCreateValue(ctx, value)));\n\n\t\t\tif (createMetadata && !valueDB.hasMetadata(valueId)) {\n\t\t\t\tvalueDB.setMetadata(valueId, value.meta);\n\t\t\t}\n\n\t\t\t// The value only gets written if it is not undefined. null is a valid value!\n\t\t\tif (sourceValue === undefined) continue;\n\n\t\t\tvalueDB.setValue(valueId, sourceValue, {\n\t\t\t\tstateful: value.options.stateful,\n\t\t\t});\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * When a CC supports to be split into multiple partial CCs, this can be used to identify the\n\t * session the partial CCs belong to.\n\t * If a CC expects `mergePartialCCs` to be always called, you should return an empty object here.\n\t */\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\treturn undefined; // Only select CCs support to be split\n\t}\n\n\t/**\n\t * When a CC supports to be split into multiple partial CCs, this indicates that the last report hasn't been received yet.\n\t * @param _session The previously received set of messages received in this partial CC session\n\t */\n\tpublic expectMoreMessages(_session: CommandClass[]): boolean {\n\t\treturn false; // By default, all CCs are monolithic\n\t}\n\n\t/** Include previously received partial responses into a final CC */\n\tpublic async mergePartialCCs(\n\t\t_partials: CommandClass[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// This is highly CC dependent\n\t\t// Overwrite this in derived classes, by default do nothing\n\t}\n\n\t/** Tests whether this CC expects at least one command in return */\n\tpublic expectsCCResponse(ctx: GetNode<NodeId & SupportsCC>): boolean {\n\t\tlet expected:\n\t\t\t| DynamicCCResponse<this>\n\t\t\t| ReturnType<DynamicCCResponse<this>> = getExpectedCCResponse(this);\n\n\t\t// Evaluate dynamic CC responses\n\t\tif (\n\t\t\ttypeof expected === \"function\"\n\t\t\t&& !staticExtends(expected, CommandClass)\n\t\t) {\n\t\t\texpected = expected(ctx, this);\n\t\t}\n\t\tif (expected === undefined) return false;\n\t\tif (isArray(expected)) {\n\t\t\treturn expected.every((cc) => staticExtends(cc, CommandClass));\n\t\t} else {\n\t\t\treturn staticExtends(expected, CommandClass);\n\t\t}\n\t}\n\n\tpublic isExpectedCCResponse(\n\t\tctx: GetNode<NodeId & SupportsCC>,\n\t\treceived: CommandClass,\n\t): boolean {\n\t\tif (received.nodeId !== this.nodeId) return false;\n\n\t\tlet expected:\n\t\t\t| DynamicCCResponse<this>\n\t\t\t| ReturnType<DynamicCCResponse<this>> = getExpectedCCResponse(this);\n\n\t\t// Evaluate dynamic CC responses\n\t\tif (\n\t\t\ttypeof expected === \"function\"\n\t\t\t&& !staticExtends(expected, CommandClass)\n\t\t) {\n\t\t\texpected = expected(ctx, this);\n\t\t}\n\n\t\tif (expected == undefined) {\n\t\t\t// Fallback, should not happen if the expected response is defined correctly\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tisArray(expected)\n\t\t\t&& expected.every((cc) => staticExtends(cc, CommandClass))\n\t\t) {\n\t\t\t// The CC always expects a response from the given list, check if the received\n\t\t\t// message is in that list\n\t\t\tif (expected.every((base) => !(received instanceof base))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (staticExtends(expected, CommandClass)) {\n\t\t\t// The CC always expects the same single response, check if this is the one\n\t\t\tif (!(received instanceof expected)) return false;\n\t\t}\n\n\t\t// If the CC wants to test the response, let it\n\t\tconst predicate = getCCResponsePredicate(this);\n\t\tconst ret = predicate?.(this, received) ?? true;\n\n\t\tif (ret === \"checkEncapsulated\") {\n\t\t\tif (\n\t\t\t\tisEncapsulatingCommandClass(this)\n\t\t\t\t&& isEncapsulatingCommandClass(received)\n\t\t\t) {\n\t\t\t\treturn this.encapsulated.isExpectedCCResponse(\n\t\t\t\t\tctx,\n\t\t\t\t\treceived.encapsulated,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Fallback, should not happen if the expected response is defined correctly\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t}\n\n\t/**\n\t * Translates a property identifier into a speaking name for use in an external API\n\t * @param property The property identifier that should be translated\n\t * @param _propertyKey The (optional) property key the translated name may depend on\n\t */\n\tpublic translateProperty(\n\t\t_ctx: GetValueDB,\n\t\tproperty: string | number,\n\t\t_propertyKey?: string | number,\n\t): string {\n\t\t// Overwrite this in derived classes, by default just return the property key\n\t\treturn property.toString();\n\t}\n\n\t/**\n\t * Translates a property key into a speaking name for use in an external API\n\t * @param _property The property the key in question belongs to\n\t * @param propertyKey The property key for which the speaking name should be retrieved\n\t */\n\tpublic translatePropertyKey(\n\t\t_ctx: GetValueDB,\n\t\t_property: string | number,\n\t\tpropertyKey: string | number,\n\t): string | undefined {\n\t\t// Overwrite this in derived classes, by default just return the property key\n\t\treturn propertyKey.toString();\n\t}\n\n\t/** Returns the number of bytes that are added to the payload by this CC */\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// Default is ccId (+ ccCommand):\n\t\treturn (this.isExtended() ? 2 : 1) + 1;\n\t}\n\n\t/** Computes the maximum net payload size that can be transmitted inside this CC */\n\tpublic getMaxPayloadLength(baseLength: number): number {\n\t\tlet ret = baseLength;\n\t\tlet cur: CommandClass | undefined = this;\n\t\twhile (cur) {\n\t\t\tret -= cur.computeEncapsulationOverhead();\n\t\t\tcur = isEncapsulatingCommandClass(cur)\n\t\t\t\t? cur.encapsulated\n\t\t\t\t: undefined;\n\t\t}\n\t\treturn ret;\n\t}\n\n\t/** Checks whether this CC is encapsulated with one that has the given CC id and (optionally) CC Command */\n\tpublic isEncapsulatedWith(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): boolean {\n\t\tlet cc: CommandClass = this;\n\t\t// Check whether there was a S0 encapsulation\n\t\twhile (cc.encapsulatingCC) {\n\t\t\tcc = cc.encapsulatingCC;\n\t\t\tif (\n\t\t\t\tcc.ccId === ccId\n\t\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Traverses the encapsulation stack of this CC outwards and returns the one that has the given CC id and (optionally) CC Command if that exists. */\n\tpublic getEncapsulatingCC(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): CommandClass | undefined {\n\t\tlet cc: CommandClass = this;\n\t\twhile (cc.encapsulatingCC) {\n\t\t\tcc = cc.encapsulatingCC;\n\t\t\tif (\n\t\t\t\tcc.ccId === ccId\n\t\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand)\n\t\t\t) {\n\t\t\t\treturn cc;\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Traverses the encapsulation stack of this CC inwards and returns the one that has the given CC id and (optionally) CC Command if that exists. */\n\tpublic getEncapsulatedCC(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): CommandClass | undefined {\n\t\tconst predicate = (cc: CommandClass): boolean =>\n\t\t\tcc.ccId === ccId\n\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand);\n\n\t\tif (isEncapsulatingCommandClass(this)) {\n\t\t\tif (predicate(this.encapsulated)) return this.encapsulated;\n\t\t\treturn this.encapsulated.getEncapsulatedCC(ccId, ccCommand);\n\t\t} else if (isMultiEncapsulatingCommandClass(this)) {\n\t\t\tfor (const encapsulated of this.encapsulated) {\n\t\t\t\tif (predicate(encapsulated)) return encapsulated;\n\t\t\t\tconst ret = encapsulated.getEncapsulatedCC(ccId, ccCommand);\n\t\t\t\tif (ret) return ret;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface InvalidCCOptions extends CommandClassOptions {\n\tccName: string;\n\treason?: string | ZWaveErrorCodes;\n}\n\nexport class InvalidCC extends CommandClass {\n\tpublic constructor(options: InvalidCCOptions) {\n\t\tsuper(options);\n\t\tthis._ccName = options.ccName;\n\t\t// Numeric reasons are used internally to communicate problems with a CC\n\t\t// without ignoring them entirely\n\t\tthis.reason = options.reason;\n\t}\n\n\tprivate _ccName: string;\n\tpublic get ccName(): string {\n\t\treturn this._ccName;\n\t}\n\tpublic readonly reason?: string | ZWaveErrorCodes;\n\n\tpublic toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\ttags: [this.ccName, \"INVALID\"],\n\t\t\tmessage: this.reason != undefined\n\t\t\t\t? {\n\t\t\t\t\terror: typeof this.reason === \"string\"\n\t\t\t\t\t\t? this.reason\n\t\t\t\t\t\t: getEnumMemberName(\n\t\t\t\t\t\t\tZWaveErrorCodes,\n\t\t\t\t\t\t\tthis.reason,\n\t\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t};\n\t}\n}\n\nexport type CCConstructor<T extends CommandClass> = typeof CommandClass & {\n\t// I don't like the any, but we need it to support half-implemented CCs (e.g. report classes)\n\tnew (options: any): T;\n};\n\n/**\n * @publicAPI\n * May be used to define different expected CC responses depending on the sent CC\n */\nexport type DynamicCCResponse<\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass = CommandClass,\n> = (\n\tctx: GetNode<NodeId & SupportsCC>,\n\tsentCC: TSent,\n) => CCConstructor<TReceived> | CCConstructor<TReceived>[] | undefined;\n\n/** @publicAPI */\nexport type CCResponseRole =\n\t| boolean // The response was either expected or unexpected\n\t| \"checkEncapsulated\"; // The response role depends on the encapsulated CC\n\n/**\n * @publicAPI\n * A predicate function to test if a received CC matches the sent CC\n */\nexport type CCResponsePredicate<\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass = CommandClass,\n> = (sentCommand: TSent, receivedCommand: TReceived) => CCResponseRole;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;AAAA,kBAwCO;AACP,oBAQO;AACP,wBAAwB;AAExB,oCAUO;AACP,uCAIO;AACP,oBAKO;AA0DD,SAAU,sBACf,KACA,IACA,gBAAuB;AAIvB,MACC,OAAO,GAAG,WAAW,YAClB,GAAG,WAAW,iCACd,GAAG,WAAW,kCAChB;AACD,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@ export type AlarmSensorValueMetadata = ValueMetadata & {
|
|
|
20
20
|
sensorType: AlarmSensorType;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
export declare enum ApplicationStatusCommand {
|
|
24
|
+
Busy = 1,
|
|
25
|
+
RejectedRequest = 2
|
|
26
|
+
}
|
|
27
|
+
export declare enum ApplicationStatus {
|
|
28
|
+
TryAgainLater = 0,
|
|
29
|
+
TryAgainInWaitTimeSeconds = 1,
|
|
30
|
+
RequestQueued = 2
|
|
31
|
+
}
|
|
23
32
|
export declare enum AssociationCommand {
|
|
24
33
|
Set = 1,
|
|
25
34
|
Get = 2,
|
package/build/cjs/lib/_Types.js
CHANGED
|
@@ -21,6 +21,8 @@ var Types_exports = {};
|
|
|
21
21
|
__export(Types_exports, {
|
|
22
22
|
AlarmSensorCommand: () => AlarmSensorCommand,
|
|
23
23
|
AlarmSensorType: () => AlarmSensorType,
|
|
24
|
+
ApplicationStatus: () => ApplicationStatus,
|
|
25
|
+
ApplicationStatusCommand: () => ApplicationStatusCommand,
|
|
24
26
|
AssociationCheckResult: () => AssociationCheckResult,
|
|
25
27
|
AssociationCommand: () => AssociationCommand,
|
|
26
28
|
AssociationGroupInfoCommand: () => AssociationGroupInfoCommand,
|
|
@@ -167,6 +169,17 @@ var AlarmSensorType;
|
|
|
167
169
|
AlarmSensorType2[AlarmSensorType2["Water Leak"] = 5] = "Water Leak";
|
|
168
170
|
AlarmSensorType2[AlarmSensorType2["Any"] = 255] = "Any";
|
|
169
171
|
})(AlarmSensorType || (AlarmSensorType = {}));
|
|
172
|
+
var ApplicationStatusCommand;
|
|
173
|
+
(function(ApplicationStatusCommand2) {
|
|
174
|
+
ApplicationStatusCommand2[ApplicationStatusCommand2["Busy"] = 1] = "Busy";
|
|
175
|
+
ApplicationStatusCommand2[ApplicationStatusCommand2["RejectedRequest"] = 2] = "RejectedRequest";
|
|
176
|
+
})(ApplicationStatusCommand || (ApplicationStatusCommand = {}));
|
|
177
|
+
var ApplicationStatus;
|
|
178
|
+
(function(ApplicationStatus2) {
|
|
179
|
+
ApplicationStatus2[ApplicationStatus2["TryAgainLater"] = 0] = "TryAgainLater";
|
|
180
|
+
ApplicationStatus2[ApplicationStatus2["TryAgainInWaitTimeSeconds"] = 1] = "TryAgainInWaitTimeSeconds";
|
|
181
|
+
ApplicationStatus2[ApplicationStatus2["RequestQueued"] = 2] = "RequestQueued";
|
|
182
|
+
})(ApplicationStatus || (ApplicationStatus = {}));
|
|
170
183
|
var AssociationCommand;
|
|
171
184
|
(function(AssociationCommand2) {
|
|
172
185
|
AssociationCommand2[AssociationCommand2["Set"] = 1] = "Set";
|
|
@@ -1560,6 +1573,8 @@ var NetworkTransferStatus;
|
|
|
1560
1573
|
0 && (module.exports = {
|
|
1561
1574
|
AlarmSensorCommand,
|
|
1562
1575
|
AlarmSensorType,
|
|
1576
|
+
ApplicationStatus,
|
|
1577
|
+
ApplicationStatusCommand,
|
|
1563
1578
|
AssociationCheckResult,
|
|
1564
1579
|
AssociationCommand,
|
|
1565
1580
|
AssociationGroupInfoCommand,
|