@zwave-js/cc 15.24.3 → 15.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/build/cjs/cc/AssociationCC.d.ts +1 -1
  2. package/build/cjs/cc/AssociationCC.js +6 -3
  3. package/build/cjs/cc/AssociationCC.js.map +2 -2
  4. package/build/cjs/cc/AssociationGroupInfoCC.js +5 -1
  5. package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
  6. package/build/cjs/cc/ColorSwitchCC.js +5 -2
  7. package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
  8. package/build/cjs/cc/ConfigurationCC.d.ts +14 -3
  9. package/build/cjs/cc/ConfigurationCC.js +65 -19
  10. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  11. package/build/cjs/cc/IndicatorCC.js +7 -3
  12. package/build/cjs/cc/IndicatorCC.js.map +2 -2
  13. package/build/cjs/cc/IrrigationCC.js +6 -2
  14. package/build/cjs/cc/IrrigationCC.js.map +2 -2
  15. package/build/cjs/cc/MeterCC.js +6 -1
  16. package/build/cjs/cc/MeterCC.js.map +2 -2
  17. package/build/cjs/cc/MultiChannelAssociationCC.d.ts +1 -1
  18. package/build/cjs/cc/MultiChannelAssociationCC.js +6 -3
  19. package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
  20. package/build/cjs/cc/MultiChannelCC.d.ts +1 -1
  21. package/build/cjs/cc/MultiChannelCC.js +4 -2
  22. package/build/cjs/cc/MultiChannelCC.js.map +2 -2
  23. package/build/cjs/cc/MultilevelSensorCC.js +7 -3
  24. package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
  25. package/build/cjs/cc/NotificationCC.js +9 -2
  26. package/build/cjs/cc/NotificationCC.js.map +2 -2
  27. package/build/cjs/cc/SceneControllerConfigurationCC.js +1 -0
  28. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
  29. package/build/cjs/cc/SecurityCC.d.ts +2 -2
  30. package/build/cjs/cc/SecurityCC.js +6 -4
  31. package/build/cjs/cc/SecurityCC.js.map +2 -2
  32. package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +1 -1
  33. package/build/cjs/cc/ThermostatOperatingStateCC.js +2 -2
  34. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
  35. package/build/cjs/cc/ThermostatSetpointCC.js +8 -3
  36. package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
  37. package/build/cjs/cc/TransportServiceCC.d.ts +0 -14
  38. package/build/cjs/cc/TransportServiceCC.js +0 -41
  39. package/build/cjs/cc/TransportServiceCC.js.map +2 -2
  40. package/build/cjs/cc/UserCodeCC.js +5 -1
  41. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  42. package/build/cjs/cc/UserCredentialCC.d.ts +2 -2
  43. package/build/cjs/cc/UserCredentialCC.js +7 -3
  44. package/build/cjs/cc/UserCredentialCC.js.map +2 -2
  45. package/build/cjs/cc/VersionCC.js +7 -5
  46. package/build/cjs/cc/VersionCC.js.map +2 -2
  47. package/build/cjs/cc/WindowCoveringCC.js +6 -4
  48. package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
  49. package/build/cjs/lib/CommandClass.d.ts +15 -6
  50. package/build/cjs/lib/CommandClass.js +10 -5
  51. package/build/cjs/lib/CommandClass.js.map +2 -2
  52. package/build/cjs/lib/traits.d.ts +16 -1
  53. package/build/esm/cc/AssociationCC.d.ts +1 -1
  54. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  55. package/build/esm/cc/AssociationCC.js +6 -3
  56. package/build/esm/cc/AssociationCC.js.map +1 -1
  57. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  58. package/build/esm/cc/AssociationGroupInfoCC.js +7 -1
  59. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  60. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  61. package/build/esm/cc/ColorSwitchCC.js +5 -2
  62. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  63. package/build/esm/cc/ConfigurationCC.d.ts +14 -3
  64. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  65. package/build/esm/cc/ConfigurationCC.js +98 -25
  66. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  67. package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
  68. package/build/esm/cc/IndicatorCC.js +8 -3
  69. package/build/esm/cc/IndicatorCC.js.map +1 -1
  70. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  71. package/build/esm/cc/IrrigationCC.js +6 -2
  72. package/build/esm/cc/IrrigationCC.js.map +1 -1
  73. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  74. package/build/esm/cc/MeterCC.js +6 -1
  75. package/build/esm/cc/MeterCC.js.map +1 -1
  76. package/build/esm/cc/MultiChannelAssociationCC.d.ts +1 -1
  77. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  78. package/build/esm/cc/MultiChannelAssociationCC.js +6 -3
  79. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  80. package/build/esm/cc/MultiChannelCC.d.ts +1 -1
  81. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  82. package/build/esm/cc/MultiChannelCC.js +4 -2
  83. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  84. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  85. package/build/esm/cc/MultilevelSensorCC.js +7 -3
  86. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  87. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  88. package/build/esm/cc/NotificationCC.js +9 -2
  89. package/build/esm/cc/NotificationCC.js.map +1 -1
  90. package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  91. package/build/esm/cc/SceneControllerConfigurationCC.js +1 -0
  92. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  93. package/build/esm/cc/SecurityCC.d.ts +2 -2
  94. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  95. package/build/esm/cc/SecurityCC.js +7 -4
  96. package/build/esm/cc/SecurityCC.js.map +1 -1
  97. package/build/esm/cc/ThermostatOperatingStateCC.d.ts +1 -1
  98. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  99. package/build/esm/cc/ThermostatOperatingStateCC.js +2 -2
  100. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  101. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  102. package/build/esm/cc/ThermostatSetpointCC.js +10 -3
  103. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  104. package/build/esm/cc/TransportServiceCC.d.ts +0 -14
  105. package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
  106. package/build/esm/cc/TransportServiceCC.js +1 -54
  107. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  108. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  109. package/build/esm/cc/UserCodeCC.js +4 -0
  110. package/build/esm/cc/UserCodeCC.js.map +1 -1
  111. package/build/esm/cc/UserCredentialCC.d.ts +2 -2
  112. package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
  113. package/build/esm/cc/UserCredentialCC.js +7 -4
  114. package/build/esm/cc/UserCredentialCC.js.map +1 -1
  115. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  116. package/build/esm/cc/VersionCC.js +12 -6
  117. package/build/esm/cc/VersionCC.js.map +1 -1
  118. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  119. package/build/esm/cc/WindowCoveringCC.js +7 -5
  120. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  121. package/build/esm/lib/CommandClass.d.ts +15 -6
  122. package/build/esm/lib/CommandClass.d.ts.map +1 -1
  123. package/build/esm/lib/CommandClass.js +10 -5
  124. package/build/esm/lib/CommandClass.js.map +1 -1
  125. package/build/esm/lib/traits.d.ts +16 -1
  126. package/build/esm/lib/traits.d.ts.map +1 -1
  127. package/package.json +4 -4
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/NotificationCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./NotificationCC._validateArgs.js\";\nconst { validateArgs_NotificationCCAPI_sendReport, validateArgs_NotificationCCAPI_get, validateArgs_NotificationCCAPI_set, validateArgs_NotificationCCAPI_getSupportedEvents } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, type ControlsCC, Duration, type EndpointId, type GetEndpoint, type GetNode, type GetSupportedCCVersion, type GetValueDB, type LogNode, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, type Notification, type NotificationState, type NotificationValue, SecurityClass, type SinglecastCC, type SupervisionResult, type SupportsCC, type ValueID, ValueMetadata, type ValueMetadataNumeric, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, getCCName, getNotification, getNotificationEventName, getNotificationName, getNotificationValue, getNotificationValueName, isZWaveError, parseBitMask, timespan, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex, isUint8Array, num2hex, pick, } from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport { CCAPI, POLL_VALUE, PhysicalCCAPI, type PollValueImplementation, throwUnsupportedProperty, } from \"../lib/API.js\";\nimport { CCRaw, CommandClass, type InterviewContext, InvalidCC, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, getEffectiveCCVersion, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, getCCCommandConstructor, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { isNotificationEventPayload } from \"../lib/NotificationEventPayload.js\";\nimport { V } from \"../lib/Values.js\";\nimport { NotificationCommand, UserCodeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { ApplicationStatusCCRejectedRequest } from \"./ApplicationStatusCC.js\";\nimport { AssociationGroupInfoCC } from \"./AssociationGroupInfoCC.js\";\nimport { NotificationCCValues } from \"./_CCValues.generated.js\";\nexport { NotificationCCValues };\nexport function shouldAutoCreateSyntheticDoorSensorValue(ctx: GetValueDB, endpoint: EndpointId): boolean {\n const valueDB = ctx.tryGetValueDB(endpoint.nodeId);\n if (!valueDB)\n return false;\n const supportedACEvents = valueDB.getValue<readonly number[]>(NotificationCCValues.supportedNotificationEvents(\n // Access Control\n 0x06).endpoint(endpoint.index));\n if (!supportedACEvents)\n return false;\n return (supportedACEvents.includes(\n // Window/door is open\n 0x16)\n && supportedACEvents.includes(\n // Window/door is closed\n 0x17));\n}\n@API(CommandClasses.Notification)\nexport class NotificationCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: NotificationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case NotificationCommand.Report:\n case NotificationCommand.Get:\n return true; // These exist starting with V1\n case NotificationCommand.Set:\n case NotificationCommand.SupportedGet:\n return this.version >= 2;\n case NotificationCommand.EventSupportedGet:\n return this.version >= 3;\n }\n return super.supportsCommand(cmd);\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: NotificationCCAPI, { property, propertyKey }) {\n const valueId: ValueID = {\n commandClass: this.ccId,\n endpoint: this.endpoint.index,\n property,\n propertyKey,\n };\n if (NotificationCCValues.notificationVariable.is(valueId)) {\n const notificationType: number | undefined = this\n .tryGetValueDB()?.getMetadata(valueId)?.ccSpecific\n ?.notificationType;\n if (notificationType != undefined) {\n return this.getInternal({ notificationType });\n }\n }\n throwUnsupportedProperty(this.ccId, property);\n };\n }\n /**\n * @internal\n */\n public async getInternal(options: NotificationCCGetOptions): Promise<NotificationCCReport | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Get);\n const cc = new NotificationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand<NotificationCCReport>(cc, this.commandOptions);\n }\n @validateArgs_NotificationCCAPI_sendReport()\n public async sendReport(options: NotificationCCReportOptions): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Report);\n const cc = new NotificationCCReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_NotificationCCAPI_get()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get(options: NotificationCCGetOptions) {\n const response = await this.getInternal(options);\n if (response) {\n return pick(response, [\n \"notificationStatus\",\n \"notificationEvent\",\n \"alarmLevel\",\n \"eventParameters\",\n \"sequenceNumber\",\n ]);\n }\n }\n @validateArgs_NotificationCCAPI_set()\n public async set(notificationType: number, notificationStatus: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Set);\n const cc = new NotificationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n notificationType,\n notificationStatus,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.SupportedGet);\n const cc = new NotificationCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<NotificationCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"supportsV1Alarm\",\n \"supportedNotificationTypes\",\n ]);\n }\n }\n @validateArgs_NotificationCCAPI_getSupportedEvents()\n public async getSupportedEvents(notificationType: number): Promise<MaybeNotKnown<readonly number[]>> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.EventSupportedGet);\n const cc = new NotificationCCEventSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n notificationType,\n });\n const response = await this.host.sendCommand<NotificationCCEventSupportedReport>(cc, this.commandOptions);\n return response?.supportedEvents;\n }\n}\nexport function getNotificationEnumBehavior(notification: Notification, valueConfig: NotificationState): \"none\" | \"extend\" | \"replace\" {\n const variable = notification.variables.find((v) => v.states.has(valueConfig.value));\n if (!variable)\n return \"none\";\n const numStatesWithEnums = [...variable.states.values()].filter((val) => val.parameter?.type === \"enum\").length;\n if (numStatesWithEnums === 0)\n return \"none\";\n // An enum value replaces the original value if there is only a single possible state\n // which also has an enum parameter\n if (numStatesWithEnums === 1 && variable.states.size === 1) {\n return \"replace\";\n }\n return \"extend\";\n}\nexport function getNotificationStateValueWithEnum(stateValue: number, enumValue: number): number {\n return (stateValue << 8) | enumValue;\n}\n/**\n * Returns the metadata to use for a known notification value.\n * Can be used to extend a previously defined metadata,\n * e.g. for V2 notifications that don't allow discovering supported events.\n */\nexport function getNotificationValueMetadata(previous: ValueMetadataNumeric | undefined, notification: Notification, valueConfig: NotificationState): ValueMetadataNumeric {\n const metadata: ValueMetadataNumeric = previous ?? {\n ...ValueMetadata.ReadOnlyUInt8,\n label: valueConfig.variableName,\n states: {},\n ccSpecific: {\n notificationType: notification.type,\n },\n };\n if (valueConfig.idle) {\n metadata.states![0] = \"idle\";\n }\n const enumBehavior = getNotificationEnumBehavior(notification, valueConfig);\n if (enumBehavior !== \"replace\") {\n metadata.states![valueConfig.value] = valueConfig.label;\n }\n if (valueConfig.parameter?.type === \"enum\") {\n for (const [key, label] of Object.entries(valueConfig.parameter.values)) {\n const value = parseInt(key);\n const stateKey = enumBehavior === \"replace\"\n ? value\n : getNotificationStateValueWithEnum(valueConfig.value, value);\n metadata.states![stateKey] = label;\n }\n }\n return metadata;\n}\n@commandClass(CommandClasses.Notification)\n@implementedVersion(8)\n@ccValues(NotificationCCValues)\nexport class NotificationCC extends CommandClass {\n declare ccCommand: NotificationCommand;\n // former AlarmCC (v1..v2)\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n CommandClasses[\"Association Group Information\"],\n ];\n }\n private async determineNotificationMode(ctx: GetValueDB & GetNode<NodeId & SupportsCC> & LogNode, api: NotificationCCAPI, supportedNotificationEvents: ReadonlyMap<number, readonly number[]>): Promise<\"push\" | \"pull\"> {\n const node = this.getNode(ctx)!;\n // SDS14223: If the supporting node does not support the Association Command Class,\n // it may be concluded that the supporting node implements Pull Mode and discovery may be aborted.\n if (!node.supportsCC(CommandClasses.Association))\n return \"pull\";\n if (node.supportsCC(CommandClasses[\"Association Group Information\"])) {\n try {\n const groupsIssueingNotifications = AssociationGroupInfoCC\n .findGroupsForIssuedCommand(ctx, node, this.ccId, NotificationCommand.Report);\n return groupsIssueingNotifications.length > 0 ? \"push\" : \"pull\";\n }\n catch {\n // We might be dealing with an older cache file, fall back to testing\n }\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `determining whether this node is pull or push...`,\n direction: \"outbound\",\n });\n // Find a notification type with at least one supported event\n for (const [type, events] of supportedNotificationEvents) {\n if (events.length === 0)\n continue;\n // Enable the event and request the status\n await api.set(type, true);\n try {\n const resp = await api.get({\n notificationType: type,\n notificationEvent: events[0],\n });\n switch (resp?.notificationStatus) {\n case 0xff:\n return \"push\";\n case 0xfe:\n case 0x00:\n return \"pull\";\n }\n }\n catch {\n /* ignore */\n }\n }\n // If everything failed, e.g. because the node is V1/V2, assume this is a \"push\" node.\n // If we assumed \"pull\", we would have to query the node regularly, which can cause\n // the node to return old (already handled) notifications.\n // https://github.com/zwave-js/zwave-js/issues/5626\n return \"push\";\n }\n /** Whether the node implements push or pull notifications */\n public static getNotificationMode(ctx: GetValueDB, node: NodeId): MaybeNotKnown<\"push\" | \"pull\"> {\n return ctx\n .getValueDB(node.id)\n .getValue(NotificationCCValues.notificationMode.id);\n }\n /** Returns the supported notification events for a given notification type */\n public static getSupportedNotificationEvents(ctx: GetValueDB, node: NodeId, type: number): MaybeNotKnown<readonly number[]> {\n return ctx\n .getValueDB(node.id)\n .getValue(NotificationCCValues.supportedNotificationEvents(type).id);\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // If one Association group issues Notification Reports,\n // we must associate ourselves with that channel\n try {\n await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, NotificationCommand.Report);\n }\n catch {\n ctx.logNode(node.id, {\n endpoint: endpoint.index,\n message: `Configuring associations to receive ${getCCName(this.ccId)} reports failed!`,\n level: \"warn\",\n });\n }\n let supportsV1Alarm = false;\n if (api.version >= 2) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported notification types...\",\n direction: \"outbound\",\n });\n const suppResponse = await api.getSupported();\n if (!suppResponse) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported notification types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n supportsV1Alarm = suppResponse.supportsV1Alarm;\n const supportedNotificationTypes = suppResponse.supportedNotificationTypes;\n const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);\n const supportedNotificationEvents = new Map<number, readonly number[]>();\n const logMessage = `received supported notification types:${supportedNotificationNames\n .map((name) => `\\n\u00B7 ${name}`)\n .join(\"\")}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n if (api.version >= 3) {\n // Query each notification for its supported events\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying supported notification events for ${name}...`,\n direction: \"outbound\",\n });\n const supportedEvents = await api.getSupportedEvents(type);\n if (supportedEvents) {\n supportedNotificationEvents.set(type, supportedEvents);\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `received supported notification events for ${name}: ${supportedEvents\n .map(String)\n .join(\", \")}`,\n direction: \"inbound\",\n });\n }\n }\n }\n // Determine whether the node is a push or pull node\n let notificationMode = this.getValue<\"push\" | \"pull\">(ctx, NotificationCCValues.notificationMode);\n if (notificationMode !== \"push\" && notificationMode !== \"pull\") {\n notificationMode = await this.determineNotificationMode(ctx, api, supportedNotificationEvents);\n this.setValue(ctx, NotificationCCValues.notificationMode, notificationMode);\n }\n if (notificationMode === \"pull\") {\n await this.refreshValues(ctx);\n } /* if (notificationMode === \"push\") */\n else {\n // First, query the current state of each supported notification\n await this.refreshValues(ctx);\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n // Enable reports for each notification type\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `enabling notifications for ${name}...`,\n direction: \"outbound\",\n });\n await api.set(type, true);\n }\n }\n }\n // Only create metadata for V1 values if necessary\n if (api.version === 1 || supportsV1Alarm) {\n this.ensureMetadata(ctx, NotificationCCValues.alarmType);\n this.ensureMetadata(ctx, NotificationCCValues.alarmLevel);\n }\n // Create metadata and internal values for alarm mappings\n this.applyAlarmMappingCompat(ctx);\n // Apply notification remappings\n this.applyNotificationRemappings(ctx);\n // Set idle values from (potentially remapped) supported events\n this.initNotificationIdleValues(ctx);\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n /**\n * Applies the `alarmMapping` compat flag by adding metadata and supported notification\n * types/events for the alarm mapping targets.\n */\n private applyAlarmMappingCompat(ctx: InterviewContext): void {\n const mappings = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.alarmMapping;\n if (!mappings)\n return;\n const node = this.getNode(ctx)!;\n const supportedNotifications = new Map<number, Set<number>>();\n // Preserve the notification types and events discovered during the interview\n for (const type of (this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [])) {\n supportedNotifications.set(type, new Set(NotificationCC.getSupportedNotificationEvents(ctx, node, type) ?? []));\n }\n // Find all mappings to a valid notification variable\n for (const { to } of mappings) {\n const notification = getNotification(to.notificationType);\n if (!notification)\n continue;\n const valueConfig = getNotificationValue(notification, to.notificationEvent);\n // Remember supported notification types and events to create the internal values later\n if (!supportedNotifications.has(to.notificationType)) {\n supportedNotifications.set(to.notificationType, new Set());\n }\n const supportedNotificationTypesSet = supportedNotifications\n .get(to.notificationType)!;\n supportedNotificationTypesSet.add(to.notificationEvent);\n if (valueConfig?.type !== \"state\")\n continue;\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n // Create or update the metadata\n const metadata = getNotificationValueMetadata(this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n }\n // Remember supported notification types and events in the cache\n this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);\n for (const [type, events] of supportedNotifications) {\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);\n }\n }\n /**\n * Applies the `remapNotifications` compat flag by modifying the supported notification\n * types/events in cache and creating metadata for remapping targets.\n */\n private applyNotificationRemappings(ctx: InterviewContext): void {\n const remappings = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.remapNotifications;\n if (!remappings?.length)\n return;\n ctx.logNode(this.nodeId as number, {\n message: `Applying notification remapping compat flag...`,\n direction: \"none\",\n level: \"verbose\",\n });\n // Load current supported types and events from cache\n const supportedTypes = new Set<number>(this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? []);\n const supportedEvents = new Map<number, Set<number>>();\n for (const type of supportedTypes) {\n const events = NotificationCC.getSupportedNotificationEvents(ctx, this.getNode(ctx)!, type);\n if (events) {\n supportedEvents.set(type, new Set(events));\n }\n }\n for (const mapping of remappings) {\n // Remove the original event from supported events\n const fromEvents = supportedEvents.get(mapping.from.notificationType);\n if (fromEvents) {\n fromEvents.delete(mapping.from.notificationEvent);\n if (fromEvents.size === 0) {\n supportedEvents.delete(mapping.from.notificationType);\n supportedTypes.delete(mapping.from.notificationType);\n }\n }\n // Only add target events for normal remaps\n if (mapping.action.type === \"remap\") {\n const to = mapping.action.to;\n supportedTypes.add(to.notificationType);\n if (!supportedEvents.has(to.notificationType)) {\n supportedEvents.set(to.notificationType, new Set());\n }\n supportedEvents.get(to.notificationType)!.add(to.notificationEvent);\n }\n }\n // Persist updated supported types and events\n this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedTypes]);\n for (const [type, events] of supportedEvents) {\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);\n }\n // Rebuild metadata for all supported events (since we may have removed\n // some events and added others, the previous metadata may be stale)\n for (const [type, events] of supportedEvents) {\n const notification = getNotification(type);\n if (!notification)\n continue;\n let isFirst = true;\n for (const value of events) {\n const valueConfig = getNotificationValue(notification, value);\n if (valueConfig?.type !== \"state\")\n continue;\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n const metadata = getNotificationValueMetadata(isFirst\n ? undefined\n : this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n isFirst = false;\n }\n }\n }\n /**\n * Sets idle values for all supported notification variables that have an idle state\n * and don't have a value yet.\n */\n private initNotificationIdleValues(ctx: InterviewContext): void {\n const supportedTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];\n for (const type of supportedTypes) {\n const notification = getNotification(type);\n if (!notification)\n continue;\n // Reads supported events from cache so it works correctly\n // after compat remappings have been applied.\n const events = NotificationCC.getSupportedNotificationEvents(ctx, this.getNode(ctx)!, type);\n if (!events)\n continue;\n // Find all variables that are supported by this node and have an idle state\n for (const variable of notification.variables\n .filter((v) => !!v.idle)) {\n if ([...variable.states.keys()].some((key) => events.includes(key))) {\n const value = NotificationCCValues\n .notificationVariable(notification.name, variable.name);\n // Set the value to idle if it has no value yet\n // TODO: GH#1028\n // * do this only if the last update was more than 5 minutes ago\n // * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start\n if (this.getValue(ctx, value) == undefined) {\n this.setValue(ctx, value, 0);\n }\n }\n }\n }\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n // Load supported notification types and events from cache\n const supportedNotificationTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];\n const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n // Always query each notification for its current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying notification status for ${name}...`,\n direction: \"outbound\",\n });\n const response = await api.getInternal({\n notificationType: type,\n });\n // NotificationReports don't store their values themselves,\n // because the behaviour is too complex and spans the lifetime\n // of several reports. Thus we handle it in the Node instance\n if (response) {\n // @ts-expect-error\n await node.handleCommand(response);\n }\n }\n // Remember when we did this\n this.setValue(ctx, NotificationCCValues.lastRefresh, Date.now());\n }\n public shouldRefreshValues(this: SinglecastCC<this>, ctx: GetValueDB & GetSupportedCCVersion & GetDeviceConfig & GetNode<NodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>>): boolean {\n // Pull-mode nodes must be polled regularly\n const isPullMode = NotificationCC.getNotificationMode(ctx, this.getNode(ctx)!) === \"pull\";\n if (!isPullMode)\n return false;\n const lastUpdated = this.getValue<number>(ctx, NotificationCCValues.lastRefresh);\n return (lastUpdated == undefined\n || Date.now() - lastUpdated > timespan.hours(6));\n }\n}\n// @publicAPI\nexport interface NotificationCCSetOptions {\n notificationType: number;\n notificationStatus: boolean;\n}\nfunction getCCResponseForNotificationCCSet(ctx: GetNode<NodeId & SupportsCC>, sent: NotificationCCSet) {\n // CC:0071.03.06.11.008: A receiving node MAY deny the deactivation\n // of a specific Notification Type. In that case, the receiving node\n // MUST respond to this command with an Application Rejected Request\n // Command.\n if (sent.isSinglecast()\n && !sent.notificationStatus\n && !sent.isEncapsulatedWith(CommandClasses.Supervision)\n && ctx.getNode(sent.nodeId)?.supportsCC(CommandClasses[\"Application Status\"])) {\n return ApplicationStatusCCRejectedRequest;\n }\n}\n@CCCommand(NotificationCommand.Set)\n@expectedCCResponse(getCCResponseForNotificationCCSet)\n@useSupervision()\nexport class NotificationCCSet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCSetOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n this.notificationStatus = options.notificationStatus;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCSet {\n validatePayload(raw.payload.length >= 2);\n const notificationType = raw.payload[0];\n const notificationStatus = raw.payload[1] === 0xff;\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n notificationStatus,\n });\n }\n public notificationType: number;\n public notificationStatus: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.notificationType,\n this.notificationStatus ? 0xff : 0x00,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n status: this.notificationStatus,\n },\n };\n }\n}\n// @publicAPI\nexport type NotificationCCReportOptions = {\n alarmType?: number;\n alarmLevel?: number;\n notificationType?: number;\n notificationEvent?: number;\n notificationStatus?: number;\n eventParameters?: BytesView;\n sequenceNumber?: number;\n};\n@CCCommand(NotificationCommand.Report)\n@useSupervision()\nexport class NotificationCCReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCReportOptions>) {\n super(options);\n if (options.alarmType != undefined) {\n this.alarmType = options.alarmType;\n this.alarmLevel = options.alarmLevel;\n }\n if (options.notificationType != undefined) {\n this.notificationType = options.notificationType;\n this.notificationStatus = options.notificationStatus ?? true;\n this.notificationEvent = options.notificationEvent;\n this.eventParameters = options.eventParameters;\n this.sequenceNumber = options.sequenceNumber;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCReport {\n validatePayload(raw.payload.length >= 2);\n const alarmType = raw.payload[0];\n const alarmLevel = raw.payload[1];\n // Byte 2 used to be zensorNetSourceNodeId in V2 and V3, but we don't care about that\n if (raw.payload.length < 7) {\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n alarmLevel,\n });\n }\n // V2+ requires the alarm bytes to be zero. Manufacturers don't care though, so we don't enforce that.\n // Don't use the version to decide because we might discard notifications\n // before the interview is complete\n const notificationStatus = raw.payload[3];\n const notificationType = raw.payload[4];\n const notificationEvent = raw.payload[5];\n const containsSeqNum = !!(raw.payload[6] & 128);\n const numEventParams = raw.payload[6] & 0b11111;\n let eventParameters: BytesView | undefined;\n if (numEventParams > 0) {\n validatePayload(raw.payload.length >= 7 + numEventParams);\n eventParameters = raw.payload.subarray(7, 7 + numEventParams);\n }\n let sequenceNumber: number | undefined;\n if (containsSeqNum) {\n validatePayload(raw.payload.length >= 7 + numEventParams + 1);\n sequenceNumber = raw.payload[7 + numEventParams];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n alarmLevel,\n notificationStatus,\n notificationType,\n notificationEvent,\n eventParameters,\n sequenceNumber,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const ccVersion = getEffectiveCCVersion(ctx, this);\n // Check if we need to re-interpret the alarm values somehow\n if (this.alarmType != undefined\n && this.alarmLevel != undefined\n && this.alarmType !== 0) {\n if (ccVersion >= 2) {\n // Check if the device actually supports Notification CC, but chooses\n // to send Alarm frames instead (GH#1034)\n const supportedNotificationTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes);\n if (isArray(supportedNotificationTypes)\n && supportedNotificationTypes.includes(this.alarmType)) {\n const supportedNotificationEvents = NotificationCC\n .getSupportedNotificationEvents(ctx, this.getNode(ctx)!, this.alarmType);\n if (isArray(supportedNotificationEvents)\n && supportedNotificationEvents.includes(this.alarmLevel)) {\n // This alarm frame corresponds to a valid notification event\n ctx.logNode(this.nodeId as number, `treating V1 Alarm frame as Notification Report`);\n this.notificationType = this.alarmType;\n this.notificationEvent = this.alarmLevel;\n this.alarmType = undefined;\n this.alarmLevel = undefined;\n }\n }\n }\n else {\n // V1 Alarm, check if there is a compat option to map this V1 report to a V2+ report\n const mapping = ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.alarmMapping;\n const match = mapping?.find((m) => m.from.alarmType === this.alarmType\n && (m.from.alarmLevel == undefined\n || m.from.alarmLevel === this.alarmLevel));\n if (match) {\n ctx.logNode(this.nodeId as number, `compat mapping found, treating V1 Alarm frame as Notification Report`);\n this.notificationType = match.to.notificationType;\n this.notificationEvent = match.to.notificationEvent;\n if (match.to.eventParameters) {\n this.eventParameters = {};\n for (const [key, val] of Object.entries(match.to.eventParameters)) {\n if (typeof val === \"number\") {\n this.eventParameters[key] = val;\n }\n else if (val === \"alarmLevel\") {\n this.eventParameters[key] = this.alarmLevel;\n }\n }\n }\n // After mapping we do not set the legacy V1 values to undefined\n // Otherwise, adding a new mapping will be a breaking change\n }\n }\n }\n // Now we can interpret the event parameters and turn them into something useful\n this.parseEventParameters(ctx);\n if (this.alarmType != undefined) {\n const alarmTypeValue = NotificationCCValues.alarmType;\n this.ensureMetadata(ctx, alarmTypeValue);\n this.setValue(ctx, alarmTypeValue, this.alarmType);\n }\n if (this.alarmLevel != undefined) {\n const alarmLevelValue = NotificationCCValues.alarmLevel;\n this.ensureMetadata(ctx, alarmLevelValue);\n this.setValue(ctx, alarmLevelValue, this.alarmLevel);\n }\n return true;\n }\n public alarmType: number | undefined;\n public alarmLevel: number | undefined;\n public notificationType: number | undefined;\n public notificationStatus: boolean | number | undefined;\n public notificationEvent: number | undefined;\n public eventParameters: BytesView | Duration | Record<string, number> | number | undefined;\n public sequenceNumber: number | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n let message: MessageRecord = {};\n if (this.alarmType) {\n message = {\n \"V1 alarm type\": this.alarmType,\n \"V1 alarm level\": this.alarmLevel!,\n };\n }\n let valueConfig: NotificationValue | undefined;\n if (this.notificationType) {\n const notification = getNotification(this.notificationType);\n if (notification) {\n valueConfig = getNotificationValue(notification, this.notificationEvent!);\n }\n if (valueConfig) {\n message = {\n ...message,\n \"notification type\": getNotificationName(this.notificationType),\n \"notification status\": this.notificationStatus!,\n [`notification ${valueConfig.type}`]: valueConfig.label\n ?? `Unknown (${num2hex(this.notificationEvent)})`,\n };\n }\n else if (this.notificationEvent === 0x00) {\n message = {\n ...message,\n \"notification type\": this.notificationType,\n \"notification status\": this.notificationStatus!,\n \"notification state\": \"idle\",\n };\n }\n else {\n message = {\n ...message,\n \"notification type\": this.notificationType,\n \"notification status\": this.notificationStatus!,\n \"notification event\": num2hex(this.notificationEvent),\n };\n }\n }\n if (this.sequenceNumber != undefined) {\n message[\"sequence number\"] = this.sequenceNumber;\n }\n if (this.eventParameters != undefined) {\n if (typeof this.eventParameters === \"number\") {\n // Try to look up the enum label\n let found = false;\n if (valueConfig?.parameter?.type === \"enum\") {\n const label = valueConfig.parameter.values[this.eventParameters];\n if (label) {\n message[\"state parameters\"] = label;\n found = true;\n }\n }\n if (!found) {\n message[\"state parameters\"] = num2hex(this.eventParameters);\n }\n }\n else if (isUint8Array(this.eventParameters)) {\n message[\"event parameters\"] = buffer2hex(this.eventParameters);\n }\n else if (this.eventParameters instanceof Duration) {\n message[\"event parameters\"] = this.eventParameters.toString();\n }\n else {\n message[\"event parameters\"] = Object.entries(this.eventParameters)\n .map(([param, val]) => `\\n ${param}: ${num2hex(val)}`)\n .join(\"\");\n }\n }\n else if (valueConfig?.parameter?.type === \"enum\"\n && valueConfig.parameter.default != undefined) {\n const label = valueConfig.parameter.values[valueConfig.parameter.default];\n if (label) {\n message[\"state parameters\"] = `${label} (omitted)`;\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n private parseEventParameters(ctx: PersistValuesContext): void {\n // This only makes sense for V2+ notifications\n if (this.notificationType == undefined\n || this.notificationEvent == undefined) {\n return;\n }\n // Look up the received notification and value in the config\n const notification = getNotification(this.notificationType);\n if (!notification)\n return;\n const valueConfig = getNotificationValue(notification, this.notificationEvent);\n if (!valueConfig)\n return;\n // Parse the event parameters if possible\n if (valueConfig.parameter?.type === \"duration\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // The parameters contain a Duration\n this.eventParameters = Duration.parseReport(this.eventParameters[0]);\n }\n else if (valueConfig.parameter?.type === \"commandclass\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // The parameters **should** contain a CC, however there might be some exceptions\n if (this.eventParameters.length === 1\n && notification.type === 0x06\n && (this.notificationEvent === 0x05\n || this.notificationEvent === 0x06)) {\n // Access control -> Keypad Lock/Unlock operation\n // Some devices only send the User ID, not a complete CC payload\n this.eventParameters = {\n userId: this.eventParameters[0],\n };\n }\n else {\n // Try to parse the event parameters - if this fails, we should still handle the notification report\n try {\n // Convert CommandClass instances to a standardized object representation\n // We do not want to parse asynchronously here, but the `CommandClass.parse` method is async.\n // However, we only deal with simple CCs that can be parsed synchronously. We can do this\n // by replicating what `CommandClass.parse` does: determine the correct CC class and call its\n // `from` method. If that returns a CC instance, we're good to continue.\n const raw = CCRaw.parse(this.eventParameters);\n if (raw.ccCommand == undefined) {\n validatePayload.fail(\"event parameters contain an invalid CC\");\n }\n const CommandConstructor = getCCCommandConstructor(raw.ccId, raw.ccCommand);\n if (!CommandConstructor) {\n validatePayload.fail(\"event parameters contain an invalid CC\");\n }\n const cc = CommandConstructor.from(raw, {\n ...ctx,\n frameType: \"singlecast\",\n sourceNodeId: this.nodeId as number,\n // Security encapsulation is handled outside of this CC,\n // so it is not needed here:\n hasSecurityClass: () => false,\n getHighestSecurityClass: () => SecurityClass.None,\n setSecurityClass: () => { },\n securityManager: undefined,\n securityManager2: undefined,\n securityManagerLR: undefined,\n });\n if (cc instanceof Promise) {\n validatePayload.fail(\"Cannot asynchronously parse CC from event parameters\");\n }\n validatePayload(!(cc instanceof InvalidCC));\n cc.encapsulatingCC = this as any;\n if (isNotificationEventPayload(cc)) {\n this.eventParameters = cc\n .toNotificationEventParameters();\n }\n else {\n // If a CC has no good toJSON() representation, we're only interested in the payload\n let json = cc.toJSON();\n if (\"nodeId\" in json\n && \"ccId\" in json\n && \"payload\" in json) {\n json = pick(json, [\"payload\"]);\n }\n this.eventParameters = json;\n }\n }\n catch (e) {\n if (isZWaveError(e)\n && e.code\n === ZWaveErrorCodes.PacketFormat_InvalidPayload\n && isUint8Array(this.eventParameters)) {\n const { ccId, ccCommand } = CCRaw.parse(this.eventParameters);\n if (ccId === CommandClasses[\"User Code\"]\n && ccCommand === UserCodeCommand.Report\n && this.eventParameters.length >= 3) {\n // Access control -> Keypad Lock/Unlock operation\n // Some devices report the user code with truncated UserCode reports\n this.eventParameters = {\n userId: this.eventParameters[2],\n };\n }\n else {\n ctx.logNode(this.nodeId as number, `Failed to parse Notification CC event parameters, ignoring them...`, \"error\");\n }\n }\n else {\n // unexpected error\n throw e;\n }\n }\n }\n }\n else if (valueConfig.parameter?.type === \"value\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // readUIntBE supports at most 6 bytes; a longer (or empty) value\n // must not reach it, or it throws a RangeError that would escape\n // the parser and crash the driver\n validatePayload(this.eventParameters.length >= 1\n && this.eventParameters.length <= 6);\n // The parameters contain a named value\n this.eventParameters = {\n [valueConfig.parameter.propertyName]: Bytes.view(this.eventParameters)\n .readUIntBE(0, this.eventParameters.length),\n };\n }\n else if (valueConfig.parameter?.type === \"enum\") {\n // The parameters may contain an enum value\n this.eventParameters = isUint8Array(this.eventParameters)\n && this.eventParameters.length === 1\n ? this.eventParameters[0]\n : undefined;\n // Some devices send notifications without an event parameter when they should.\n // In this case, fall back to the default value where possible.\n if (this.eventParameters == undefined\n && valueConfig.parameter.default != undefined) {\n this.eventParameters = valueConfig.parameter.default;\n }\n }\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (this.notificationType != undefined) {\n if (this.notificationEvent == undefined) {\n throw new ZWaveError(`Notification CC reports requires the notification event to be set!`, ZWaveErrorCodes.Argument_Invalid);\n }\n else if (this.eventParameters != undefined\n && !isUint8Array(this.eventParameters)) {\n throw new ZWaveError(`When sending Notification CC reports, the event parameters can only be buffers!`, ZWaveErrorCodes.Argument_Invalid);\n }\n const controlByte = (this.sequenceNumber != undefined ? 128 : 0)\n | ((this.eventParameters?.length ?? 0) & 0b11111);\n this.payload = Bytes.from([\n 0,\n 0,\n 0,\n 0xff,\n this.notificationType,\n this.notificationEvent,\n controlByte,\n ]);\n if (this.eventParameters) {\n this.payload = Bytes.concat([\n this.payload,\n this.eventParameters,\n ]);\n }\n if (this.sequenceNumber != undefined) {\n this.payload = Bytes.concat([\n this.payload,\n [this.sequenceNumber],\n ]);\n }\n }\n else {\n this.payload = Bytes.from([\n this.alarmType ?? 0x00,\n this.alarmLevel ?? 0x00,\n ]);\n }\n return super.serialize(ctx);\n }\n}\n// @publicAPI\nexport type NotificationCCGetOptions = {\n alarmType: number;\n} | {\n notificationType: number;\n notificationEvent?: number;\n};\n@CCCommand(NotificationCommand.Get)\n@expectedCCResponse(NotificationCCReport)\nexport class NotificationCCGet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCGetOptions>) {\n super(options);\n if (\"alarmType\" in options) {\n this.alarmType = options.alarmType;\n }\n else {\n this.notificationType = options.notificationType;\n this.notificationEvent = options.notificationEvent;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCGet {\n validatePayload(raw.payload.length >= 1);\n if (raw.payload.length >= 2) {\n const notificationType = raw.payload[1];\n let notificationEvent: number | undefined;\n if (raw.payload.length >= 3 && notificationType != 0xff) {\n notificationEvent = raw.payload[2];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n notificationEvent,\n });\n }\n else {\n const alarmType = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n });\n }\n }\n /** Proprietary V1/V2 alarm type */\n public alarmType: number | undefined;\n /** Regulated V3+ notification type */\n public notificationType: number | undefined;\n public notificationEvent: number | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const notificationEvent = this.notificationEvent === 0xff\n ? 0x00\n : this.notificationEvent;\n this.payload = Bytes.from([\n this.alarmType ?? 0x00,\n this.notificationType ?? 0xff,\n notificationEvent ?? 0x00,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.alarmType != undefined) {\n message[\"V1 alarm type\"] = this.alarmType;\n }\n if (this.notificationType != undefined) {\n message[\"notification type\"] = getNotificationName(this.notificationType);\n if (this.notificationEvent != undefined) {\n message[\"notification event\"] = getNotificationEventName(this.notificationType, this.notificationEvent);\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface NotificationCCSupportedReportOptions {\n supportsV1Alarm: boolean;\n supportedNotificationTypes: number[];\n}\n@CCCommand(NotificationCommand.SupportedReport)\n@ccValueProperty(\"supportsV1Alarm\", NotificationCCValues.supportsV1Alarm)\n@ccValueProperty(\"supportedNotificationTypes\", NotificationCCValues.supportedNotificationTypes)\nexport class NotificationCCSupportedReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCSupportedReportOptions>) {\n super(options);\n this.supportsV1Alarm = options.supportsV1Alarm;\n this.supportedNotificationTypes = options.supportedNotificationTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const supportsV1Alarm = !!(raw.payload[0] & 128);\n const numBitMaskBytes = raw.payload[0] & 31;\n validatePayload(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);\n const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);\n const supportedNotificationTypes = parseBitMask(notificationBitMask, \n // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0\n 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportsV1Alarm,\n supportedNotificationTypes,\n });\n }\n public supportsV1Alarm: boolean;\n public supportedNotificationTypes: number[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const bitMask = encodeBitMask(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);\n this.payload = Bytes.concat([\n [\n (this.supportsV1Alarm ? 128 : 0) | bitMask.length,\n ],\n bitMask,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supports V1 alarm\": this.supportsV1Alarm,\n \"supported notification types\": this.supportedNotificationTypes\n .map((t) => `\\n\u00B7 ${getNotificationName(t)}`)\n .join(\"\"),\n },\n };\n }\n}\n@CCCommand(NotificationCommand.SupportedGet)\n@expectedCCResponse(NotificationCCSupportedReport)\nexport class NotificationCCSupportedGet extends NotificationCC {\n}\n// @publicAPI\nexport interface NotificationCCEventSupportedReportOptions {\n notificationType: number;\n supportedEvents: number[];\n}\n@CCCommand(NotificationCommand.EventSupportedReport)\nexport class NotificationCCEventSupportedReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCEventSupportedReportOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n this.supportedEvents = options.supportedEvents;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCEventSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const notificationType = raw.payload[0];\n const numBitMaskBytes = raw.payload[1] & 31;\n if (numBitMaskBytes === 0) {\n // Notification type is not supported\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n supportedEvents: [],\n });\n }\n validatePayload(raw.payload.length >= 2 + numBitMaskBytes);\n const eventBitMask = raw.payload.subarray(2, 2 + numBitMaskBytes);\n const supportedEvents = parseBitMask(eventBitMask, \n // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0\n 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n supportedEvents,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Store which events this notification supports\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);\n // For each event, predefine the value metadata\n const notification = getNotification(this.notificationType);\n if (!notification) {\n // This is an unknown notification\n this.setMetadata(ctx, NotificationCCValues.unknownNotificationType(this.notificationType));\n }\n else {\n // This is a standardized notification\n let isFirst = true;\n for (const value of this.supportedEvents) {\n // Find out which property we need to update\n const valueConfig = getNotificationValue(notification, value);\n if (valueConfig?.type === \"state\") {\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n // After we've created the metadata initially, extend it\n const metadata = getNotificationValueMetadata(isFirst\n ? undefined\n : this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n isFirst = false;\n }\n }\n }\n return true;\n }\n public notificationType: number;\n public supportedEvents: number[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.notificationType, 0]);\n if (this.supportedEvents.length > 0) {\n const bitMask = encodeBitMask(this.supportedEvents, Math.max(...this.supportedEvents), 0);\n this.payload[1] = bitMask.length;\n this.payload = Bytes.concat([this.payload, bitMask]);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n \"supported events\": this.supportedEvents\n .map((e) => `\\n\u00B7 ${getNotificationValueName(this.notificationType, e)}`)\n .join(\"\"),\n },\n };\n }\n}\n// @publicAPI\nexport interface NotificationCCEventSupportedGetOptions {\n notificationType: number;\n}\n@CCCommand(NotificationCommand.EventSupportedGet)\n@expectedCCResponse(NotificationCCEventSupportedReport)\nexport class NotificationCCEventSupportedGet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCEventSupportedGetOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCEventSupportedGet {\n validatePayload(raw.payload.length >= 1);\n const notificationType = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n });\n }\n public notificationType: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.notificationType]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n },\n };\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAA6rB;AAC7rB,oBAAgF;AAChF,wBAAwB;AACxB,iBAA0G;AAC1G,0BAA+K;AAC/K,oCAA0J;AAC1J,sCAA2C;AAE3C,mBAAqD;AAErD,cAAyB;AACzB,iCAAmD;AACnD,oCAAuC;AACvC,gCAAqC;AAfrC,MAAM,EAAE,2CAA2C,oCAAoC,oCAAoC,kDAAiD,IAAK;AAiB3K,SAAU,yCAAyC,KAAiB,UAAoB;AAC1F,QAAM,UAAU,IAAI,cAAc,SAAS,MAAM;AACjD,MAAI,CAAC;AACD,WAAO;AACX,QAAM,oBAAoB,QAAQ,SAA4B,+CAAqB;;IAEnF;EAAI,EAAE,SAAS,SAAS,KAAK,CAAC;AAC9B,MAAI,CAAC;AACD,WAAO;AACX,SAAQ,kBAAkB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AK,UAAU,oBAAM,KAAK,CAAC,KAAK,gBAAgB,CAAC;AACjD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,yBAAqB,iCAAoB,KAAK,gBAAgB;;;IAG1E;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./NotificationCC._validateArgs.js\";\nconst { validateArgs_NotificationCCAPI_sendReport, validateArgs_NotificationCCAPI_get, validateArgs_NotificationCCAPI_set, validateArgs_NotificationCCAPI_getSupportedEvents } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, type ControlsCC, Duration, type EndpointId, type GetEndpoint, type GetNode, type GetSupportedCCVersion, type GetValueDB, type LogNode, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, type Notification, type NotificationState, type NotificationValue, SecurityClass, type SinglecastCC, type SupervisionResult, type SupportsCC, type ValueID, ValueMetadata, type ValueMetadataNumeric, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, getCCName, getNotification, getNotificationEventName, getNotificationName, getNotificationValue, getNotificationValueName, isZWaveError, parseBitMask, timespan, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex, isUint8Array, num2hex, pick, } from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport { CCAPI, POLL_VALUE, PhysicalCCAPI, type PollValueImplementation, throwUnsupportedProperty, } from \"../lib/API.js\";\nimport { CCRaw, CommandClass, type InterviewContext, InvalidCC, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, getEffectiveCCVersion, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, getCCCommandConstructor, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { isNotificationEventPayload } from \"../lib/NotificationEventPayload.js\";\nimport { V } from \"../lib/Values.js\";\nimport { NotificationCommand, UserCodeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { ApplicationStatusCCRejectedRequest } from \"./ApplicationStatusCC.js\";\nimport { AssociationGroupInfoCC } from \"./AssociationGroupInfoCC.js\";\nimport { NotificationCCValues } from \"./_CCValues.generated.js\";\nexport { NotificationCCValues };\nexport function shouldAutoCreateSyntheticDoorSensorValue(ctx: GetValueDB, endpoint: EndpointId): boolean {\n const valueDB = ctx.tryGetValueDB(endpoint.nodeId);\n if (!valueDB)\n return false;\n const supportedACEvents = valueDB.getValue<readonly number[]>(NotificationCCValues.supportedNotificationEvents(\n // Access Control\n 0x06).endpoint(endpoint.index));\n if (!supportedACEvents)\n return false;\n return (supportedACEvents.includes(\n // Window/door is open\n 0x16)\n && supportedACEvents.includes(\n // Window/door is closed\n 0x17));\n}\n@API(CommandClasses.Notification)\nexport class NotificationCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: NotificationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case NotificationCommand.Report:\n case NotificationCommand.Get:\n return true; // These exist starting with V1\n case NotificationCommand.Set:\n case NotificationCommand.SupportedGet:\n return this.version >= 2;\n case NotificationCommand.EventSupportedGet:\n return this.version >= 3;\n }\n return super.supportsCommand(cmd);\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: NotificationCCAPI, { property, propertyKey }) {\n const valueId: ValueID = {\n commandClass: this.ccId,\n endpoint: this.endpoint.index,\n property,\n propertyKey,\n };\n if (NotificationCCValues.notificationVariable.is(valueId)) {\n const notificationType: number | undefined = this\n .tryGetValueDB()?.getMetadata(valueId)?.ccSpecific\n ?.notificationType;\n if (notificationType != undefined) {\n return this.getInternal({ notificationType });\n }\n }\n throwUnsupportedProperty(this.ccId, property);\n };\n }\n /**\n * @internal\n */\n public async getInternal(options: NotificationCCGetOptions): Promise<NotificationCCReport | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Get);\n const cc = new NotificationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand<NotificationCCReport>(cc, this.commandOptions);\n }\n @validateArgs_NotificationCCAPI_sendReport()\n public async sendReport(options: NotificationCCReportOptions): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Report);\n const cc = new NotificationCCReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...options,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_NotificationCCAPI_get()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get(options: NotificationCCGetOptions) {\n const response = await this.getInternal(options);\n if (response) {\n return pick(response, [\n \"notificationStatus\",\n \"notificationEvent\",\n \"alarmLevel\",\n \"eventParameters\",\n \"sequenceNumber\",\n ]);\n }\n }\n @validateArgs_NotificationCCAPI_set()\n public async set(notificationType: number, notificationStatus: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.Set);\n const cc = new NotificationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n notificationType,\n notificationStatus,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getSupported() {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.SupportedGet);\n const cc = new NotificationCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<NotificationCCSupportedReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"supportsV1Alarm\",\n \"supportedNotificationTypes\",\n ]);\n }\n }\n @validateArgs_NotificationCCAPI_getSupportedEvents()\n public async getSupportedEvents(notificationType: number): Promise<MaybeNotKnown<readonly number[]>> {\n this.assertSupportsCommand(NotificationCommand, NotificationCommand.EventSupportedGet);\n const cc = new NotificationCCEventSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n notificationType,\n });\n const response = await this.host.sendCommand<NotificationCCEventSupportedReport>(cc, this.commandOptions);\n return response?.supportedEvents;\n }\n}\nexport function getNotificationEnumBehavior(notification: Notification, valueConfig: NotificationState): \"none\" | \"extend\" | \"replace\" {\n const variable = notification.variables.find((v) => v.states.has(valueConfig.value));\n if (!variable)\n return \"none\";\n const numStatesWithEnums = [...variable.states.values()].filter((val) => val.parameter?.type === \"enum\").length;\n if (numStatesWithEnums === 0)\n return \"none\";\n // An enum value replaces the original value if there is only a single possible state\n // which also has an enum parameter\n if (numStatesWithEnums === 1 && variable.states.size === 1) {\n return \"replace\";\n }\n return \"extend\";\n}\nexport function getNotificationStateValueWithEnum(stateValue: number, enumValue: number): number {\n return (stateValue << 8) | enumValue;\n}\n/**\n * Returns the metadata to use for a known notification value.\n * Can be used to extend a previously defined metadata,\n * e.g. for V2 notifications that don't allow discovering supported events.\n */\nexport function getNotificationValueMetadata(previous: ValueMetadataNumeric | undefined, notification: Notification, valueConfig: NotificationState): ValueMetadataNumeric {\n const metadata: ValueMetadataNumeric = previous ?? {\n ...ValueMetadata.ReadOnlyUInt8,\n label: valueConfig.variableName,\n states: {},\n ccSpecific: {\n notificationType: notification.type,\n },\n };\n if (valueConfig.idle) {\n metadata.states![0] = \"idle\";\n }\n const enumBehavior = getNotificationEnumBehavior(notification, valueConfig);\n if (enumBehavior !== \"replace\") {\n metadata.states![valueConfig.value] = valueConfig.label;\n }\n if (valueConfig.parameter?.type === \"enum\") {\n for (const [key, label] of Object.entries(valueConfig.parameter.values)) {\n const value = parseInt(key);\n const stateKey = enumBehavior === \"replace\"\n ? value\n : getNotificationStateValueWithEnum(valueConfig.value, value);\n metadata.states![stateKey] = label;\n }\n }\n return metadata;\n}\n@commandClass(CommandClasses.Notification)\n@implementedVersion(8)\n@ccValues(NotificationCCValues)\nexport class NotificationCC extends CommandClass {\n declare ccCommand: NotificationCommand;\n // former AlarmCC (v1..v2)\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n CommandClasses[\"Multi Channel Association\"],\n CommandClasses[\"Association Group Information\"],\n ];\n }\n private async determineNotificationMode(ctx: GetValueDB & GetNode<NodeId & SupportsCC> & LogNode, api: NotificationCCAPI, supportedNotificationEvents: ReadonlyMap<number, readonly number[]>): Promise<\"push\" | \"pull\"> {\n const node = this.getNode(ctx)!;\n // SDS14223: If the supporting node does not support the Association Command Class,\n // it may be concluded that the supporting node implements Pull Mode and discovery may be aborted.\n if (!node.supportsCC(CommandClasses.Association))\n return \"pull\";\n if (node.supportsCC(CommandClasses[\"Association Group Information\"])) {\n try {\n const groupsIssueingNotifications = AssociationGroupInfoCC\n .findGroupsForIssuedCommand(ctx, node, this.ccId, NotificationCommand.Report);\n return groupsIssueingNotifications.length > 0 ? \"push\" : \"pull\";\n }\n catch {\n // We might be dealing with an older cache file, fall back to testing\n }\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `determining whether this node is pull or push...`,\n direction: \"outbound\",\n });\n // Find a notification type with at least one supported event\n for (const [type, events] of supportedNotificationEvents) {\n if (events.length === 0)\n continue;\n // Enable the event and request the status\n await api.set(type, true);\n try {\n const resp = await api.get({\n notificationType: type,\n notificationEvent: events[0],\n });\n switch (resp?.notificationStatus) {\n case 0xff:\n return \"push\";\n case 0xfe:\n case 0x00:\n return \"pull\";\n }\n }\n catch {\n /* ignore */\n }\n }\n // If everything failed, e.g. because the node is V1/V2, assume this is a \"push\" node.\n // If we assumed \"pull\", we would have to query the node regularly, which can cause\n // the node to return old (already handled) notifications.\n // https://github.com/zwave-js/zwave-js/issues/5626\n return \"push\";\n }\n /** Whether the node implements push or pull notifications */\n public static getNotificationMode(ctx: GetValueDB, node: NodeId): MaybeNotKnown<\"push\" | \"pull\"> {\n return ctx\n .getValueDB(node.id)\n .getValue(NotificationCCValues.notificationMode.id);\n }\n /** Returns the supported notification events for a given notification type */\n public static getSupportedNotificationEvents(ctx: GetValueDB, node: NodeId, type: number): MaybeNotKnown<readonly number[]> {\n return ctx\n .getValueDB(node.id)\n .getValue(NotificationCCValues.supportedNotificationEvents(type).id);\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // If one Association group issues Notification Reports,\n // we must associate ourselves with that channel\n try {\n await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, NotificationCommand.Report);\n }\n catch {\n ctx.logNode(node.id, {\n endpoint: endpoint.index,\n message: `Configuring associations to receive ${getCCName(this.ccId)} reports failed!`,\n level: \"warn\",\n });\n }\n let supportsV1Alarm = false;\n if (api.version >= 2) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported notification types...\",\n direction: \"outbound\",\n });\n const suppResponse = await api.getSupported();\n if (!suppResponse) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported notification types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n supportsV1Alarm = suppResponse.supportsV1Alarm;\n const supportedNotificationTypes = suppResponse.supportedNotificationTypes;\n const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);\n const supportedNotificationEvents = new Map<number, readonly number[]>();\n const logMessage = `received supported notification types:${supportedNotificationNames\n .map((name) => `\\n\u00B7 ${name}`)\n .join(\"\")}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n if (api.version >= 3) {\n // Query each notification for its supported events\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying supported notification events for ${name}...`,\n direction: \"outbound\",\n });\n const supportedEvents = await api.getSupportedEvents(type);\n if (supportedEvents) {\n supportedNotificationEvents.set(type, supportedEvents);\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `received supported notification events for ${name}: ${supportedEvents\n .map(String)\n .join(\", \")}`,\n direction: \"inbound\",\n });\n }\n node.reportInterviewProgress(i + 1, supportedNotificationTypes.length);\n }\n }\n // Determine whether the node is a push or pull node\n let notificationMode = this.getValue<\"push\" | \"pull\">(ctx, NotificationCCValues.notificationMode);\n if (notificationMode !== \"push\" && notificationMode !== \"pull\") {\n notificationMode = await this.determineNotificationMode(ctx, api, supportedNotificationEvents);\n this.setValue(ctx, NotificationCCValues.notificationMode, notificationMode);\n }\n if (notificationMode === \"pull\") {\n await this.refreshValues(ctx, {\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n } /* if (notificationMode === \"push\") */\n else {\n // First, query the current state of each supported notification\n await this.refreshValues(ctx, {\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n // Enable reports for each notification type\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `enabling notifications for ${name}...`,\n direction: \"outbound\",\n });\n await api.set(type, true);\n node.reportInterviewProgress(i + 1, supportedNotificationTypes.length);\n }\n }\n }\n // Only create metadata for V1 values if necessary\n if (api.version === 1 || supportsV1Alarm) {\n this.ensureMetadata(ctx, NotificationCCValues.alarmType);\n this.ensureMetadata(ctx, NotificationCCValues.alarmLevel);\n }\n // Create metadata and internal values for alarm mappings\n this.applyAlarmMappingCompat(ctx);\n // Apply notification remappings\n this.applyNotificationRemappings(ctx);\n // Set idle values from (potentially remapped) supported events\n this.initNotificationIdleValues(ctx);\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n /**\n * Applies the `alarmMapping` compat flag by adding metadata and supported notification\n * types/events for the alarm mapping targets.\n */\n private applyAlarmMappingCompat(ctx: InterviewContext): void {\n const mappings = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.alarmMapping;\n if (!mappings)\n return;\n const node = this.getNode(ctx)!;\n const supportedNotifications = new Map<number, Set<number>>();\n // Preserve the notification types and events discovered during the interview\n for (const type of (this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [])) {\n supportedNotifications.set(type, new Set(NotificationCC.getSupportedNotificationEvents(ctx, node, type) ?? []));\n }\n // Find all mappings to a valid notification variable\n for (const { to } of mappings) {\n const notification = getNotification(to.notificationType);\n if (!notification)\n continue;\n const valueConfig = getNotificationValue(notification, to.notificationEvent);\n // Remember supported notification types and events to create the internal values later\n if (!supportedNotifications.has(to.notificationType)) {\n supportedNotifications.set(to.notificationType, new Set());\n }\n const supportedNotificationTypesSet = supportedNotifications\n .get(to.notificationType)!;\n supportedNotificationTypesSet.add(to.notificationEvent);\n if (valueConfig?.type !== \"state\")\n continue;\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n // Create or update the metadata\n const metadata = getNotificationValueMetadata(this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n }\n // Remember supported notification types and events in the cache\n this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);\n for (const [type, events] of supportedNotifications) {\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);\n }\n }\n /**\n * Applies the `remapNotifications` compat flag by modifying the supported notification\n * types/events in cache and creating metadata for remapping targets.\n */\n private applyNotificationRemappings(ctx: InterviewContext): void {\n const remappings = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.remapNotifications;\n if (!remappings?.length)\n return;\n ctx.logNode(this.nodeId as number, {\n message: `Applying notification remapping compat flag...`,\n direction: \"none\",\n level: \"verbose\",\n });\n // Load current supported types and events from cache\n const supportedTypes = new Set<number>(this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? []);\n const supportedEvents = new Map<number, Set<number>>();\n for (const type of supportedTypes) {\n const events = NotificationCC.getSupportedNotificationEvents(ctx, this.getNode(ctx)!, type);\n if (events) {\n supportedEvents.set(type, new Set(events));\n }\n }\n for (const mapping of remappings) {\n // Remove the original event from supported events\n const fromEvents = supportedEvents.get(mapping.from.notificationType);\n if (fromEvents) {\n fromEvents.delete(mapping.from.notificationEvent);\n if (fromEvents.size === 0) {\n supportedEvents.delete(mapping.from.notificationType);\n supportedTypes.delete(mapping.from.notificationType);\n }\n }\n // Only add target events for normal remaps\n if (mapping.action.type === \"remap\") {\n const to = mapping.action.to;\n supportedTypes.add(to.notificationType);\n if (!supportedEvents.has(to.notificationType)) {\n supportedEvents.set(to.notificationType, new Set());\n }\n supportedEvents.get(to.notificationType)!.add(to.notificationEvent);\n }\n }\n // Persist updated supported types and events\n this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedTypes]);\n for (const [type, events] of supportedEvents) {\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);\n }\n // Rebuild metadata for all supported events (since we may have removed\n // some events and added others, the previous metadata may be stale)\n for (const [type, events] of supportedEvents) {\n const notification = getNotification(type);\n if (!notification)\n continue;\n let isFirst = true;\n for (const value of events) {\n const valueConfig = getNotificationValue(notification, value);\n if (valueConfig?.type !== \"state\")\n continue;\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n const metadata = getNotificationValueMetadata(isFirst\n ? undefined\n : this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n isFirst = false;\n }\n }\n }\n /**\n * Sets idle values for all supported notification variables that have an idle state\n * and don't have a value yet.\n */\n private initNotificationIdleValues(ctx: InterviewContext): void {\n const supportedTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];\n for (const type of supportedTypes) {\n const notification = getNotification(type);\n if (!notification)\n continue;\n // Reads supported events from cache so it works correctly\n // after compat remappings have been applied.\n const events = NotificationCC.getSupportedNotificationEvents(ctx, this.getNode(ctx)!, type);\n if (!events)\n continue;\n // Find all variables that are supported by this node and have an idle state\n for (const variable of notification.variables\n .filter((v) => !!v.idle)) {\n if ([...variable.states.keys()].some((key) => events.includes(key))) {\n const value = NotificationCCValues\n .notificationVariable(notification.name, variable.name);\n // Set the value to idle if it has no value yet\n // TODO: GH#1028\n // * do this only if the last update was more than 5 minutes ago\n // * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start\n if (this.getValue(ctx, value) == undefined) {\n this.setValue(ctx, value, 0);\n }\n }\n }\n }\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses.Notification, ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n // Load supported notification types and events from cache\n const supportedNotificationTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];\n const supportedNotificationNames = supportedNotificationTypes.map(getNotificationName);\n for (let i = 0; i < supportedNotificationTypes.length; i++) {\n const type = supportedNotificationTypes[i];\n const name = supportedNotificationNames[i];\n // Always query each notification for its current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying notification status for ${name}...`,\n direction: \"outbound\",\n });\n const response = await api.getInternal({\n notificationType: type,\n });\n // NotificationReports don't store their values themselves,\n // because the behaviour is too complex and spans the lifetime\n // of several reports. Thus we handle it in the Node instance\n if (response) {\n // @ts-expect-error\n await node.handleCommand(response);\n }\n options?.onProgress?.(i + 1, supportedNotificationTypes.length);\n }\n // Remember when we did this\n this.setValue(ctx, NotificationCCValues.lastRefresh, Date.now());\n }\n public shouldRefreshValues(this: SinglecastCC<this>, ctx: GetValueDB & GetSupportedCCVersion & GetDeviceConfig & GetNode<NodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>>): boolean {\n // Pull-mode nodes must be polled regularly\n const isPullMode = NotificationCC.getNotificationMode(ctx, this.getNode(ctx)!) === \"pull\";\n if (!isPullMode)\n return false;\n const lastUpdated = this.getValue<number>(ctx, NotificationCCValues.lastRefresh);\n return (lastUpdated == undefined\n || Date.now() - lastUpdated > timespan.hours(6));\n }\n}\n// @publicAPI\nexport interface NotificationCCSetOptions {\n notificationType: number;\n notificationStatus: boolean;\n}\nfunction getCCResponseForNotificationCCSet(ctx: GetNode<NodeId & SupportsCC>, sent: NotificationCCSet) {\n // CC:0071.03.06.11.008: A receiving node MAY deny the deactivation\n // of a specific Notification Type. In that case, the receiving node\n // MUST respond to this command with an Application Rejected Request\n // Command.\n if (sent.isSinglecast()\n && !sent.notificationStatus\n && !sent.isEncapsulatedWith(CommandClasses.Supervision)\n && ctx.getNode(sent.nodeId)?.supportsCC(CommandClasses[\"Application Status\"])) {\n return ApplicationStatusCCRejectedRequest;\n }\n}\n@CCCommand(NotificationCommand.Set)\n@expectedCCResponse(getCCResponseForNotificationCCSet)\n@useSupervision()\nexport class NotificationCCSet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCSetOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n this.notificationStatus = options.notificationStatus;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCSet {\n validatePayload(raw.payload.length >= 2);\n const notificationType = raw.payload[0];\n const notificationStatus = raw.payload[1] === 0xff;\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n notificationStatus,\n });\n }\n public notificationType: number;\n public notificationStatus: boolean;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.notificationType,\n this.notificationStatus ? 0xff : 0x00,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n status: this.notificationStatus,\n },\n };\n }\n}\n// @publicAPI\nexport type NotificationCCReportOptions = {\n alarmType?: number;\n alarmLevel?: number;\n notificationType?: number;\n notificationEvent?: number;\n notificationStatus?: number;\n eventParameters?: BytesView;\n sequenceNumber?: number;\n};\n@CCCommand(NotificationCommand.Report)\n@useSupervision()\nexport class NotificationCCReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCReportOptions>) {\n super(options);\n if (options.alarmType != undefined) {\n this.alarmType = options.alarmType;\n this.alarmLevel = options.alarmLevel;\n }\n if (options.notificationType != undefined) {\n this.notificationType = options.notificationType;\n this.notificationStatus = options.notificationStatus ?? true;\n this.notificationEvent = options.notificationEvent;\n this.eventParameters = options.eventParameters;\n this.sequenceNumber = options.sequenceNumber;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCReport {\n validatePayload(raw.payload.length >= 2);\n const alarmType = raw.payload[0];\n const alarmLevel = raw.payload[1];\n // Byte 2 used to be zensorNetSourceNodeId in V2 and V3, but we don't care about that\n if (raw.payload.length < 7) {\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n alarmLevel,\n });\n }\n // V2+ requires the alarm bytes to be zero. Manufacturers don't care though, so we don't enforce that.\n // Don't use the version to decide because we might discard notifications\n // before the interview is complete\n const notificationStatus = raw.payload[3];\n const notificationType = raw.payload[4];\n const notificationEvent = raw.payload[5];\n const containsSeqNum = !!(raw.payload[6] & 128);\n const numEventParams = raw.payload[6] & 0b11111;\n let eventParameters: BytesView | undefined;\n if (numEventParams > 0) {\n validatePayload(raw.payload.length >= 7 + numEventParams);\n eventParameters = raw.payload.subarray(7, 7 + numEventParams);\n }\n let sequenceNumber: number | undefined;\n if (containsSeqNum) {\n validatePayload(raw.payload.length >= 7 + numEventParams + 1);\n sequenceNumber = raw.payload[7 + numEventParams];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n alarmLevel,\n notificationStatus,\n notificationType,\n notificationEvent,\n eventParameters,\n sequenceNumber,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const ccVersion = getEffectiveCCVersion(ctx, this);\n // Check if we need to re-interpret the alarm values somehow\n if (this.alarmType != undefined\n && this.alarmLevel != undefined\n && this.alarmType !== 0) {\n if (ccVersion >= 2) {\n // Check if the device actually supports Notification CC, but chooses\n // to send Alarm frames instead (GH#1034)\n const supportedNotificationTypes = this.getValue<readonly number[]>(ctx, NotificationCCValues.supportedNotificationTypes);\n if (isArray(supportedNotificationTypes)\n && supportedNotificationTypes.includes(this.alarmType)) {\n const supportedNotificationEvents = NotificationCC\n .getSupportedNotificationEvents(ctx, this.getNode(ctx)!, this.alarmType);\n if (isArray(supportedNotificationEvents)\n && supportedNotificationEvents.includes(this.alarmLevel)) {\n // This alarm frame corresponds to a valid notification event\n ctx.logNode(this.nodeId as number, `treating V1 Alarm frame as Notification Report`);\n this.notificationType = this.alarmType;\n this.notificationEvent = this.alarmLevel;\n this.alarmType = undefined;\n this.alarmLevel = undefined;\n }\n }\n }\n else {\n // V1 Alarm, check if there is a compat option to map this V1 report to a V2+ report\n const mapping = ctx.getDeviceConfig?.(this.nodeId as number)?.compat?.alarmMapping;\n const match = mapping?.find((m) => m.from.alarmType === this.alarmType\n && (m.from.alarmLevel == undefined\n || m.from.alarmLevel === this.alarmLevel));\n if (match) {\n ctx.logNode(this.nodeId as number, `compat mapping found, treating V1 Alarm frame as Notification Report`);\n this.notificationType = match.to.notificationType;\n this.notificationEvent = match.to.notificationEvent;\n if (match.to.eventParameters) {\n this.eventParameters = {};\n for (const [key, val] of Object.entries(match.to.eventParameters)) {\n if (typeof val === \"number\") {\n this.eventParameters[key] = val;\n }\n else if (val === \"alarmLevel\") {\n this.eventParameters[key] = this.alarmLevel;\n }\n }\n }\n // After mapping we do not set the legacy V1 values to undefined\n // Otherwise, adding a new mapping will be a breaking change\n }\n }\n }\n // Now we can interpret the event parameters and turn them into something useful\n this.parseEventParameters(ctx);\n if (this.alarmType != undefined) {\n const alarmTypeValue = NotificationCCValues.alarmType;\n this.ensureMetadata(ctx, alarmTypeValue);\n this.setValue(ctx, alarmTypeValue, this.alarmType);\n }\n if (this.alarmLevel != undefined) {\n const alarmLevelValue = NotificationCCValues.alarmLevel;\n this.ensureMetadata(ctx, alarmLevelValue);\n this.setValue(ctx, alarmLevelValue, this.alarmLevel);\n }\n return true;\n }\n public alarmType: number | undefined;\n public alarmLevel: number | undefined;\n public notificationType: number | undefined;\n public notificationStatus: boolean | number | undefined;\n public notificationEvent: number | undefined;\n public eventParameters: BytesView | Duration | Record<string, number> | number | undefined;\n public sequenceNumber: number | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n let message: MessageRecord = {};\n if (this.alarmType) {\n message = {\n \"V1 alarm type\": this.alarmType,\n \"V1 alarm level\": this.alarmLevel!,\n };\n }\n let valueConfig: NotificationValue | undefined;\n if (this.notificationType) {\n const notification = getNotification(this.notificationType);\n if (notification) {\n valueConfig = getNotificationValue(notification, this.notificationEvent!);\n }\n if (valueConfig) {\n message = {\n ...message,\n \"notification type\": getNotificationName(this.notificationType),\n \"notification status\": this.notificationStatus!,\n [`notification ${valueConfig.type}`]: valueConfig.label\n ?? `Unknown (${num2hex(this.notificationEvent)})`,\n };\n }\n else if (this.notificationEvent === 0x00) {\n message = {\n ...message,\n \"notification type\": this.notificationType,\n \"notification status\": this.notificationStatus!,\n \"notification state\": \"idle\",\n };\n }\n else {\n message = {\n ...message,\n \"notification type\": this.notificationType,\n \"notification status\": this.notificationStatus!,\n \"notification event\": num2hex(this.notificationEvent),\n };\n }\n }\n if (this.sequenceNumber != undefined) {\n message[\"sequence number\"] = this.sequenceNumber;\n }\n if (this.eventParameters != undefined) {\n if (typeof this.eventParameters === \"number\") {\n // Try to look up the enum label\n let found = false;\n if (valueConfig?.parameter?.type === \"enum\") {\n const label = valueConfig.parameter.values[this.eventParameters];\n if (label) {\n message[\"state parameters\"] = label;\n found = true;\n }\n }\n if (!found) {\n message[\"state parameters\"] = num2hex(this.eventParameters);\n }\n }\n else if (isUint8Array(this.eventParameters)) {\n message[\"event parameters\"] = buffer2hex(this.eventParameters);\n }\n else if (this.eventParameters instanceof Duration) {\n message[\"event parameters\"] = this.eventParameters.toString();\n }\n else {\n message[\"event parameters\"] = Object.entries(this.eventParameters)\n .map(([param, val]) => `\\n ${param}: ${num2hex(val)}`)\n .join(\"\");\n }\n }\n else if (valueConfig?.parameter?.type === \"enum\"\n && valueConfig.parameter.default != undefined) {\n const label = valueConfig.parameter.values[valueConfig.parameter.default];\n if (label) {\n message[\"state parameters\"] = `${label} (omitted)`;\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n private parseEventParameters(ctx: PersistValuesContext): void {\n // This only makes sense for V2+ notifications\n if (this.notificationType == undefined\n || this.notificationEvent == undefined) {\n return;\n }\n // Look up the received notification and value in the config\n const notification = getNotification(this.notificationType);\n if (!notification)\n return;\n const valueConfig = getNotificationValue(notification, this.notificationEvent);\n if (!valueConfig)\n return;\n // Parse the event parameters if possible\n if (valueConfig.parameter?.type === \"duration\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // The parameters contain a Duration\n this.eventParameters = Duration.parseReport(this.eventParameters[0]);\n }\n else if (valueConfig.parameter?.type === \"commandclass\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // The parameters **should** contain a CC, however there might be some exceptions\n if (this.eventParameters.length === 1\n && notification.type === 0x06\n && (this.notificationEvent === 0x05\n || this.notificationEvent === 0x06)) {\n // Access control -> Keypad Lock/Unlock operation\n // Some devices only send the User ID, not a complete CC payload\n this.eventParameters = {\n userId: this.eventParameters[0],\n };\n }\n else {\n // Try to parse the event parameters - if this fails, we should still handle the notification report\n try {\n // Convert CommandClass instances to a standardized object representation\n // We do not want to parse asynchronously here, but the `CommandClass.parse` method is async.\n // However, we only deal with simple CCs that can be parsed synchronously. We can do this\n // by replicating what `CommandClass.parse` does: determine the correct CC class and call its\n // `from` method. If that returns a CC instance, we're good to continue.\n const raw = CCRaw.parse(this.eventParameters);\n if (raw.ccCommand == undefined) {\n validatePayload.fail(\"event parameters contain an invalid CC\");\n }\n const CommandConstructor = getCCCommandConstructor(raw.ccId, raw.ccCommand);\n if (!CommandConstructor) {\n validatePayload.fail(\"event parameters contain an invalid CC\");\n }\n const cc = CommandConstructor.from(raw, {\n ...ctx,\n frameType: \"singlecast\",\n sourceNodeId: this.nodeId as number,\n // Security encapsulation is handled outside of this CC,\n // so it is not needed here:\n hasSecurityClass: () => false,\n getHighestSecurityClass: () => SecurityClass.None,\n setSecurityClass: () => { },\n securityManager: undefined,\n securityManager2: undefined,\n securityManagerLR: undefined,\n });\n if (cc instanceof Promise) {\n validatePayload.fail(\"Cannot asynchronously parse CC from event parameters\");\n }\n validatePayload(!(cc instanceof InvalidCC));\n cc.encapsulatingCC = this as any;\n if (isNotificationEventPayload(cc)) {\n this.eventParameters = cc\n .toNotificationEventParameters();\n }\n else {\n // If a CC has no good toJSON() representation, we're only interested in the payload\n let json = cc.toJSON();\n if (\"nodeId\" in json\n && \"ccId\" in json\n && \"payload\" in json) {\n json = pick(json, [\"payload\"]);\n }\n this.eventParameters = json;\n }\n }\n catch (e) {\n if (isZWaveError(e)\n && e.code\n === ZWaveErrorCodes.PacketFormat_InvalidPayload\n && isUint8Array(this.eventParameters)) {\n const { ccId, ccCommand } = CCRaw.parse(this.eventParameters);\n if (ccId === CommandClasses[\"User Code\"]\n && ccCommand === UserCodeCommand.Report\n && this.eventParameters.length >= 3) {\n // Access control -> Keypad Lock/Unlock operation\n // Some devices report the user code with truncated UserCode reports\n this.eventParameters = {\n userId: this.eventParameters[2],\n };\n }\n else {\n ctx.logNode(this.nodeId as number, `Failed to parse Notification CC event parameters, ignoring them...`, \"error\");\n }\n }\n else {\n // unexpected error\n throw e;\n }\n }\n }\n }\n else if (valueConfig.parameter?.type === \"value\") {\n // This only makes sense if the event parameters are a buffer\n if (!isUint8Array(this.eventParameters)) {\n return;\n }\n // readUIntBE supports at most 6 bytes; a longer (or empty) value\n // must not reach it, or it throws a RangeError that would escape\n // the parser and crash the driver\n validatePayload(this.eventParameters.length >= 1\n && this.eventParameters.length <= 6);\n // The parameters contain a named value\n this.eventParameters = {\n [valueConfig.parameter.propertyName]: Bytes.view(this.eventParameters)\n .readUIntBE(0, this.eventParameters.length),\n };\n }\n else if (valueConfig.parameter?.type === \"enum\") {\n // The parameters may contain an enum value\n this.eventParameters = isUint8Array(this.eventParameters)\n && this.eventParameters.length === 1\n ? this.eventParameters[0]\n : undefined;\n // Some devices send notifications without an event parameter when they should.\n // In this case, fall back to the default value where possible.\n if (this.eventParameters == undefined\n && valueConfig.parameter.default != undefined) {\n this.eventParameters = valueConfig.parameter.default;\n }\n }\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (this.notificationType != undefined) {\n if (this.notificationEvent == undefined) {\n throw new ZWaveError(`Notification CC reports requires the notification event to be set!`, ZWaveErrorCodes.Argument_Invalid);\n }\n else if (this.eventParameters != undefined\n && !isUint8Array(this.eventParameters)) {\n throw new ZWaveError(`When sending Notification CC reports, the event parameters can only be buffers!`, ZWaveErrorCodes.Argument_Invalid);\n }\n const controlByte = (this.sequenceNumber != undefined ? 128 : 0)\n | ((this.eventParameters?.length ?? 0) & 0b11111);\n this.payload = Bytes.from([\n 0,\n 0,\n 0,\n 0xff,\n this.notificationType,\n this.notificationEvent,\n controlByte,\n ]);\n if (this.eventParameters) {\n this.payload = Bytes.concat([\n this.payload,\n this.eventParameters,\n ]);\n }\n if (this.sequenceNumber != undefined) {\n this.payload = Bytes.concat([\n this.payload,\n [this.sequenceNumber],\n ]);\n }\n }\n else {\n this.payload = Bytes.from([\n this.alarmType ?? 0x00,\n this.alarmLevel ?? 0x00,\n ]);\n }\n return super.serialize(ctx);\n }\n}\n// @publicAPI\nexport type NotificationCCGetOptions = {\n alarmType: number;\n} | {\n notificationType: number;\n notificationEvent?: number;\n};\n@CCCommand(NotificationCommand.Get)\n@expectedCCResponse(NotificationCCReport)\nexport class NotificationCCGet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCGetOptions>) {\n super(options);\n if (\"alarmType\" in options) {\n this.alarmType = options.alarmType;\n }\n else {\n this.notificationType = options.notificationType;\n this.notificationEvent = options.notificationEvent;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCGet {\n validatePayload(raw.payload.length >= 1);\n if (raw.payload.length >= 2) {\n const notificationType = raw.payload[1];\n let notificationEvent: number | undefined;\n if (raw.payload.length >= 3 && notificationType != 0xff) {\n notificationEvent = raw.payload[2];\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n notificationEvent,\n });\n }\n else {\n const alarmType = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n alarmType,\n });\n }\n }\n /** Proprietary V1/V2 alarm type */\n public alarmType: number | undefined;\n /** Regulated V3+ notification type */\n public notificationType: number | undefined;\n public notificationEvent: number | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const notificationEvent = this.notificationEvent === 0xff\n ? 0x00\n : this.notificationEvent;\n this.payload = Bytes.from([\n this.alarmType ?? 0x00,\n this.notificationType ?? 0xff,\n notificationEvent ?? 0x00,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.alarmType != undefined) {\n message[\"V1 alarm type\"] = this.alarmType;\n }\n if (this.notificationType != undefined) {\n message[\"notification type\"] = getNotificationName(this.notificationType);\n if (this.notificationEvent != undefined) {\n message[\"notification event\"] = getNotificationEventName(this.notificationType, this.notificationEvent);\n }\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface NotificationCCSupportedReportOptions {\n supportsV1Alarm: boolean;\n supportedNotificationTypes: number[];\n}\n@CCCommand(NotificationCommand.SupportedReport)\n@ccValueProperty(\"supportsV1Alarm\", NotificationCCValues.supportsV1Alarm)\n@ccValueProperty(\"supportedNotificationTypes\", NotificationCCValues.supportedNotificationTypes)\nexport class NotificationCCSupportedReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCSupportedReportOptions>) {\n super(options);\n this.supportsV1Alarm = options.supportsV1Alarm;\n this.supportedNotificationTypes = options.supportedNotificationTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const supportsV1Alarm = !!(raw.payload[0] & 128);\n const numBitMaskBytes = raw.payload[0] & 31;\n validatePayload(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);\n const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);\n const supportedNotificationTypes = parseBitMask(notificationBitMask, \n // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0\n 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportsV1Alarm,\n supportedNotificationTypes,\n });\n }\n public supportsV1Alarm: boolean;\n public supportedNotificationTypes: number[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const bitMask = encodeBitMask(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);\n this.payload = Bytes.concat([\n [\n (this.supportsV1Alarm ? 128 : 0) | bitMask.length,\n ],\n bitMask,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supports V1 alarm\": this.supportsV1Alarm,\n \"supported notification types\": this.supportedNotificationTypes\n .map((t) => `\\n\u00B7 ${getNotificationName(t)}`)\n .join(\"\"),\n },\n };\n }\n}\n@CCCommand(NotificationCommand.SupportedGet)\n@expectedCCResponse(NotificationCCSupportedReport)\nexport class NotificationCCSupportedGet extends NotificationCC {\n}\n// @publicAPI\nexport interface NotificationCCEventSupportedReportOptions {\n notificationType: number;\n supportedEvents: number[];\n}\n@CCCommand(NotificationCommand.EventSupportedReport)\nexport class NotificationCCEventSupportedReport extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCEventSupportedReportOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n this.supportedEvents = options.supportedEvents;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCEventSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const notificationType = raw.payload[0];\n const numBitMaskBytes = raw.payload[1] & 31;\n if (numBitMaskBytes === 0) {\n // Notification type is not supported\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n supportedEvents: [],\n });\n }\n validatePayload(raw.payload.length >= 2 + numBitMaskBytes);\n const eventBitMask = raw.payload.subarray(2, 2 + numBitMaskBytes);\n const supportedEvents = parseBitMask(eventBitMask, \n // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0\n 0);\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n supportedEvents,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Store which events this notification supports\n this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);\n // For each event, predefine the value metadata\n const notification = getNotification(this.notificationType);\n if (!notification) {\n // This is an unknown notification\n this.setMetadata(ctx, NotificationCCValues.unknownNotificationType(this.notificationType));\n }\n else {\n // This is a standardized notification\n let isFirst = true;\n for (const value of this.supportedEvents) {\n // Find out which property we need to update\n const valueConfig = getNotificationValue(notification, value);\n if (valueConfig?.type === \"state\") {\n const notificationValue = NotificationCCValues\n .notificationVariable(notification.name, valueConfig.variableName);\n // After we've created the metadata initially, extend it\n const metadata = getNotificationValueMetadata(isFirst\n ? undefined\n : this.getMetadata(ctx, notificationValue), notification, valueConfig);\n this.setMetadata(ctx, notificationValue, metadata);\n isFirst = false;\n }\n }\n }\n return true;\n }\n public notificationType: number;\n public supportedEvents: number[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.notificationType, 0]);\n if (this.supportedEvents.length > 0) {\n const bitMask = encodeBitMask(this.supportedEvents, Math.max(...this.supportedEvents), 0);\n this.payload[1] = bitMask.length;\n this.payload = Bytes.concat([this.payload, bitMask]);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n \"supported events\": this.supportedEvents\n .map((e) => `\\n\u00B7 ${getNotificationValueName(this.notificationType, e)}`)\n .join(\"\"),\n },\n };\n }\n}\n// @publicAPI\nexport interface NotificationCCEventSupportedGetOptions {\n notificationType: number;\n}\n@CCCommand(NotificationCommand.EventSupportedGet)\n@expectedCCResponse(NotificationCCEventSupportedReport)\nexport class NotificationCCEventSupportedGet extends NotificationCC {\n public constructor(options: WithAddress<NotificationCCEventSupportedGetOptions>) {\n super(options);\n this.notificationType = options.notificationType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): NotificationCCEventSupportedGet {\n validatePayload(raw.payload.length >= 1);\n const notificationType = raw.payload[0];\n return new this({\n nodeId: ctx.sourceNodeId,\n notificationType,\n });\n }\n public notificationType: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.notificationType]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"notification type\": getNotificationName(this.notificationType),\n },\n };\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAA6rB;AAC7rB,oBAAgF;AAChF,wBAAwB;AACxB,iBAA0G;AAC1G,0BAA+K;AAC/K,oCAA0J;AAC1J,sCAA2C;AAE3C,mBAAqD;AAErD,cAAyB;AACzB,iCAAmD;AACnD,oCA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kB,CAAC,CAAC,EAAE,EACtE,KAAK,EAAE;;;IAGxB;;;;IAQS,mCAA+B,MAAA;8BAF3C,yCAAU,iCAAoB,iBAAiB,OAC/C,kDAAmB,kCAAkC,CAAC;;;;oBACF;uDAAA,YAAc;WAAA;;;;;;;;AAAnE,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAA4D;AAC3E,YAAM,OAAO;AACb,WAAK,mBAAmB,QAAQ;IACpC;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,mBAAmB,IAAI,QAAQ,CAAC;AACtC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,gBAAgB,CAAC;AACjD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,yBAAqB,iCAAoB,KAAK,gBAAgB;;;IAG1E;;;;",
6
6
  "names": ["NotificationCC"]
7
7
  }
@@ -283,6 +283,7 @@ dimming duration: ${group.dimmingDuration.toString()}`;
283
283
  direction: "inbound"
284
284
  });
285
285
  }
286
+ options?.onProgress?.(groupId, groupCount);
286
287
  }
287
288
  }
288
289
  /**
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/SceneControllerConfigurationCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./SceneControllerConfigurationCC._validateArgs.js\";\nconst { validateArgs_SceneControllerConfigurationCCAPI_disable, validateArgs_SceneControllerConfigurationCCAPI_set, validateArgs_SceneControllerConfigurationCCAPI_get } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, Duration, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, getCCName, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { SceneControllerConfigurationCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { AssociationCC } from \"./AssociationCC.js\";\nimport { SceneControllerConfigurationCCValues } from \"./_CCValues.generated.js\";\nexport { SceneControllerConfigurationCCValues };\n@API(CommandClasses[\"Scene Controller Configuration\"])\nexport class SceneControllerConfigurationCCAPI extends CCAPI {\n public supportsCommand(cmd: SceneControllerConfigurationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case SceneControllerConfigurationCommand.Get:\n return this.isSinglecast();\n case SceneControllerConfigurationCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: SceneControllerConfigurationCCAPI, { property, propertyKey }, value, options) {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n if (property === \"sceneId\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n if (value === 0) {\n // Disable Group ID / Scene ID\n return this.disable(propertyKey);\n }\n else {\n // We need to set the dimming duration along with the scene ID\n // Dimming duration is chosen with the following precedence:\n // 1. options.transitionDuration\n // 2. current stored value\n // 3. default value\n const dimmingDuration = Duration.from(options?.transitionDuration)\n ?? this.tryGetValueDB()?.getValue<Duration>(SceneControllerConfigurationCCValues\n .dimmingDuration(propertyKey).endpoint(this.endpoint.index))\n ?? Duration.default();\n return this.set(propertyKey, value, dimmingDuration);\n }\n }\n else if (property === \"dimmingDuration\") {\n if (typeof value !== \"string\" && !Duration.isDuration(value)) {\n throwWrongValueType(this.ccId, property, \"duration\", typeof value);\n }\n const dimmingDuration = Duration.from(value);\n if (dimmingDuration == undefined) {\n throw new ZWaveError(`${getCCName(this.ccId)}: \"${property}\" could not be set. ${JSON.stringify(value)} is not a valid duration.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const valueDB = this.tryGetValueDB();\n const sceneId = valueDB?.getValue<number>(SceneControllerConfigurationCCValues.sceneId(propertyKey).endpoint(this.endpoint.index));\n if (sceneId == undefined || sceneId === 0) {\n if (valueDB) {\n // Can't actually send dimmingDuration without valid sceneId\n // So we save it in the valueDB without sending it to the node\n const dimmingDurationValueId = SceneControllerConfigurationCCValues\n .dimmingDuration(propertyKey).endpoint(this.endpoint.index);\n valueDB.setValue(dimmingDurationValueId, dimmingDuration);\n }\n return;\n }\n return this.set(propertyKey, sceneId, dimmingDuration);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: SceneControllerConfigurationCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"sceneId\":\n case \"dimmingDuration\": {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n return (await this.get(propertyKey))?.[property];\n }\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_SceneControllerConfigurationCCAPI_disable()\n public async disable(groupId: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Set);\n return this.set(groupId, 0, new Duration(0, \"seconds\"));\n }\n @validateArgs_SceneControllerConfigurationCCAPI_set()\n public async set(groupId: number, sceneId: number, dimmingDuration?: Duration | string): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Set);\n if (!this.endpoint.virtual) {\n const groupCount = SceneControllerConfigurationCC\n .getGroupCountCached(this.host, this.endpoint);\n // The client SHOULD NOT specify group 1 (the life-line group).\n // We don't block it here, because the specs don't forbid it,\n // and it may be needed for some devices.\n if (groupId < 1 || groupId > groupCount) {\n throw new ZWaveError(`${this.constructor.name}: The group ID must be between 1 and the number of supported groups ${groupCount}.`, ZWaveErrorCodes.Argument_Invalid);\n }\n }\n else if (groupId < 1) {\n throw new ZWaveError(`The group ID must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneControllerConfigurationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n sceneId,\n dimmingDuration,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getLastActivated(): Promise<MaybeNotKnown<Pick<SceneControllerConfigurationCCReport, \"groupId\" | \"sceneId\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Get);\n const cc = new SceneControllerConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId: 0,\n });\n const response = await this.host.sendCommand<SceneControllerConfigurationCCReport>(cc, this.commandOptions);\n // Return value includes \"groupId\", because\n // the returned report will include the actual groupId of the\n // last activated groupId / sceneId\n if (response) {\n return pick(response, [\"groupId\", \"sceneId\", \"dimmingDuration\"]);\n }\n }\n @validateArgs_SceneControllerConfigurationCCAPI_get()\n public async get(groupId: number): Promise<MaybeNotKnown<Pick<SceneControllerConfigurationCCReport, \"sceneId\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Get);\n if (groupId === 0) {\n throw new ZWaveError(`Invalid group ID 0. To get the last activated group / scene, use getLastActivated() instead.`, ZWaveErrorCodes.Argument_Invalid);\n }\n else if (groupId < 0) {\n throw new ZWaveError(`The group ID must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneControllerConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n });\n const response = await this.host.sendCommand<SceneControllerConfigurationCCReport>(cc, this.commandOptions);\n // Since groupId is not allowed to be 0, only Reports with\n // groupId equal to the requested groupId will be accepted,\n // so we can omit groupId from the return.\n if (response) {\n return pick(response, [\"sceneId\", \"dimmingDuration\"]);\n }\n }\n}\n@commandClass(CommandClasses[\"Scene Controller Configuration\"])\n@implementedVersion(1)\n@ccValues(SceneControllerConfigurationCCValues)\nexport class SceneControllerConfigurationCC extends CommandClass {\n declare ccCommand: SceneControllerConfigurationCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n // AssociationCC is required and MUST be interviewed\n // before SceneControllerConfigurationCC to supply groupCount\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n ];\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(ctx, endpoint);\n if (groupCount === 0) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `skipping Scene Controller Configuration interview because Association group count is unknown`,\n direction: \"none\",\n level: \"warn\",\n });\n return;\n }\n // Create metadata for each scene, but don't query their actual configuration\n // since some devices only support setting scenes\n for (let groupId = 1; groupId <= groupCount; groupId++) {\n const sceneIdValue = SceneControllerConfigurationCCValues.sceneId(groupId);\n this.ensureMetadata(ctx, sceneIdValue);\n const dimmingDurationValue = SceneControllerConfigurationCCValues\n .dimmingDuration(groupId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Scene Controller Configuration\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(ctx, endpoint);\n ctx.logNode(node.id, {\n message: \"querying all scene controller configurations...\",\n direction: \"outbound\",\n });\n for (let groupId = 1; groupId <= groupCount; groupId++) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying scene configuration for group #${groupId}...`,\n direction: \"outbound\",\n });\n const group = await api.get(groupId);\n if (group != undefined) {\n const logMessage = `received scene configuration for group #${groupId}:\nscene ID: ${group.sceneId}\ndimming duration: ${group.dimmingDuration.toString()}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n }\n /**\n * Returns the number of association groups reported by the node.\n * This only works AFTER the node has been interviewed by this CC\n * or the AssociationCC.\n */\n public static getGroupCountCached(ctx: GetValueDB & GetDeviceConfig, endpoint: EndpointId): number {\n return ctx.getDeviceConfig?.(endpoint.nodeId)?.compat\n ?.forceSceneControllerGroupCount\n ?? AssociationCC.getGroupCountCached(ctx, endpoint)\n ?? 0;\n }\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCSetOptions {\n groupId: number;\n sceneId: number;\n dimmingDuration?: Duration | string;\n}\n@CCCommand(SceneControllerConfigurationCommand.Set)\n@useSupervision()\nexport class SceneControllerConfigurationCCSet extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCSetOptions>) {\n super(options);\n this.groupId = options.groupId;\n this.sceneId = options.sceneId;\n // if dimmingDuration was missing, use default duration.\n this.dimmingDuration = Duration.from(options.dimmingDuration)\n ?? Duration.default();\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): SceneControllerConfigurationCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new SceneControllerConfigurationCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public groupId: number;\n public sceneId: number;\n public dimmingDuration: Duration;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.groupId,\n this.sceneId,\n this.dimmingDuration.serializeSet(),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"scene id\": this.sceneId,\n \"dimming duration\": this.dimmingDuration.toString(),\n },\n };\n }\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCReportOptions {\n groupId: number;\n sceneId: number;\n dimmingDuration: Duration;\n}\n@CCCommand(SceneControllerConfigurationCommand.Report)\nexport class SceneControllerConfigurationCCReport extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.groupId = options.groupId;\n this.sceneId = options.sceneId;\n this.dimmingDuration = options.dimmingDuration;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneControllerConfigurationCCReport {\n validatePayload(raw.payload.length >= 3);\n const groupId = raw.payload[0];\n const sceneId = raw.payload[1];\n const dimmingDuration: Duration = Duration.parseReport(raw.payload[2])\n ?? Duration.unknown();\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n sceneId,\n dimmingDuration,\n });\n }\n public readonly groupId: number;\n public readonly sceneId: number;\n public readonly dimmingDuration: Duration;\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // If groupId = 0, values are meaningless\n if (this.groupId === 0)\n return false;\n const sceneIdValue = SceneControllerConfigurationCCValues.sceneId(this.groupId);\n this.ensureMetadata(ctx, sceneIdValue);\n const dimmingDurationValue = SceneControllerConfigurationCCValues\n .dimmingDuration(this.groupId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n this.setValue(ctx, sceneIdValue, this.sceneId);\n this.setValue(ctx, dimmingDurationValue, this.dimmingDuration);\n return true;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"scene id\": this.sceneId,\n \"dimming duration\": this.dimmingDuration.toString(),\n },\n };\n }\n}\nfunction testResponseForSceneControllerConfigurationGet(sent: SceneControllerConfigurationCCGet, received: SceneControllerConfigurationCCReport) {\n // We expect a Scene Controller Configuration Report that matches\n // the requested groupId, unless groupId 0 was requested\n return sent.groupId === 0 || received.groupId === sent.groupId;\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCGetOptions {\n groupId: number;\n}\n@CCCommand(SceneControllerConfigurationCommand.Get)\n@expectedCCResponse(SceneControllerConfigurationCCReport, testResponseForSceneControllerConfigurationGet)\nexport class SceneControllerConfigurationCCGet extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCGetOptions>) {\n super(options);\n this.groupId = options.groupId;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): SceneControllerConfigurationCCGet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new SceneControllerConfigurationCCGet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public groupId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.groupId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"group id\": this.groupId },\n };\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAA6P;AAC7P,oBAA4B;AAC5B,iBAA8M;AAC9M,0BAAkJ;AAClJ,oCAAgH;AAEhH,mBAAoD;AAEpD,2BAA8B;AAC9B,gCAAqD;AAXrD,MAAM,EAAE,wDAAwD,oDAAoD,mDAAkD,IAAK;IAc9J,qCAAiC,MAAA;8BAD7C,mCAAI,2BAAe,gCAAgC,CAAC,CAAC;;;;oBACC;;;;;yDAAA,YAAK;WAAA;;;;;;;;6BAoFvD,uDAAsD,CAAE;yBAKxD,mDAAkD,CAAE;yBAwCpD,mDAAkD,CAAE;AA5CrD,qCAAA,MAAA,MAAA,qBAAA,EAAA,MAAA,UAAA,MAAA,WAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,aAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,SAAb,OAAoB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAKpB,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAwChB,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAlIpB,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBA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8C;AAG3I,SAAO,KAAK,YAAY,KAAK,SAAS,YAAY,KAAK;AAC3D;AAJS;IAWI,qCAAiC,MAAA;8BAF7C,yCAAU,iDAAoC,GAAG,OACjD,kDAAmB,sCAAsC,8CAA8C,CAAC;;;;oBAClD;yDAAA,YAA8B;WAAA;;;;;;;;AAArF,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAA8D;AAC7E,YAAM,OAAO;AACb,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,MAAa,MAAsB;AAElD,YAAM,IAAI,uBAAW,GAAG,KAAK,IAAI,qCAAqC,4BAAgB,8BAA8B;IAIxH;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,OAAO,CAAC;AACxC,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,YAAY,KAAK,QAAO;;IAE3C;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./SceneControllerConfigurationCC._validateArgs.js\";\nconst { validateArgs_SceneControllerConfigurationCCAPI_disable, validateArgs_SceneControllerConfigurationCCAPI_set, validateArgs_SceneControllerConfigurationCCAPI_get } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, Duration, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, getCCName, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { SceneControllerConfigurationCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { AssociationCC } from \"./AssociationCC.js\";\nimport { SceneControllerConfigurationCCValues } from \"./_CCValues.generated.js\";\nexport { SceneControllerConfigurationCCValues };\n@API(CommandClasses[\"Scene Controller Configuration\"])\nexport class SceneControllerConfigurationCCAPI extends CCAPI {\n public supportsCommand(cmd: SceneControllerConfigurationCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case SceneControllerConfigurationCommand.Get:\n return this.isSinglecast();\n case SceneControllerConfigurationCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: SceneControllerConfigurationCCAPI, { property, propertyKey }, value, options) {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n if (property === \"sceneId\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n if (value === 0) {\n // Disable Group ID / Scene ID\n return this.disable(propertyKey);\n }\n else {\n // We need to set the dimming duration along with the scene ID\n // Dimming duration is chosen with the following precedence:\n // 1. options.transitionDuration\n // 2. current stored value\n // 3. default value\n const dimmingDuration = Duration.from(options?.transitionDuration)\n ?? this.tryGetValueDB()?.getValue<Duration>(SceneControllerConfigurationCCValues\n .dimmingDuration(propertyKey).endpoint(this.endpoint.index))\n ?? Duration.default();\n return this.set(propertyKey, value, dimmingDuration);\n }\n }\n else if (property === \"dimmingDuration\") {\n if (typeof value !== \"string\" && !Duration.isDuration(value)) {\n throwWrongValueType(this.ccId, property, \"duration\", typeof value);\n }\n const dimmingDuration = Duration.from(value);\n if (dimmingDuration == undefined) {\n throw new ZWaveError(`${getCCName(this.ccId)}: \"${property}\" could not be set. ${JSON.stringify(value)} is not a valid duration.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const valueDB = this.tryGetValueDB();\n const sceneId = valueDB?.getValue<number>(SceneControllerConfigurationCCValues.sceneId(propertyKey).endpoint(this.endpoint.index));\n if (sceneId == undefined || sceneId === 0) {\n if (valueDB) {\n // Can't actually send dimmingDuration without valid sceneId\n // So we save it in the valueDB without sending it to the node\n const dimmingDurationValueId = SceneControllerConfigurationCCValues\n .dimmingDuration(propertyKey).endpoint(this.endpoint.index);\n valueDB.setValue(dimmingDurationValueId, dimmingDuration);\n }\n return;\n }\n return this.set(propertyKey, sceneId, dimmingDuration);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: SceneControllerConfigurationCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"sceneId\":\n case \"dimmingDuration\": {\n if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n else if (typeof propertyKey !== \"number\") {\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n return (await this.get(propertyKey))?.[property];\n }\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_SceneControllerConfigurationCCAPI_disable()\n public async disable(groupId: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Set);\n return this.set(groupId, 0, new Duration(0, \"seconds\"));\n }\n @validateArgs_SceneControllerConfigurationCCAPI_set()\n public async set(groupId: number, sceneId: number, dimmingDuration?: Duration | string): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Set);\n if (!this.endpoint.virtual) {\n const groupCount = SceneControllerConfigurationCC\n .getGroupCountCached(this.host, this.endpoint);\n // The client SHOULD NOT specify group 1 (the life-line group).\n // We don't block it here, because the specs don't forbid it,\n // and it may be needed for some devices.\n if (groupId < 1 || groupId > groupCount) {\n throw new ZWaveError(`${this.constructor.name}: The group ID must be between 1 and the number of supported groups ${groupCount}.`, ZWaveErrorCodes.Argument_Invalid);\n }\n }\n else if (groupId < 1) {\n throw new ZWaveError(`The group ID must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneControllerConfigurationCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n sceneId,\n dimmingDuration,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getLastActivated(): Promise<MaybeNotKnown<Pick<SceneControllerConfigurationCCReport, \"groupId\" | \"sceneId\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Get);\n const cc = new SceneControllerConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId: 0,\n });\n const response = await this.host.sendCommand<SceneControllerConfigurationCCReport>(cc, this.commandOptions);\n // Return value includes \"groupId\", because\n // the returned report will include the actual groupId of the\n // last activated groupId / sceneId\n if (response) {\n return pick(response, [\"groupId\", \"sceneId\", \"dimmingDuration\"]);\n }\n }\n @validateArgs_SceneControllerConfigurationCCAPI_get()\n public async get(groupId: number): Promise<MaybeNotKnown<Pick<SceneControllerConfigurationCCReport, \"sceneId\" | \"dimmingDuration\">>> {\n this.assertSupportsCommand(SceneControllerConfigurationCommand, SceneControllerConfigurationCommand.Get);\n if (groupId === 0) {\n throw new ZWaveError(`Invalid group ID 0. To get the last activated group / scene, use getLastActivated() instead.`, ZWaveErrorCodes.Argument_Invalid);\n }\n else if (groupId < 0) {\n throw new ZWaveError(`The group ID must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);\n }\n const cc = new SceneControllerConfigurationCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n groupId,\n });\n const response = await this.host.sendCommand<SceneControllerConfigurationCCReport>(cc, this.commandOptions);\n // Since groupId is not allowed to be 0, only Reports with\n // groupId equal to the requested groupId will be accepted,\n // so we can omit groupId from the return.\n if (response) {\n return pick(response, [\"sceneId\", \"dimmingDuration\"]);\n }\n }\n}\n@commandClass(CommandClasses[\"Scene Controller Configuration\"])\n@implementedVersion(1)\n@ccValues(SceneControllerConfigurationCCValues)\nexport class SceneControllerConfigurationCC extends CommandClass {\n declare ccCommand: SceneControllerConfigurationCommand;\n public determineRequiredCCInterviews(): readonly CommandClasses[] {\n // AssociationCC is required and MUST be interviewed\n // before SceneControllerConfigurationCC to supply groupCount\n return [\n ...super.determineRequiredCCInterviews(),\n CommandClasses.Association,\n ];\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(ctx, endpoint);\n if (groupCount === 0) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `skipping Scene Controller Configuration interview because Association group count is unknown`,\n direction: \"none\",\n level: \"warn\",\n });\n return;\n }\n // Create metadata for each scene, but don't query their actual configuration\n // since some devices only support setting scenes\n for (let groupId = 1; groupId <= groupCount; groupId++) {\n const sceneIdValue = SceneControllerConfigurationCCValues.sceneId(groupId);\n this.ensureMetadata(ctx, sceneIdValue);\n const dimmingDurationValue = SceneControllerConfigurationCCValues\n .dimmingDuration(groupId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Scene Controller Configuration\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n const groupCount = SceneControllerConfigurationCC.getGroupCountCached(ctx, endpoint);\n ctx.logNode(node.id, {\n message: \"querying all scene controller configurations...\",\n direction: \"outbound\",\n });\n for (let groupId = 1; groupId <= groupCount; groupId++) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying scene configuration for group #${groupId}...`,\n direction: \"outbound\",\n });\n const group = await api.get(groupId);\n if (group != undefined) {\n const logMessage = `received scene configuration for group #${groupId}:\nscene ID: ${group.sceneId}\ndimming duration: ${group.dimmingDuration.toString()}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n options?.onProgress?.(groupId, groupCount);\n }\n }\n /**\n * Returns the number of association groups reported by the node.\n * This only works AFTER the node has been interviewed by this CC\n * or the AssociationCC.\n */\n public static getGroupCountCached(ctx: GetValueDB & GetDeviceConfig, endpoint: EndpointId): number {\n return ctx.getDeviceConfig?.(endpoint.nodeId)?.compat\n ?.forceSceneControllerGroupCount\n ?? AssociationCC.getGroupCountCached(ctx, endpoint)\n ?? 0;\n }\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCSetOptions {\n groupId: number;\n sceneId: number;\n dimmingDuration?: Duration | string;\n}\n@CCCommand(SceneControllerConfigurationCommand.Set)\n@useSupervision()\nexport class SceneControllerConfigurationCCSet extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCSetOptions>) {\n super(options);\n this.groupId = options.groupId;\n this.sceneId = options.sceneId;\n // if dimmingDuration was missing, use default duration.\n this.dimmingDuration = Duration.from(options.dimmingDuration)\n ?? Duration.default();\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): SceneControllerConfigurationCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new SceneControllerConfigurationCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public groupId: number;\n public sceneId: number;\n public dimmingDuration: Duration;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n this.groupId,\n this.sceneId,\n this.dimmingDuration.serializeSet(),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"scene id\": this.sceneId,\n \"dimming duration\": this.dimmingDuration.toString(),\n },\n };\n }\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCReportOptions {\n groupId: number;\n sceneId: number;\n dimmingDuration: Duration;\n}\n@CCCommand(SceneControllerConfigurationCommand.Report)\nexport class SceneControllerConfigurationCCReport extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.groupId = options.groupId;\n this.sceneId = options.sceneId;\n this.dimmingDuration = options.dimmingDuration;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SceneControllerConfigurationCCReport {\n validatePayload(raw.payload.length >= 3);\n const groupId = raw.payload[0];\n const sceneId = raw.payload[1];\n const dimmingDuration: Duration = Duration.parseReport(raw.payload[2])\n ?? Duration.unknown();\n return new this({\n nodeId: ctx.sourceNodeId,\n groupId,\n sceneId,\n dimmingDuration,\n });\n }\n public readonly groupId: number;\n public readonly sceneId: number;\n public readonly dimmingDuration: Duration;\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // If groupId = 0, values are meaningless\n if (this.groupId === 0)\n return false;\n const sceneIdValue = SceneControllerConfigurationCCValues.sceneId(this.groupId);\n this.ensureMetadata(ctx, sceneIdValue);\n const dimmingDurationValue = SceneControllerConfigurationCCValues\n .dimmingDuration(this.groupId);\n this.ensureMetadata(ctx, dimmingDurationValue);\n this.setValue(ctx, sceneIdValue, this.sceneId);\n this.setValue(ctx, dimmingDurationValue, this.dimmingDuration);\n return true;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"group id\": this.groupId,\n \"scene id\": this.sceneId,\n \"dimming duration\": this.dimmingDuration.toString(),\n },\n };\n }\n}\nfunction testResponseForSceneControllerConfigurationGet(sent: SceneControllerConfigurationCCGet, received: SceneControllerConfigurationCCReport) {\n // We expect a Scene Controller Configuration Report that matches\n // the requested groupId, unless groupId 0 was requested\n return sent.groupId === 0 || received.groupId === sent.groupId;\n}\n// @publicAPI\nexport interface SceneControllerConfigurationCCGetOptions {\n groupId: number;\n}\n@CCCommand(SceneControllerConfigurationCommand.Get)\n@expectedCCResponse(SceneControllerConfigurationCCReport, testResponseForSceneControllerConfigurationGet)\nexport class SceneControllerConfigurationCCGet extends SceneControllerConfigurationCC {\n public constructor(options: WithAddress<SceneControllerConfigurationCCGetOptions>) {\n super(options);\n this.groupId = options.groupId;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): SceneControllerConfigurationCCGet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new SceneControllerConfigurationCCGet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public groupId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.groupId]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"group id\": this.groupId },\n };\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAA6P;AAC7P,oBAA4B;AAC5B,iBAA8M;AAC9M,0BAAkJ;AAClJ,oCAAg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,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACT,YAAmB,SAA8D;AAC7E,YAAM,OAAO;AACb,WAAK,UAAU,QAAQ;IAC3B;IACO,OAAO,KAAK,MAAa,MAAsB;AAElD,YAAM,IAAI,uBAAW,GAAG,KAAK,IAAI,qCAAqC,4BAAgB,8BAA8B;IAIxH;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,OAAO,CAAC;AACxC,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,YAAY,KAAK,QAAO;;IAE3C;;;;",
6
6
  "names": ["SceneControllerConfigurationCC"]
7
7
  }
@@ -73,7 +73,7 @@ export declare class SecurityCCCommandEncapsulation extends SecurityCC {
73
73
  private authCode?;
74
74
  private ciphertext?;
75
75
  getPartialCCSessionId(): Record<string, any> | undefined;
76
- expectMoreMessages(): boolean;
76
+ getRemainingSegments(): number | undefined;
77
77
  mergePartialCCs(partials: SecurityCCCommandEncapsulation[], ctx: CCParsingContext): Promise<void>;
78
78
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
79
79
  protected computeEncapsulationOverhead(): number;
@@ -120,7 +120,7 @@ export declare class SecurityCCCommandsSupportedReport extends SecurityCC {
120
120
  supportedCCs: CommandClasses[];
121
121
  controlledCCs: CommandClasses[];
122
122
  getPartialCCSessionId(): Record<string, any> | undefined;
123
- expectMoreMessages(): boolean;
123
+ getRemainingSegments(): number | undefined;
124
124
  mergePartialCCs(partials: SecurityCCCommandsSupportedReport[]): Promise<void>;
125
125
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
126
126
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;