@zwave-js/cc 15.15.2 → 15.16.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 (108) hide show
  1. package/build/cjs/cc/BatteryCC.js +4 -0
  2. package/build/cjs/cc/BatteryCC.js.map +2 -2
  3. package/build/cjs/cc/ConfigurationCC.d.ts +6 -0
  4. package/build/cjs/cc/ConfigurationCC.js +49 -1
  5. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  6. package/build/cjs/cc/EntryControlCC.d.ts +2 -2
  7. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  8. package/build/cjs/cc/FirmwareUpdateMetaDataCC.d.ts +4 -4
  9. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
  10. package/build/cjs/cc/ManufacturerProprietaryCC.d.ts +4 -4
  11. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  12. package/build/cjs/cc/MeterCC.js.map +2 -2
  13. package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
  14. package/build/cjs/cc/NodeNamingCC.js.map +2 -2
  15. package/build/cjs/cc/NotificationCC.d.ts +3 -3
  16. package/build/cjs/cc/NotificationCC.js.map +2 -2
  17. package/build/cjs/cc/Security2CC.d.ts +14 -14
  18. package/build/cjs/cc/Security2CC.js.map +2 -2
  19. package/build/cjs/cc/SecurityCC.d.ts +10 -10
  20. package/build/cjs/cc/SecurityCC.js.map +2 -2
  21. package/build/cjs/cc/ThermostatModeCC.d.ts +6 -6
  22. package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
  23. package/build/cjs/cc/TransportServiceCC.d.ts +7 -7
  24. package/build/cjs/cc/TransportServiceCC.js.map +2 -2
  25. package/build/cjs/cc/UserCodeCC.d.ts +6 -6
  26. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  27. package/build/cjs/cc/VersionCC.js.map +2 -2
  28. package/build/cjs/cc/ZWaveProtocolCC.d.ts +3 -3
  29. package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
  30. package/build/cjs/lib/CommandClass.d.ts +4 -4
  31. package/build/cjs/lib/CommandClass.js.map +2 -2
  32. package/build/cjs/lib/NotificationEventPayload.d.ts +2 -1
  33. package/build/cjs/lib/NotificationEventPayload.js.map +2 -2
  34. package/build/cjs/lib/Security2/Extension.d.ts +12 -12
  35. package/build/cjs/lib/Security2/Extension.js.map +2 -2
  36. package/build/cjs/lib/_Types.d.ts +2 -1
  37. package/build/cjs/lib/_Types.js.map +2 -2
  38. package/build/cjs/lib/serializers.d.ts +4 -4
  39. package/build/cjs/lib/serializers.js.map +2 -2
  40. package/build/cjs/lib/traits.d.ts +5 -0
  41. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  42. package/build/esm/cc/BatteryCC.js +3 -0
  43. package/build/esm/cc/BatteryCC.js.map +1 -1
  44. package/build/esm/cc/ConfigurationCC.d.ts +6 -0
  45. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  46. package/build/esm/cc/ConfigurationCC.js +62 -1
  47. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  48. package/build/esm/cc/EntryControlCC.d.ts +2 -2
  49. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  50. package/build/esm/cc/EntryControlCC.js.map +1 -1
  51. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts +4 -4
  52. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  53. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  54. package/build/esm/cc/ManufacturerProprietaryCC.d.ts +4 -4
  55. package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
  56. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  57. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  58. package/build/esm/cc/MeterCC.js.map +1 -1
  59. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  60. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  61. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  62. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  63. package/build/esm/cc/NotificationCC.d.ts +3 -3
  64. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  65. package/build/esm/cc/NotificationCC.js.map +1 -1
  66. package/build/esm/cc/Security2CC.d.ts +14 -14
  67. package/build/esm/cc/Security2CC.d.ts.map +1 -1
  68. package/build/esm/cc/Security2CC.js +1 -1
  69. package/build/esm/cc/Security2CC.js.map +1 -1
  70. package/build/esm/cc/SecurityCC.d.ts +10 -10
  71. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  72. package/build/esm/cc/SecurityCC.js +1 -1
  73. package/build/esm/cc/SecurityCC.js.map +1 -1
  74. package/build/esm/cc/ThermostatModeCC.d.ts +6 -6
  75. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  76. package/build/esm/cc/ThermostatModeCC.js +1 -1
  77. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  78. package/build/esm/cc/TransportServiceCC.d.ts +7 -7
  79. package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
  80. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  81. package/build/esm/cc/UserCodeCC.d.ts +6 -6
  82. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  83. package/build/esm/cc/UserCodeCC.js.map +1 -1
  84. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  85. package/build/esm/cc/VersionCC.js +1 -1
  86. package/build/esm/cc/VersionCC.js.map +1 -1
  87. package/build/esm/cc/ZWaveProtocolCC.d.ts +3 -3
  88. package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
  89. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  90. package/build/esm/lib/CommandClass.d.ts +4 -4
  91. package/build/esm/lib/CommandClass.d.ts.map +1 -1
  92. package/build/esm/lib/CommandClass.js.map +1 -1
  93. package/build/esm/lib/NotificationEventPayload.d.ts +2 -1
  94. package/build/esm/lib/NotificationEventPayload.d.ts.map +1 -1
  95. package/build/esm/lib/NotificationEventPayload.js.map +1 -1
  96. package/build/esm/lib/Security2/Extension.d.ts +12 -12
  97. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  98. package/build/esm/lib/Security2/Extension.js +1 -1
  99. package/build/esm/lib/Security2/Extension.js.map +1 -1
  100. package/build/esm/lib/_Types.d.ts +2 -1
  101. package/build/esm/lib/_Types.d.ts.map +1 -1
  102. package/build/esm/lib/_Types.js.map +1 -1
  103. package/build/esm/lib/serializers.d.ts +4 -4
  104. package/build/esm/lib/serializers.d.ts.map +1 -1
  105. package/build/esm/lib/serializers.js.map +1 -1
  106. package/build/esm/lib/traits.d.ts +5 -0
  107. package/build/esm/lib/traits.d.ts.map +1 -1
  108. package/package.json +10 -10
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cc/ManufacturerProprietaryCC.ts"],
4
- "sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI, type CCAPIEndpoint, type CCAPIHost } from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\nimport { ManufacturerSpecificCCValues } from \"./ManufacturerSpecificCC.js\";\nimport {\n\tgetManufacturerId,\n\tgetManufacturerProprietaryAPI,\n\tgetManufacturerProprietaryCCConstructor,\n} from \"./manufacturerProprietary/Decorators.js\";\n\nexport type ManufacturerProprietaryCCConstructor<\n\tT extends typeof ManufacturerProprietaryCC =\n\t\ttypeof ManufacturerProprietaryCC,\n> = T & {\n\t// I don't like the any, but we need it to support half-implemented CCs (e.g. report classes)\n\tnew (options: any): InstanceType<T>;\n};\n\n@API(CommandClasses[\"Manufacturer Proprietary\"])\nexport class ManufacturerProprietaryCCAPI extends CCAPI {\n\tpublic constructor(\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t) {\n\t\tsuper(host, endpoint);\n\n\t\t// Read the manufacturer ID from Manufacturer Specific CC\n\t\tconst manufacturerId = this.getValueDB().getValue<number>(\n\t\t\tManufacturerSpecificCCValues.manufacturerId.id,\n\t\t);\n\t\t// If possible, try to defer to a specific subclass of this API\n\t\tif (manufacturerId != undefined) {\n\t\t\tconst SpecificAPIConstructor = getManufacturerProprietaryAPI(\n\t\t\t\tmanufacturerId,\n\t\t\t);\n\t\t\tif (\n\t\t\t\tSpecificAPIConstructor != undefined\n\t\t\t\t&& new.target !== SpecificAPIConstructor\n\t\t\t) {\n\t\t\t\treturn new SpecificAPIConstructor(host, endpoint);\n\t\t\t}\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendData(\n\t\tmanufacturerId: number,\n\t\tdata?: Uint8Array,\n\t): Promise<void> {\n\t\tconst cc = new ManufacturerProprietaryCC({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tmanufacturerId,\n\t\t});\n\t\tcc.payload = data ? Bytes.view(data) : new Bytes();\n\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async sendAndReceiveData(manufacturerId: number, data?: Uint8Array) {\n\t\tconst cc = new ManufacturerProprietaryCC({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tmanufacturerId,\n\t\t\tunspecifiedExpectsResponse: true,\n\t\t});\n\t\tcc.payload = data ? Bytes.view(data) : new Bytes();\n\n\t\tconst response = await this.host.sendCommand<\n\t\t\tManufacturerProprietaryCC\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\tmanufacturerId: response.manufacturerId,\n\t\t\t\tdata: response.payload,\n\t\t\t};\n\t\t}\n\t}\n}\n\n// @publicAPI\nexport interface ManufacturerProprietaryCCOptions {\n\tmanufacturerId?: number;\n\tunspecifiedExpectsResponse?: boolean;\n\t// Needed to support unknown proprietary commands\n\tpayload?: Uint8Array;\n}\n\nfunction getReponseForManufacturerProprietary(cc: ManufacturerProprietaryCC) {\n\treturn cc.unspecifiedExpectsResponse\n\t\t? ManufacturerProprietaryCC\n\t\t: undefined;\n}\n\nfunction testResponseForManufacturerProprietaryRequest(\n\tsent: ManufacturerProprietaryCC,\n\treceived: ManufacturerProprietaryCC,\n): boolean {\n\t// We expect a Manufacturer Proprietary response that has the same manufacturer ID as the request\n\treturn sent.manufacturerId === received.manufacturerId;\n}\n\n@commandClass(CommandClasses[\"Manufacturer Proprietary\"])\n@implementedVersion(1)\n@expectedCCResponse(\n\tgetReponseForManufacturerProprietary,\n\ttestResponseForManufacturerProprietaryRequest,\n)\nexport class ManufacturerProprietaryCC extends CommandClass {\n\tdeclare ccCommand: undefined;\n\n\tpublic constructor(\n\t\toptions: WithAddress<ManufacturerProprietaryCCOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.manufacturerId = options.manufacturerId\n\t\t\t?? getManufacturerId(this);\n\t\tthis.unspecifiedExpectsResponse = options.unspecifiedExpectsResponse;\n\n\t\t// To use this CC, a manufacturer ID must exist in the value DB\n\t\t// If it doesn't, the interview procedure will throw.\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ManufacturerProprietaryCC {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst manufacturerId = raw.payload.readUInt16BE(0);\n\t\t// Try to parse the proprietary command\n\t\tconst PCConstructor = getManufacturerProprietaryCCConstructor(\n\t\t\tmanufacturerId,\n\t\t);\n\t\tconst payload = raw.payload.subarray(2);\n\t\tif (PCConstructor) {\n\t\t\treturn PCConstructor.from(\n\t\t\t\traw.withPayload(payload),\n\t\t\t\tctx,\n\t\t\t);\n\t\t}\n\n\t\treturn new ManufacturerProprietaryCC({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tmanufacturerId,\n\t\t\tpayload,\n\t\t});\n\t}\n\n\tpublic manufacturerId?: number;\n\n\t/**\n\t * @internal\n\t * This is used to indicate that an unspecified Manufacturer Proprietary CC instance expects a response.\n\t * Subclasses should roll their own `@expectedCCResponse` instead.\n\t */\n\tpublic readonly unspecifiedExpectsResponse?: boolean;\n\n\tprivate getManufacturerIdOrThrow(): number {\n\t\tif (this.manufacturerId == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`To use an instance of ManufacturerProprietaryCC, the manufacturer ID must be stored in the value DB`,\n\t\t\t\tZWaveErrorCodes.ManufacturerProprietaryCC_NoManufacturerId,\n\t\t\t);\n\t\t}\n\t\treturn this.manufacturerId;\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst manufacturerId = this.getManufacturerIdOrThrow();\n\t\t// ManufacturerProprietaryCC has no CC command, so the first byte\n\t\t// is stored in ccCommand\n\t\t(this.ccCommand as unknown as number) = (manufacturerId >>> 8) & 0xff;\n\t\t// The 2nd byte is in the payload\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\t// 2nd byte of manufacturerId\n\t\t\t\tmanufacturerId & 0xff,\n\t\t\t]),\n\t\t\tthis.payload,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic createSpecificInstance(): ManufacturerProprietaryCC | undefined {\n\t\t// Try to defer to the correct subclass\n\t\tif (this.manufacturerId != undefined) {\n\t\t\tconst PCConstructor = getManufacturerProprietaryCCConstructor(\n\t\t\t\tthis.manufacturerId,\n\t\t\t);\n\t\t\tif (PCConstructor) {\n\t\t\t\treturn new PCConstructor({\n\t\t\t\t\tnodeId: this.nodeId,\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\t// Read the manufacturer ID from Manufacturer Specific CC\n\t\tthis.manufacturerId = this.getValue(\n\t\t\tctx,\n\t\t\tManufacturerSpecificCCValues.manufacturerId,\n\t\t)!;\n\t\tconst pcInstance = this.createSpecificInstance();\n\t\tif (pcInstance) {\n\t\t\tawait pcInstance.interview(ctx);\n\t\t} else {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tmessage:\n\t\t\t\t\t`${this.constructor.name}: skipping interview refresh because the matching proprietary CC is not implemented...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t}\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tif (this.manufacturerId == undefined) {\n\t\t\t// Read the manufacturer ID from Manufacturer Specific CC\n\t\t\tthis.manufacturerId = this.getValue(\n\t\t\t\tctx,\n\t\t\t\tManufacturerSpecificCCValues.manufacturerId,\n\t\t\t)!;\n\t\t}\n\t\tconst pcInstance = this.createSpecificInstance();\n\t\tif (pcInstance) {\n\t\t\tawait pcInstance.refreshValues(ctx);\n\t\t} else {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tmessage:\n\t\t\t\t\t`${this.constructor.name}: skipping value refresh because the matching proprietary CC is not implemented...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t}\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAMO;AACP,oBAAsB;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AsB;AAC9C,UAAI,YAAY;AACf,cAAM,WAAW,cAAc,GAAG;MACnC,OAAO;AACN,YAAI,QAAQ,KAAK,IAAI;UACpB,SACC,GAAG,KAAK,YAAY,IAAI;UACzB,WAAW;SACX;MACF;IACD;;;;",
4
+ "sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, type BytesView } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI, type CCAPIEndpoint, type CCAPIHost } from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\nimport { ManufacturerSpecificCCValues } from \"./ManufacturerSpecificCC.js\";\nimport {\n\tgetManufacturerId,\n\tgetManufacturerProprietaryAPI,\n\tgetManufacturerProprietaryCCConstructor,\n} from \"./manufacturerProprietary/Decorators.js\";\n\nexport type ManufacturerProprietaryCCConstructor<\n\tT extends typeof ManufacturerProprietaryCC =\n\t\ttypeof ManufacturerProprietaryCC,\n> = T & {\n\t// I don't like the any, but we need it to support half-implemented CCs (e.g. report classes)\n\tnew (options: any): InstanceType<T>;\n};\n\n@API(CommandClasses[\"Manufacturer Proprietary\"])\nexport class ManufacturerProprietaryCCAPI extends CCAPI {\n\tpublic constructor(\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t) {\n\t\tsuper(host, endpoint);\n\n\t\t// Read the manufacturer ID from Manufacturer Specific CC\n\t\tconst manufacturerId = this.getValueDB().getValue<number>(\n\t\t\tManufacturerSpecificCCValues.manufacturerId.id,\n\t\t);\n\t\t// If possible, try to defer to a specific subclass of this API\n\t\tif (manufacturerId != undefined) {\n\t\t\tconst SpecificAPIConstructor = getManufacturerProprietaryAPI(\n\t\t\t\tmanufacturerId,\n\t\t\t);\n\t\t\tif (\n\t\t\t\tSpecificAPIConstructor != undefined\n\t\t\t\t&& new.target !== SpecificAPIConstructor\n\t\t\t) {\n\t\t\t\treturn new SpecificAPIConstructor(host, endpoint);\n\t\t\t}\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendData(\n\t\tmanufacturerId: number,\n\t\tdata?: BytesView,\n\t): Promise<void> {\n\t\tconst cc = new ManufacturerProprietaryCC({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tmanufacturerId,\n\t\t});\n\t\tcc.payload = data ? Bytes.view(data) : new Bytes();\n\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async sendAndReceiveData(manufacturerId: number, data?: BytesView) {\n\t\tconst cc = new ManufacturerProprietaryCC({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tmanufacturerId,\n\t\t\tunspecifiedExpectsResponse: true,\n\t\t});\n\t\tcc.payload = data ? Bytes.view(data) : new Bytes();\n\n\t\tconst response = await this.host.sendCommand<\n\t\t\tManufacturerProprietaryCC\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\tmanufacturerId: response.manufacturerId,\n\t\t\t\tdata: response.payload,\n\t\t\t};\n\t\t}\n\t}\n}\n\n// @publicAPI\nexport interface ManufacturerProprietaryCCOptions {\n\tmanufacturerId?: number;\n\tunspecifiedExpectsResponse?: boolean;\n\t// Needed to support unknown proprietary commands\n\tpayload?: BytesView;\n}\n\nfunction getReponseForManufacturerProprietary(cc: ManufacturerProprietaryCC) {\n\treturn cc.unspecifiedExpectsResponse\n\t\t? ManufacturerProprietaryCC\n\t\t: undefined;\n}\n\nfunction testResponseForManufacturerProprietaryRequest(\n\tsent: ManufacturerProprietaryCC,\n\treceived: ManufacturerProprietaryCC,\n): boolean {\n\t// We expect a Manufacturer Proprietary response that has the same manufacturer ID as the request\n\treturn sent.manufacturerId === received.manufacturerId;\n}\n\n@commandClass(CommandClasses[\"Manufacturer Proprietary\"])\n@implementedVersion(1)\n@expectedCCResponse(\n\tgetReponseForManufacturerProprietary,\n\ttestResponseForManufacturerProprietaryRequest,\n)\nexport class ManufacturerProprietaryCC extends CommandClass {\n\tdeclare ccCommand: undefined;\n\n\tpublic constructor(\n\t\toptions: WithAddress<ManufacturerProprietaryCCOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.manufacturerId = options.manufacturerId\n\t\t\t?? getManufacturerId(this);\n\t\tthis.unspecifiedExpectsResponse = options.unspecifiedExpectsResponse;\n\n\t\t// To use this CC, a manufacturer ID must exist in the value DB\n\t\t// If it doesn't, the interview procedure will throw.\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ManufacturerProprietaryCC {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst manufacturerId = raw.payload.readUInt16BE(0);\n\t\t// Try to parse the proprietary command\n\t\tconst PCConstructor = getManufacturerProprietaryCCConstructor(\n\t\t\tmanufacturerId,\n\t\t);\n\t\tconst payload = raw.payload.subarray(2);\n\t\tif (PCConstructor) {\n\t\t\treturn PCConstructor.from(\n\t\t\t\traw.withPayload(payload),\n\t\t\t\tctx,\n\t\t\t);\n\t\t}\n\n\t\treturn new ManufacturerProprietaryCC({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tmanufacturerId,\n\t\t\tpayload,\n\t\t});\n\t}\n\n\tpublic manufacturerId?: number;\n\n\t/**\n\t * @internal\n\t * This is used to indicate that an unspecified Manufacturer Proprietary CC instance expects a response.\n\t * Subclasses should roll their own `@expectedCCResponse` instead.\n\t */\n\tpublic readonly unspecifiedExpectsResponse?: boolean;\n\n\tprivate getManufacturerIdOrThrow(): number {\n\t\tif (this.manufacturerId == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`To use an instance of ManufacturerProprietaryCC, the manufacturer ID must be stored in the value DB`,\n\t\t\t\tZWaveErrorCodes.ManufacturerProprietaryCC_NoManufacturerId,\n\t\t\t);\n\t\t}\n\t\treturn this.manufacturerId;\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst manufacturerId = this.getManufacturerIdOrThrow();\n\t\t// ManufacturerProprietaryCC has no CC command, so the first byte\n\t\t// is stored in ccCommand\n\t\t(this.ccCommand as unknown as number) = (manufacturerId >>> 8) & 0xff;\n\t\t// The 2nd byte is in the payload\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\t// 2nd byte of manufacturerId\n\t\t\t\tmanufacturerId & 0xff,\n\t\t\t]),\n\t\t\tthis.payload,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic createSpecificInstance(): ManufacturerProprietaryCC | undefined {\n\t\t// Try to defer to the correct subclass\n\t\tif (this.manufacturerId != undefined) {\n\t\t\tconst PCConstructor = getManufacturerProprietaryCCConstructor(\n\t\t\t\tthis.manufacturerId,\n\t\t\t);\n\t\t\tif (PCConstructor) {\n\t\t\t\treturn new PCConstructor({\n\t\t\t\t\tnodeId: this.nodeId,\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\t// Read the manufacturer ID from Manufacturer Specific CC\n\t\tthis.manufacturerId = this.getValue(\n\t\t\tctx,\n\t\t\tManufacturerSpecificCCValues.manufacturerId,\n\t\t)!;\n\t\tconst pcInstance = this.createSpecificInstance();\n\t\tif (pcInstance) {\n\t\t\tawait pcInstance.interview(ctx);\n\t\t} else {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tmessage:\n\t\t\t\t\t`${this.constructor.name}: skipping interview refresh because the matching proprietary CC is not implemented...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t}\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tif (this.manufacturerId == undefined) {\n\t\t\t// Read the manufacturer ID from Manufacturer Specific CC\n\t\t\tthis.manufacturerId = this.getValue(\n\t\t\t\tctx,\n\t\t\t\tManufacturerSpecificCCValues.manufacturerId,\n\t\t\t)!;\n\t\t}\n\t\tconst pcInstance = this.createSpecificInstance();\n\t\tif (pcInstance) {\n\t\t\tawait pcInstance.refreshValues(ctx);\n\t\t} else {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tmessage:\n\t\t\t\t\t`${this.constructor.name}: skipping value refresh because the matching proprietary CC is not implemented...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t}\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAMO;AACP,oBAAsC;AAEtC,iBAA0D;AAC1D,0BAKO;AACP,oCAKO;AACP,oCAA6C;AAC7C,wBAIO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWM,gCAA4B,MAAA;8BADxC,mCAAI,2BAAe,0BAA0B,CAAC,CAAC;;;;oBACE;;;;oDAAA,YAAK;WAAA;;;;;;;;8BAyBrD,mDAAA,CAAc;wCAed,6DAAA,CAAc;AAdf,mBAAA,MAAA,MAAA,sBAAA,EAAA,MAAA,UAAA,MAAA,YAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,cAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,UAAb,OAAqB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AO;QAC3B,oBAAM,KAAK;;UAEV,iBAAiB;SACjB;QACD,KAAK;OACL;AACD,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,yBAAsB;AAE5B,UAAI,KAAK,kBAAkB,QAAW;AACrC,cAAM,oBAAgB,2DACrB,KAAK,cAAc;AAEpB,YAAI,eAAe;AAClB,iBAAO,IAAI,cAAc;YACxB,QAAQ,KAAK;YACb,UAAU,KAAK;WACf;QACF;MACD;IACD;IAEO,MAAM,UACZ,KAAqB;AAErB,YAAM,OAAO,KAAK,QAAQ,GAAG;AAG7B,WAAK,iBAAiB,KAAK,SAC1B,KACA,2DAA6B,cAAc;AAE5C,YAAM,aAAa,KAAK,uBAAsB;AAC9C,UAAI,YAAY;AACf,cAAM,WAAW,UAAU,GAAG;MAC/B,OAAO;AACN,YAAI,QAAQ,KAAK,IAAI;UACpB,SACC,GAAG,KAAK,YAAY,IAAI;UACzB,WAAW;SACX;MACF;AAGA,WAAK,qBAAqB,KAAK,IAAI;IACpC;IAEO,MAAM,cACZ,KAAyB;AAEzB,YAAM,OAAO,KAAK,QAAQ,GAAG;AAE7B,UAAI,KAAK,kBAAkB,QAAW;AAErC,aAAK,iBAAiB,KAAK,SAC1B,KACA,2DAA6B,cAAc;MAE7C;AACA,YAAM,aAAa,KAAK,uBAAsB;AAC9C,UAAI,YAAY;AACf,cAAM,WAAW,cAAc,GAAG;MACnC,OAAO;AACN,YAAI,QAAQ,KAAK,IAAI;UACpB,SACC,GAAG,KAAK,YAAY,IAAI;UACzB,WAAW;SACX;MACF;IACD;;;;",
6
6
  "names": ["ManufacturerProprietaryCC"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cc/MeterCC.ts"],
4
- "sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype EndpointId,\n\ttype FloatParameters,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MaybeUnknown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype NodeId,\n\ttype SinglecastCC,\n\ttype SupervisionResult,\n\ttype SupportsCC,\n\tUNKNOWN_STATE,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeBitMask,\n\tencodeFloatWithScale,\n\tgetFloatParameters,\n\tgetMeter,\n\tgetMeterName,\n\tgetMeterScale,\n\tgetUnknownMeterScale,\n\tparseBitMask,\n\tparseFloatWithScale,\n\ttimespan,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport {\n\ttype AllOrNone,\n\tBytes,\n\tgetEnumMemberName,\n\tnum2hex,\n\tpick,\n} from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\tPhysicalCCAPI,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\tSET_VALUE_HOOKS,\n\ttype SetValueImplementation,\n\ttype SetValueImplementationHooksFactory,\n\tthrowMissingPropertyKey,\n\tthrowUnsupportedProperty,\n\tthrowUnsupportedPropertyKey,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport { meterTypesToPropertyKey } from \"../lib/CCValueUtils.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\tgetCommandClass,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { MeterCommand, type MeterReading, RateType } from \"../lib/_Types.js\";\n\nexport const MeterCCValues = V.defineCCValues(CommandClasses.Meter, {\n\t...V.staticProperty(\"type\", undefined, { internal: true }),\n\t...V.staticProperty(\"supportsReset\", undefined, { internal: true }),\n\t...V.staticProperty(\"supportedScales\", undefined, { internal: true }),\n\t...V.staticProperty(\"supportedRateTypes\", undefined, {\n\t\tinternal: true,\n\t}),\n\t...V.staticPropertyWithName(\n\t\t\"resetAll\",\n\t\t\"reset\",\n\t\t{\n\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\tlabel: `Reset accumulated values`,\n\t\t\tstates: {\n\t\t\t\ttrue: \"Reset\",\n\t\t\t},\n\t\t} as const,\n\t),\n\t...V.dynamicPropertyAndKeyWithName(\n\t\t\"resetSingle\",\n\t\t\"reset\",\n\t\tmeterTypesToPropertyKey,\n\t\t({ property, propertyKey }) =>\n\t\t\tproperty === \"reset\" && typeof propertyKey === \"number\",\n\t\t(meterType: number, rateType: RateType, scale: number) => ({\n\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\t// This is only a placeholder label. A config manager is needed to\n\t\t\t// determine the actual label.\n\t\t\tlabel: `Reset (${\n\t\t\t\trateType === RateType.Consumed\n\t\t\t\t\t? \"Consumption, \"\n\t\t\t\t\t: rateType === RateType.Produced\n\t\t\t\t\t? \"Production, \"\n\t\t\t\t\t: \"\"\n\t\t\t}${num2hex(scale)})`,\n\t\t\tstates: {\n\t\t\t\ttrue: \"Reset\",\n\t\t\t},\n\t\t\tccSpecific: {\n\t\t\t\tmeterType,\n\t\t\t\trateType,\n\t\t\t\tscale,\n\t\t\t},\n\t\t} as const),\n\t),\n\t...V.dynamicPropertyAndKeyWithName(\n\t\t\"value\",\n\t\t\"value\",\n\t\tmeterTypesToPropertyKey,\n\t\t({ property, propertyKey }) =>\n\t\t\tproperty === \"value\" && typeof propertyKey === \"number\",\n\t\t(meterType: number, rateType: RateType, scale: number) => ({\n\t\t\t...ValueMetadata.ReadOnlyNumber,\n\t\t\t// Label and unit can only be determined with a config manager\n\t\t\tccSpecific: {\n\t\t\t\tmeterType,\n\t\t\t\trateType,\n\t\t\t\tscale,\n\t\t\t},\n\t\t} as const),\n\t),\n});\n\nfunction splitPropertyKey(key: number): {\n\tmeterType: number;\n\trateType: RateType;\n\tscale: number;\n} {\n\treturn {\n\t\trateType: key & 0xff,\n\t\tscale: (key >>> 8) & 0xff,\n\t\tmeterType: key >>> 16,\n\t};\n}\n\nfunction getValueLabel(\n\tmeterType: number,\n\tscale: number,\n\trateType: RateType,\n\tsuffix?: string,\n): string {\n\tlet ret = getMeterName(meterType);\n\tconst scaleLabel =\n\t\t(getMeterScale(meterType, scale) ?? getUnknownMeterScale(scale)).label;\n\tswitch (rateType) {\n\t\tcase RateType.Consumed:\n\t\t\tret += ` Consumption [${scaleLabel}]`;\n\t\t\tbreak;\n\t\tcase RateType.Produced:\n\t\t\tret += ` Production [${scaleLabel}]`;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tret += ` [${scaleLabel}]`;\n\t}\n\tif (suffix) {\n\t\tret += ` (${suffix})`;\n\t}\n\treturn ret;\n}\n\nfunction parseMeterValueAndInfo(data: Uint8Array, offset: number): {\n\ttype: number;\n\trateType: RateType;\n\tscale1: number;\n\tvalue: number;\n\tbytesRead: number;\n} {\n\tvalidatePayload(data.length >= offset + 1);\n\n\tconst type = data[offset] & 0b0_00_11111;\n\tconst rateType = (data[offset] & 0b0_11_00000) >>> 5;\n\tconst scale1Bit2 = (data[offset] & 0b1_00_00000) >>> 7;\n\n\tconst {\n\t\tscale: scale1Bits10,\n\t\tvalue,\n\t\tbytesRead,\n\t} = parseFloatWithScale(data.subarray(offset + 1));\n\n\treturn {\n\t\ttype,\n\t\trateType,\n\t\t// The scale is composed of two fields\n\t\tscale1: (scale1Bit2 << 2) | scale1Bits10,\n\t\tvalue,\n\t\t// We've read one byte more than the float contains\n\t\tbytesRead: bytesRead + 1,\n\t};\n}\n\nfunction encodeMeterValueAndInfo(\n\ttype: number,\n\trateType: RateType,\n\tscale: number,\n\tvalue: number,\n): { data: Bytes; floatParams: FloatParameters; scale2: number | undefined } {\n\t// We need at least 2 bytes\n\n\tconst scale1 = scale >= 7 ? 7 : scale & 0b111;\n\tconst scale1Bits10 = scale1 & 0b11;\n\tconst scale1Bit2 = scale1 >>> 2;\n\tconst scale2 = scale >= 7 ? scale - 7 : undefined;\n\n\tconst typeByte = (type & 0b0_00_11111)\n\t\t| ((rateType & 0b11) << 5)\n\t\t| (scale1Bit2 << 7);\n\n\tconst floatParams = getFloatParameters(value);\n\tconst valueBytes = encodeFloatWithScale(\n\t\tvalue,\n\t\tscale1Bits10,\n\t\tfloatParams,\n\t);\n\n\treturn {\n\t\tdata: Bytes.concat([Bytes.from([typeByte]), valueBytes]),\n\t\tfloatParams: pick(floatParams, [\"precision\", \"size\"]),\n\t\tscale2,\n\t};\n}\n\nfunction parseScale(\n\tscale1: number,\n\tdata: Uint8Array,\n\tscale2Offset: number,\n): number {\n\tif (scale1 === 7) {\n\t\tvalidatePayload(data.length >= scale2Offset + 1);\n\t\tconst scale2 = data[scale2Offset];\n\t\treturn scale1 + scale2;\n\t} else {\n\t\treturn scale1;\n\t}\n}\n\nexport function isAccumulatedValue(\n\tmeterType: number,\n\tscale: number,\n): boolean {\n\t// FIXME: We should probably move the meter definitions into code\n\tswitch (meterType) {\n\t\tcase 0x01: // Electric\n\t\t\treturn (\n\t\t\t\t// kVarh\n\t\t\t\t// Pulse count\n\t\t\t\tscale === 0x00 // kWh\n\t\t\t\t|| scale === 0x01 // kVAh\n\t\t\t\t|| scale === 0x03\n\t\t\t\t|| scale === 0x08\n\t\t\t);\n\t\tcase 0x02: // Gas\n\t\t\treturn (\n\t\t\t\t// Pulse count\n\t\t\t\t// ft\u00B3\n\t\t\t\tscale === 0x00 // m\u00B3\n\t\t\t\t|| scale === 0x01\n\t\t\t\t|| scale === 0x03\n\t\t\t);\n\t\tcase 0x03: // Water\n\t\t\treturn (\n\t\t\t\t// Pulse count\n\t\t\t\t// US gallons\n\t\t\t\tscale === 0x00 // m\u00B3\n\t\t\t\t|| scale === 0x01 // ft\u00B3\n\t\t\t\t|| scale === 0x02\n\t\t\t\t|| scale === 0x03\n\t\t\t);\n\t\tcase 0x04: // Heating\n\t\t\treturn scale === 0x00; // kWh\n\t\tcase 0x05: // Cooling\n\t\t\treturn scale === 0x00; // kWh\n\t}\n\treturn false;\n}\n\n@API(CommandClasses.Meter)\nexport class MeterCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: MeterCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase MeterCommand.Get:\n\t\t\tcase MeterCommand.Report:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase MeterCommand.SupportedGet:\n\t\t\tcase MeterCommand.SupportedReport:\n\t\t\t\treturn this.version >= 2;\n\t\t\tcase MeterCommand.Reset: {\n\t\t\t\tconst ret = this.tryGetValueDB()?.getValue<boolean>({\n\t\t\t\t\tcommandClass: getCommandClass(this),\n\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\tproperty: \"supportsReset\",\n\t\t\t\t});\n\t\t\t\treturn ret === true;\n\t\t\t}\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: MeterCCAPI, { property, propertyKey }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"value\":\n\t\t\t\tcase \"previousValue\":\n\t\t\t\tcase \"deltaTime\": {\n\t\t\t\t\tif (propertyKey == undefined) {\n\t\t\t\t\t\tthrowMissingPropertyKey(this.ccId, property);\n\t\t\t\t\t} else if (typeof propertyKey !== \"number\") {\n\t\t\t\t\t\tthrowUnsupportedPropertyKey(\n\t\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { rateType, scale } = splitPropertyKey(propertyKey);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tawait this.get({\n\t\t\t\t\t\t\trateType,\n\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t})\n\t\t\t\t\t)?.[property];\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n\n\t@validateArgs()\n\tpublic async get(\n\t\toptions?: MeterCCGetOptions,\n\t): Promise<MeterReading | undefined> {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.Get);\n\n\t\tconst cc = new MeterCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\tconst response = await this.host.sendCommand<MeterCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\ttype: response.type,\n\t\t\t\tscale: getMeterScale(response.type, response.scale)\n\t\t\t\t\t?? getUnknownMeterScale(response.scale),\n\t\t\t\t...pick(response, [\n\t\t\t\t\t\"value\",\n\t\t\t\t\t\"previousValue\",\n\t\t\t\t\t\"rateType\",\n\t\t\t\t\t\"deltaTime\",\n\t\t\t\t]),\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\toptions: MeterCCReportOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.Report);\n\n\t\tconst cc = new MeterCCReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\tpublic async getAll(\n\t\taccumulatedOnly: boolean = false,\n\t): Promise<MeterReading[]> {\n\t\tconst valueDB = this.tryGetValueDB();\n\n\t\tif (this.version >= 2) {\n\t\t\tconst meterType = valueDB?.getValue<number>(\n\t\t\t\tMeterCCValues.type.endpoint(this.endpoint.index),\n\t\t\t);\n\t\t\tconst supportedScales = valueDB?.getValue<number[]>(\n\t\t\t\tMeterCCValues.supportedScales.endpoint(this.endpoint.index),\n\t\t\t) ?? [];\n\t\t\tconst supportedRateTypes = valueDB?.getValue<RateType[]>(\n\t\t\t\tMeterCCValues.supportedRateTypes.endpoint(\n\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\n\t\t\tconst rateTypes = supportedRateTypes.length\n\t\t\t\t? supportedRateTypes\n\t\t\t\t: [undefined];\n\n\t\t\tconst ret = [];\n\t\t\tfor (const rateType of rateTypes) {\n\t\t\t\tfor (const scale of supportedScales) {\n\t\t\t\t\t// Skip non-accumulated values if requested\n\t\t\t\t\tif (\n\t\t\t\t\t\taccumulatedOnly\n\t\t\t\t\t\t&& meterType != undefined\n\t\t\t\t\t\t&& !isAccumulatedValue(meterType, scale)\n\t\t\t\t\t) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst response = await this.get({\n\t\t\t\t\t\tscale,\n\t\t\t\t\t\trateType,\n\t\t\t\t\t});\n\t\t\t\t\tif (response) ret.push(response);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ret;\n\t\t} else {\n\t\t\tconst response = await this.get();\n\t\t\treturn response ? [response] : [];\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getSupported() {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.SupportedGet);\n\n\t\tconst cc = new MeterCCSupportedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMeterCCSupportedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\n\t\t\t\t\"type\",\n\t\t\t\t\"supportsReset\",\n\t\t\t\t\"supportedScales\",\n\t\t\t\t\"supportedRateTypes\",\n\t\t\t]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendSupportedReport(\n\t\toptions: MeterCCSupportedReportOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.SupportedReport);\n\n\t\tconst cc = new MeterCCSupportedReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\tpublic async reset(\n\t\toptions?: MeterCCResetOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.Reset);\n\n\t\tconst cc = new MeterCCReset({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: MeterCCAPI,\n\t\t\t{ property, propertyKey },\n\t\t\tvalue,\n\t\t) {\n\t\t\tif (property !== \"reset\") {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t} else if (\n\t\t\t\tpropertyKey != undefined\n\t\t\t\t&& typeof propertyKey !== \"number\"\n\t\t\t) {\n\t\t\t\tthrowUnsupportedPropertyKey(this.ccId, property, propertyKey);\n\t\t\t} else if (value !== true) {\n\t\t\t\tthrowWrongValueType(\n\t\t\t\t\tthis.ccId,\n\t\t\t\t\tproperty,\n\t\t\t\t\t\"true\",\n\t\t\t\t\tvalue === false ? \"false\" : typeof value,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof propertyKey === \"number\") {\n\t\t\t\tconst { meterType, scale, rateType } = splitPropertyKey(\n\t\t\t\t\tpropertyKey,\n\t\t\t\t);\n\t\t\t\treturn this.reset({\n\t\t\t\t\ttype: meterType,\n\t\t\t\t\tscale,\n\t\t\t\t\trateType,\n\t\t\t\t\ttargetValue: 0,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn this.reset();\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t};\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = (\n\t\t{ property, propertyKey },\n\t\t_value,\n\t\t_options,\n\t) => {\n\t\tif (property !== \"reset\") return;\n\n\t\tif (typeof propertyKey === \"number\") {\n\t\t\t// Reset single\n\t\t\tconst { meterType, rateType, scale } = splitPropertyKey(\n\t\t\t\tpropertyKey,\n\t\t\t);\n\t\t\tconst readingValueId = MeterCCValues.value(\n\t\t\t\tmeterType,\n\t\t\t\trateType,\n\t\t\t\tscale,\n\t\t\t).endpoint(this.endpoint.index);\n\n\t\t\treturn {\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\tsupervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\tif (!supervisedAndSuccessful) return;\n\n\t\t\t\t\t// After resetting a single reading with supervision, store zero\n\t\t\t\t\t// in the corresponding value\n\t\t\t\t\tconst valueDB = this.tryGetValueDB();\n\t\t\t\t\tif (!valueDB) return;\n\n\t\t\t\t\tif (isAccumulatedValue(meterType, scale)) {\n\t\t\t\t\t\tvalueDB.setValue({\n\t\t\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t\t}, 0);\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\tthis.schedulePoll(\n\t\t\t\t\t\treadingValueId,\n\t\t\t\t\t\t0,\n\t\t\t\t\t\t{ transition: \"fast\" },\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else {\n\t\t\t// Reset all\n\t\t\tconst valueDB = this.tryGetValueDB();\n\t\t\tif (!valueDB) return;\n\n\t\t\tconst accumulatedValues = valueDB.findValues((vid) =>\n\t\t\t\tvid.commandClass === this.ccId\n\t\t\t\t&& vid.endpoint === this.endpoint.index\n\t\t\t\t&& MeterCCValues.value.is(vid)\n\t\t\t).filter(({ propertyKey }) => {\n\t\t\t\tif (typeof propertyKey !== \"number\") return false;\n\t\t\t\tconst { meterType, scale } = splitPropertyKey(propertyKey);\n\t\t\t\treturn isAccumulatedValue(meterType, scale);\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\tsupervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\tif (!supervisedAndSuccessful) return;\n\n\t\t\t\t\t// After setting the reset all value with supervision,\n\t\t\t\t\t// reset all accumulated values, since we know they are now zero.\n\t\t\t\t\tfor (const value of accumulatedValues) {\n\t\t\t\t\t\tvalueDB.setValue(value, 0);\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\t// Poll all accumulated values, unless they were updated by the device\n\t\t\t\t\tfor (const valueID of accumulatedValues) {\n\t\t\t\t\t\tthis.schedulePoll(\n\t\t\t\t\t\t\tvalueID,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t{ transition: \"fast\" },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t};\n}\n\n@commandClass(CommandClasses.Meter)\n@implementedVersion(6)\n@ccValues(MeterCCValues)\nexport class MeterCC extends CommandClass {\n\tdeclare ccCommand: MeterCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses.Meter,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tif (api.version >= 2) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying meter support...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\n\t\t\tconst suppResp = await api.getSupported();\n\t\t\tif (suppResp) {\n\t\t\t\tconst logMessage = `received meter support:\ntype: ${getMeterName(suppResp.type)}\nsupported scales: ${\n\t\t\t\t\tsuppResp.supportedScales\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(s) =>\n\t\t\t\t\t\t\t\t(getMeterScale(suppResp.type, s)\n\t\t\t\t\t\t\t\t\t?? getUnknownMeterScale(s)).label,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map((label) => `\\n\u00B7 ${label}`)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}\nsupported rate types: ${\n\t\t\t\t\tsuppResp.supportedRateTypes\n\t\t\t\t\t\t.map((rt) => getEnumMemberName(RateType, rt))\n\t\t\t\t\t\t.map((label) => `\\n\u00B7 ${label}`)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}\nsupports reset: ${suppResp.supportsReset}`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Querying meter support timed out, skipping interview...\",\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Query current meter values\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses.Meter,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tif (api.version === 1) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `querying default meter value...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tawait api.get();\n\t\t} else {\n\t\t\tconst type: number = this.getValue(ctx, MeterCCValues.type)\n\t\t\t\t?? 0;\n\n\t\t\tconst supportedScales: readonly number[] =\n\t\t\t\tthis.getValue(ctx, MeterCCValues.supportedScales) ?? [];\n\n\t\t\tconst supportedRateTypes: readonly RateType[] =\n\t\t\t\tthis.getValue(ctx, MeterCCValues.supportedRateTypes) ?? [];\n\n\t\t\tconst rateTypes = supportedRateTypes.length\n\t\t\t\t? supportedRateTypes\n\t\t\t\t: [undefined];\n\t\t\tfor (const rateType of rateTypes) {\n\t\t\t\tfor (const scale of supportedScales) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\t\tmessage: `querying meter value (type = ${\n\t\t\t\t\t\t\tgetMeterName(type)\n\t\t\t\t\t\t}, scale = ${\n\t\t\t\t\t\t\t(getMeterScale(type, scale)\n\t\t\t\t\t\t\t\t?? getUnknownMeterScale(scale)).label\n\t\t\t\t\t\t}${\n\t\t\t\t\t\t\trateType != undefined\n\t\t\t\t\t\t\t\t? `, rate type = ${\n\t\t\t\t\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\t\t\t\t\tRateType,\n\t\t\t\t\t\t\t\t\t\trateType,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`\n\t\t\t\t\t\t\t\t: \"\"\n\t\t\t\t\t\t})...`,\n\t\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t\t});\n\t\t\t\t\tawait api.get({ scale, rateType });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// Poll the device when all of the supported values were last updated longer than 6 hours ago.\n\t\t// This may lead to some values not being updated, but the user may have disabled some unnecessary\n\t\t// reports to reduce traffic.\n\t\tconst valueDB = ctx.tryGetValueDB(this.nodeId);\n\t\tif (!valueDB) return true;\n\n\t\tconst values = this.getDefinedValueIDs(ctx).filter((v) =>\n\t\t\tMeterCCValues.value.is(v)\n\t\t);\n\t\treturn values.every((v) => {\n\t\t\tconst lastUpdated = valueDB.getTimestamp(v);\n\t\t\treturn (\n\t\t\t\tlastUpdated == undefined\n\t\t\t\t|| Date.now() - lastUpdated > timespan.hours(6)\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Returns which type this meter has.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getMeterTypeCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<number> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(MeterCCValues.type.endpoint(endpoint.index));\n\t}\n\n\t/**\n\t * Returns which scales are supported by this meter.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getSupportedScalesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<number[]> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(MeterCCValues.supportedScales.endpoint(endpoint.index));\n\t}\n\n\t/**\n\t * Returns whether reset is supported by this meter.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static supportsResetCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<boolean> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(MeterCCValues.supportsReset.endpoint(endpoint.index));\n\t}\n\n\t/**\n\t * Returns which rate types are supported by this meter.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getSupportedRateTypesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<RateType[]> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMeterCCValues.supportedRateTypes.endpoint(endpoint.index),\n\t\t\t);\n\t}\n\n\tpublic translatePropertyKey(\n\t\tctx: GetValueDB,\n\t\tproperty: string | number,\n\t\tpropertyKey: string | number,\n\t): string | undefined {\n\t\tif (property === \"value\" && typeof propertyKey === \"number\") {\n\t\t\tconst { meterType, rateType, scale } = splitPropertyKey(\n\t\t\t\tpropertyKey,\n\t\t\t);\n\t\t\tlet ret: string;\n\t\t\tif (meterType !== 0) {\n\t\t\t\tret = `${getMeterName(meterType)}_${\n\t\t\t\t\t(getMeterScale(meterType, scale)\n\t\t\t\t\t\t?? getUnknownMeterScale(scale)).label\n\t\t\t\t}`;\n\t\t\t} else {\n\t\t\t\tret = \"default\";\n\t\t\t}\n\t\t\tif (rateType !== RateType.Unspecified) {\n\t\t\t\tret += \"_\" + getEnumMemberName(RateType, rateType);\n\t\t\t}\n\t\t\treturn ret;\n\t\t} else if (property === \"reset\" && typeof propertyKey === \"number\") {\n\t\t\treturn getMeterName(propertyKey);\n\t\t}\n\t\treturn super.translatePropertyKey(ctx, property, propertyKey);\n\t}\n}\n\n// @publicAPI\nexport interface MeterCCReportOptions {\n\ttype: number;\n\tscale: number;\n\tvalue: number;\n\tpreviousValue?: MaybeNotKnown<number>;\n\trateType?: RateType;\n\tdeltaTime?: MaybeUnknown<number>;\n}\n\n@CCCommand(MeterCommand.Report)\nexport class MeterCCReport extends MeterCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MeterCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.type = options.type;\n\t\tthis.scale = options.scale;\n\t\tthis.value = options.value;\n\t\tthis.previousValue = options.previousValue;\n\t\tthis.rateType = options.rateType ?? RateType.Unspecified;\n\t\tthis.deltaTime = options.deltaTime ?? UNKNOWN_STATE;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): MeterCCReport {\n\t\tconst { type, rateType, scale1, value, bytesRead } =\n\t\t\tparseMeterValueAndInfo(raw.payload, 0);\n\t\tlet offset = bytesRead;\n\t\tconst floatSize = bytesRead - 2;\n\t\tlet deltaTime: MaybeUnknown<number>;\n\t\tlet previousValue: MaybeNotKnown<number>;\n\n\t\tif (raw.payload.length >= offset + 2) {\n\t\t\tdeltaTime = raw.payload.readUInt16BE(offset);\n\t\t\toffset += 2;\n\t\t\tif (deltaTime === 0xffff) {\n\t\t\t\tdeltaTime = UNKNOWN_STATE;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// Previous value is included only if delta time is not 0\n\t\t\t\tdeltaTime !== 0\n\t\t\t\t&& raw.payload.length >= offset + floatSize\n\t\t\t) {\n\t\t\t\tconst { value: prevValue } = parseFloatWithScale(\n\t\t\t\t\t// This float is split in the payload\n\t\t\t\t\tBytes.concat([\n\t\t\t\t\t\tBytes.from([raw.payload[1]]),\n\t\t\t\t\t\traw.payload.subarray(offset),\n\t\t\t\t\t]),\n\t\t\t\t);\n\t\t\t\toffset += floatSize;\n\t\t\t\tpreviousValue = prevValue;\n\t\t\t}\n\t\t} else {\n\t\t\t// 0 means that no previous value is included\n\t\t\tdeltaTime = 0;\n\t\t}\n\t\tconst scale = parseScale(scale1, raw.payload, offset);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttype,\n\t\t\trateType,\n\t\t\tvalue,\n\t\t\tdeltaTime,\n\t\t\tpreviousValue,\n\t\t\tscale,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\n\t\tconst meter = getMeter(this.type);\n\t\tconst scale = getMeterScale(this.type, this.scale)\n\t\t\t?? getUnknownMeterScale(this.scale);\n\n\t\t// Filter out unknown meter types and scales, unless the strict validation is disabled\n\t\tconst measurementValidation = !ctx.getDeviceConfig?.(\n\t\t\tthis.nodeId as number,\n\t\t)?.compat?.disableStrictMeasurementValidation;\n\n\t\tif (measurementValidation) {\n\t\t\tvalidatePayload.withReason(\n\t\t\t\t`Unknown meter type ${num2hex(this.type)} or corrupted data`,\n\t\t\t)(!!meter);\n\t\t\tvalidatePayload.withReason(\n\t\t\t\t`Unknown meter scale ${num2hex(this.scale)} or corrupted data`,\n\t\t\t)(scale.label !== getUnknownMeterScale(this.scale).label);\n\n\t\t\t// Filter out unsupported meter types, scales and rate types if possible\n\t\t\tif (ccVersion >= 2) {\n\t\t\t\tconst expectedType = this.getValue<number>(\n\t\t\t\t\tctx,\n\t\t\t\t\tMeterCCValues.type,\n\t\t\t\t);\n\t\t\t\tif (expectedType != undefined) {\n\t\t\t\t\tvalidatePayload.withReason(\n\t\t\t\t\t\t\"Unexpected meter type or corrupted data\",\n\t\t\t\t\t)(this.type === expectedType);\n\t\t\t\t}\n\n\t\t\t\tconst supportedScales = this.getValue<number[]>(\n\t\t\t\t\tctx,\n\t\t\t\t\tMeterCCValues.supportedScales,\n\t\t\t\t);\n\t\t\t\tif (supportedScales?.length) {\n\t\t\t\t\tvalidatePayload.withReason(\n\t\t\t\t\t\t`Unsupported meter scale ${scale.label} or corrupted data`,\n\t\t\t\t\t)(supportedScales.includes(this.scale));\n\t\t\t\t}\n\n\t\t\t\tconst supportedRateTypes = this.getValue<RateType[]>(\n\t\t\t\t\tctx,\n\t\t\t\t\tMeterCCValues.supportedRateTypes,\n\t\t\t\t);\n\t\t\t\tif (supportedRateTypes?.length) {\n\t\t\t\t\tvalidatePayload.withReason(\n\t\t\t\t\t\t`Unsupported rate type ${\n\t\t\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\t\t\tRateType,\n\t\t\t\t\t\t\t\tthis.rateType,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} or corrupted data`,\n\t\t\t\t\t)(supportedRateTypes.includes(this.rateType));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst valueValue = MeterCCValues.value(\n\t\t\tthis.type,\n\t\t\tthis.rateType,\n\t\t\tthis.scale,\n\t\t);\n\t\tthis.setMetadata(ctx, valueValue, {\n\t\t\t...valueValue.meta,\n\t\t\tlabel: getValueLabel(this.type, this.scale, this.rateType),\n\t\t\tunit: scale.unit,\n\t\t\tccSpecific: {\n\t\t\t\tmeterType: this.type,\n\t\t\t\tscale: this.scale,\n\t\t\t\trateType: this.rateType,\n\t\t\t},\n\t\t});\n\t\tthis.setValue(ctx, valueValue, this.value);\n\n\t\treturn true;\n\t}\n\n\tpublic type: number;\n\tpublic scale: number;\n\tpublic value: number;\n\tpublic previousValue: MaybeNotKnown<number>;\n\tpublic rateType: RateType;\n\tpublic deltaTime: MaybeUnknown<number>;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst { data: typeAndValue, floatParams, scale2 } =\n\t\t\tencodeMeterValueAndInfo(\n\t\t\t\tthis.type,\n\t\t\t\tthis.rateType,\n\t\t\t\tthis.scale,\n\t\t\t\tthis.value,\n\t\t\t);\n\n\t\tconst deltaTime = this.deltaTime ?? 0xffff;\n\t\tconst deltaTimeBytes = new Bytes(2);\n\t\tdeltaTimeBytes.writeUInt16BE(deltaTime, 0);\n\n\t\tthis.payload = Bytes.concat([\n\t\t\ttypeAndValue,\n\t\t\tdeltaTimeBytes,\n\t\t]);\n\n\t\tif (this.deltaTime !== 0 && this.previousValue != undefined) {\n\t\t\t// Encode the float, but only keep the value bytes\n\t\t\tconst prevValueBytes = encodeFloatWithScale(\n\t\t\t\tthis.previousValue,\n\t\t\t\t0, // we discard the scale anyways\n\t\t\t\tfloatParams,\n\t\t\t).subarray(1);\n\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tprevValueBytes,\n\t\t\t]);\n\t\t}\n\n\t\tif (scale2 != undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([scale2]),\n\t\t\t]);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst scale = getMeterScale(this.type, this.scale)\n\t\t\t?? getUnknownMeterScale(this.scale);\n\n\t\tconst message: MessageRecord = {\n\t\t\t\"meter type\": getMeterName(this.type),\n\t\t\tscale: scale.label,\n\t\t\t\"rate type\": getEnumMemberName(RateType, this.rateType),\n\t\t\tvalue: this.value,\n\t\t};\n\t\tif (this.deltaTime !== UNKNOWN_STATE) {\n\t\t\tmessage[\"time delta\"] = `${this.deltaTime} seconds`;\n\t\t}\n\t\tif (this.previousValue != undefined) {\n\t\t\tmessage[\"prev. value\"] = this.previousValue;\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\nfunction testResponseForMeterGet(sent: MeterCCGet, received: MeterCCReport) {\n\t// We expect a Meter Report that matches the requested scale and rate type\n\t// (if they were requested)\n\treturn (\n\t\t(sent.scale == undefined || sent.scale === received.scale)\n\t\t&& (sent.rateType == undefined || sent.rateType == received.rateType)\n\t);\n}\n\n// @publicAPI\nexport interface MeterCCGetOptions {\n\tscale?: number;\n\trateType?: RateType;\n}\n\n@CCCommand(MeterCommand.Get)\n@expectedCCResponse(MeterCCReport, testResponseForMeterGet)\nexport class MeterCCGet extends MeterCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MeterCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.rateType = options.rateType;\n\t\tthis.scale = options.scale;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): MeterCCGet {\n\t\tlet rateType: RateType | undefined;\n\t\tlet scale: number | undefined;\n\n\t\tif (raw.payload.length >= 1) {\n\t\t\trateType = (raw.payload[0] & 0b11_000_000) >>> 6;\n\t\t\tscale = (raw.payload[0] & 0b00_111_000) >>> 3;\n\t\t\tif (scale === 7) {\n\t\t\t\tvalidatePayload(raw.payload.length >= 2);\n\t\t\t\tscale += raw.payload[1];\n\t\t\t}\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\trateType,\n\t\t\tscale,\n\t\t});\n\t}\n\n\tpublic rateType: RateType | undefined;\n\tpublic scale: number | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tlet scale1: number;\n\t\tlet scale2: number | undefined;\n\t\tlet bufferLength = 0;\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (this.scale == undefined) {\n\t\t\tscale1 = 0;\n\t\t} else if (ccVersion >= 4 && this.scale >= 7) {\n\t\t\tscale1 = 7;\n\t\t\tscale2 = this.scale >>> 3;\n\t\t\tbufferLength = 2;\n\t\t} else if (ccVersion >= 3) {\n\t\t\tscale1 = this.scale & 0b111;\n\t\t\tbufferLength = 1;\n\t\t} else if (ccVersion >= 2) {\n\t\t\tscale1 = this.scale & 0b11;\n\t\t\tbufferLength = 1;\n\t\t} else {\n\t\t\tscale1 = 0;\n\t\t}\n\n\t\tlet rateTypeFlags = 0;\n\t\tif (ccVersion >= 4 && this.rateType != undefined) {\n\t\t\trateTypeFlags = this.rateType & 0b11;\n\t\t\tbufferLength = Math.max(bufferLength, 1);\n\t\t}\n\n\t\tthis.payload = Bytes.alloc(bufferLength, 0);\n\t\tthis.payload[0] = (rateTypeFlags << 6) | (scale1 << 3);\n\t\tif (scale2) this.payload[1] = scale2;\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {};\n\t\tif (this.rateType != undefined) {\n\t\t\tmessage[\"rate type\"] = getEnumMemberName(RateType, this.rateType);\n\t\t}\n\t\tif (this.scale != undefined) {\n\t\t\tif (ctx) {\n\t\t\t\t// Try to lookup the meter type to translate the scale\n\t\t\t\tconst type = this.getValue<number>(ctx, MeterCCValues.type);\n\t\t\t\tif (type != undefined) {\n\t\t\t\t\tmessage.scale = (getMeterScale(type, this.scale)\n\t\t\t\t\t\t?? getUnknownMeterScale(this.scale)).label;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmessage.scale = this.scale;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MeterCCSupportedReportOptions {\n\ttype: number;\n\tsupportsReset: boolean;\n\tsupportedScales: readonly number[];\n\tsupportedRateTypes: readonly RateType[];\n}\n\n@CCCommand(MeterCommand.SupportedReport)\n@ccValueProperty(\"type\", MeterCCValues.type)\n@ccValueProperty(\"supportsReset\", MeterCCValues.supportsReset)\n@ccValueProperty(\"supportedScales\", MeterCCValues.supportedScales)\n@ccValueProperty(\"supportedRateTypes\", MeterCCValues.supportedRateTypes)\nexport class MeterCCSupportedReport extends MeterCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MeterCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.type = options.type;\n\t\tthis.supportsReset = options.supportsReset;\n\t\tthis.supportedScales = options.supportedScales;\n\t\tthis.supportedRateTypes = options.supportedRateTypes;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MeterCCSupportedReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst type = raw.payload[0] & 0b0_00_11111;\n\t\tconst supportsReset = !!(raw.payload[0] & 0b1_00_00000);\n\t\tconst hasMoreScales = !!(raw.payload[1] & 0b1_0000000);\n\n\t\tlet supportedScales: number[] | undefined;\n\t\tif (hasMoreScales) {\n\t\t\t// The bitmask is spread out\n\t\t\tvalidatePayload(raw.payload.length >= 3);\n\t\t\tconst extraBytes = raw.payload[2];\n\t\t\tvalidatePayload(raw.payload.length >= 3 + extraBytes);\n\t\t\t// The bitmask is the original payload byte plus all following bytes\n\t\t\t// Since the first byte only has 7 bits, we need to reduce all following bits by 1\n\t\t\tsupportedScales = parseBitMask(\n\t\t\t\tBytes.concat([\n\t\t\t\t\tBytes.from([raw.payload[1] & 0b0_1111111]),\n\t\t\t\t\traw.payload.subarray(3, 3 + extraBytes),\n\t\t\t\t]),\n\t\t\t\t0,\n\t\t\t).map((scale) => (scale >= 8 ? scale - 1 : scale));\n\t\t} else {\n\t\t\t// only 7 bits in the bitmask. Bit 7 is 0, so no need to mask it out\n\t\t\tsupportedScales = parseBitMask(\n\t\t\t\tBytes.from([raw.payload[1]]),\n\t\t\t\t0,\n\t\t\t);\n\t\t}\n\t\t// This is only present in V4+\n\t\tconst supportedRateTypes: RateType[] = parseBitMask(\n\t\t\tBytes.from([(raw.payload[0] & 0b0_11_00000) >>> 5]),\n\t\t\t1,\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttype,\n\t\t\tsupportsReset,\n\t\t\tsupportedScales,\n\t\t\tsupportedRateTypes,\n\t\t});\n\t}\n\n\tpublic readonly type: number;\n\n\tpublic readonly supportsReset: boolean;\n\n\tpublic readonly supportedScales: readonly number[];\n\n\tpublic readonly supportedRateTypes: readonly RateType[];\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\t\tif (!this.supportsReset) return true;\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\n\t\t// Create reset values\n\t\tif (ccVersion < 6) {\n\t\t\tthis.ensureMetadata(ctx, MeterCCValues.resetAll);\n\t\t} else {\n\t\t\tfor (const scale of this.supportedScales) {\n\t\t\t\t// Only accumulated values can be reset\n\t\t\t\tif (!isAccumulatedValue(this.type, scale)) continue;\n\n\t\t\t\tfor (const rateType of this.supportedRateTypes) {\n\t\t\t\t\tconst resetSingleValue = MeterCCValues.resetSingle(\n\t\t\t\t\t\tthis.type,\n\t\t\t\t\t\trateType,\n\t\t\t\t\t\tscale,\n\t\t\t\t\t);\n\t\t\t\t\tthis.ensureMetadata(ctx, resetSingleValue, {\n\t\t\t\t\t\t...resetSingleValue.meta,\n\t\t\t\t\t\tlabel: `Reset ${\n\t\t\t\t\t\t\tgetValueLabel(\n\t\t\t\t\t\t\t\tthis.type,\n\t\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t\t\trateType,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst typeByte = (this.type & 0b0_00_11111)\n\t\t\t| (this.supportedRateTypes.includes(RateType.Consumed)\n\t\t\t\t? 0b0_01_00000\n\t\t\t\t: 0)\n\t\t\t| (this.supportedRateTypes.includes(RateType.Produced)\n\t\t\t\t? 0b0_10_00000\n\t\t\t\t: 0)\n\t\t\t| (this.supportsReset ? 0b1_00_00000 : 0);\n\t\tconst supportedScales = encodeBitMask(\n\t\t\tthis.supportedScales,\n\t\t\tundefined,\n\t\t\t// The first byte only has 7 bits for the bitmask,\n\t\t\t// so we add a fake bit for the value -1 and later shift\n\t\t\t// the first byte one to the right\n\t\t\t-1,\n\t\t);\n\t\tconst scalesByte1 = (supportedScales[0] >>> 1)\n\t\t\t| (supportedScales.length > 1 ? 0b1000_0000 : 0);\n\n\t\tthis.payload = Bytes.from([\n\t\t\ttypeByte,\n\t\t\tscalesByte1,\n\t\t]);\n\t\tif (supportedScales.length > 1) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([supportedScales.length - 1]),\n\t\t\t\tBytes.from(supportedScales.subarray(1)),\n\t\t\t]);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"meter type\": getMeterName(this.type),\n\t\t\t\"supports reset\": this.supportsReset,\n\t\t\t\"supported scales\": `${\n\t\t\t\tthis.supportedScales\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(scale) => `\n\u00B7 ${(getMeterScale(this.type, scale) ?? getUnknownMeterScale(scale)).label}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\")\n\t\t\t}`,\n\t\t\t\"supported rate types\": this.supportedRateTypes\n\t\t\t\t.map((rt) => getEnumMemberName(RateType, rt))\n\t\t\t\t.join(\", \"),\n\t\t};\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(MeterCommand.SupportedGet)\n@expectedCCResponse(MeterCCSupportedReport)\nexport class MeterCCSupportedGet extends MeterCC {}\n\n// @publicAPI\nexport type MeterCCResetOptions = AllOrNone<{\n\ttype: number;\n\tscale: number;\n\trateType: RateType;\n\ttargetValue: number;\n}>;\n\n@CCCommand(MeterCommand.Reset)\n@useSupervision()\nexport class MeterCCReset extends MeterCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MeterCCResetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.type = options.type;\n\t\tthis.scale = options.scale;\n\t\tthis.rateType = options.rateType;\n\t\tthis.targetValue = options.targetValue;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): MeterCCReset {\n\t\tif (raw.payload.length === 0) {\n\t\t\treturn new this({\n\t\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t});\n\t\t}\n\n\t\tconst {\n\t\t\ttype,\n\t\t\trateType,\n\t\t\tscale1,\n\t\t\tvalue: targetValue,\n\t\t\tbytesRead: scale2Offset,\n\t\t} = parseMeterValueAndInfo(raw.payload, 0);\n\t\tconst scale = parseScale(scale1, raw.payload, scale2Offset);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttype,\n\t\t\trateType,\n\t\t\ttargetValue,\n\t\t\tscale,\n\t\t});\n\t}\n\n\tpublic type: number | undefined;\n\tpublic scale: number | undefined;\n\tpublic rateType: RateType | undefined;\n\tpublic targetValue: number | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tif (\n\t\t\tthis.type != undefined\n\t\t\t&& this.scale != undefined\n\t\t\t&& this.rateType != undefined\n\t\t\t&& this.targetValue != undefined\n\t\t) {\n\t\t\tconst { data: typeAndValue, scale2 } = encodeMeterValueAndInfo(\n\t\t\t\tthis.type,\n\t\t\t\tthis.rateType,\n\t\t\t\tthis.scale,\n\t\t\t\tthis.targetValue,\n\t\t\t);\n\n\t\t\tthis.payload = typeAndValue;\n\n\t\t\tif (scale2 != undefined) {\n\t\t\t\tthis.payload = Bytes.concat([\n\t\t\t\t\tthis.payload,\n\t\t\t\t\tBytes.from([scale2]),\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {};\n\t\tif (this.type != undefined) {\n\t\t\tmessage.type = getMeterName(this.type);\n\t\t}\n\t\tif (this.rateType != undefined) {\n\t\t\tmessage[\"rate type\"] = getEnumMemberName(RateType, this.rateType);\n\t\t}\n\t\tif (this.type != undefined && this.scale != undefined) {\n\t\t\tmessage.scale = (getMeterScale(this.type, this.scale)\n\t\t\t\t?? getUnknownMeterScale(this.scale)).label;\n\t\t}\n\t\tif (this.targetValue != undefined) {\n\t\t\tmessage[\"target value\"] = this.targetValue;\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kBAgCO;AACP,oBAMO;AAEP,iBAaO;AACP,0BAAwC;AACxC,0BAOO;AACP,oCAUO;AACP,oBAAkB;AAClB,mBAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiE1D,SAAS,iBAAiB,KAAW;AAKpC,SAAO;IACN,UAAU,MAAM;IAChB,OAAQ,QAAQ,IAAK;IACrB,WAAW,QAAQ;;AAErB;AAVS;AAYT,SAAS,cACR,WACA,OACA,UACA,QAAe;AAEf,MAAI,UAAM,0BAAa,SAAS;AAChC,QAAM,kBACJ,2BAAc,WAAW,KAAK,SAAK,kCAAqB,KAAK,GAAG;AAClE,UAAQ,UAAU;IACjB,KAAK,sBAAS;AACb,aAAO,iBAAiB,UAAU;AAClC;IACD,KAAK,sBAAS;AACb,aAAO,gBAAgB,UAAU;AACjC;IACD;AACC,aAAO,KAAK,UAAU;EACxB;AACA,MAAI,QAAQ;AACX,WAAO,KAAK,MAAM;EACnB;AACA,SAAO;AACR;AAvBS;AAyBT,SAAS,uBAAuB,MAAkB,QAAc;AAO/D,mCAAgB,KAAK,UAAU,SAAS,CAAC;AAEzC,QAAM,OAAO,KAAK,MAAM,IAAI;AAC5B,QAAM,YAAY,KAAK,MAAM,IAAI,QAAkB;AACnD,QAAM,cAAc,KAAK,MAAM,IAAI,SAAkB;AAErD,QAAM,EACL,OAAO,cACP,OACA,UAAS,QACN,iCAAoB,KAAK,SAAS,SAAS,CAAC,CAAC;AAEjD,SAAO;IACN;IACA;;IAEA,QAAS,cAAc,IAAK;IAC5B;;IAEA,WAAW,YAAY;;AAEzB;AA5BS;AA8BT,SA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KAAK,IAAI;MACtC;AACA,UAAI,KAAK,YAAY,QAAW;AAC/B,gBAAQ,WAAW,QAAI,iCAAkB,uBAAU,KAAK,QAAQ;MACjE;AACA,UAAI,KAAK,QAAQ,UAAa,KAAK,SAAS,QAAW;AACtD,gBAAQ,aAAS,2BAAc,KAAK,MAAM,KAAK,KAAK,SAChD,kCAAqB,KAAK,KAAK,GAAG;MACvC;AACA,UAAI,KAAK,eAAe,QAAW;AAClC,gBAAQ,cAAc,IAAI,KAAK;MAChC;AACA,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB;;IAEF;;;;",
4
+ "sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype EndpointId,\n\ttype FloatParameters,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MaybeUnknown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype NodeId,\n\ttype SinglecastCC,\n\ttype SupervisionResult,\n\ttype SupportsCC,\n\tUNKNOWN_STATE,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeBitMask,\n\tencodeFloatWithScale,\n\tgetFloatParameters,\n\tgetMeter,\n\tgetMeterName,\n\tgetMeterScale,\n\tgetUnknownMeterScale,\n\tparseBitMask,\n\tparseFloatWithScale,\n\ttimespan,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport {\n\ttype AllOrNone,\n\tBytes,\n\ttype BytesView,\n\tgetEnumMemberName,\n\tnum2hex,\n\tpick,\n} from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\tPhysicalCCAPI,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\tSET_VALUE_HOOKS,\n\ttype SetValueImplementation,\n\ttype SetValueImplementationHooksFactory,\n\tthrowMissingPropertyKey,\n\tthrowUnsupportedProperty,\n\tthrowUnsupportedPropertyKey,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport { meterTypesToPropertyKey } from \"../lib/CCValueUtils.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\tgetCommandClass,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { MeterCommand, type MeterReading, RateType } from \"../lib/_Types.js\";\n\nexport const MeterCCValues = V.defineCCValues(CommandClasses.Meter, {\n\t...V.staticProperty(\"type\", undefined, { internal: true }),\n\t...V.staticProperty(\"supportsReset\", undefined, { internal: true }),\n\t...V.staticProperty(\"supportedScales\", undefined, { internal: true }),\n\t...V.staticProperty(\"supportedRateTypes\", undefined, {\n\t\tinternal: true,\n\t}),\n\t...V.staticPropertyWithName(\n\t\t\"resetAll\",\n\t\t\"reset\",\n\t\t{\n\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\tlabel: `Reset accumulated values`,\n\t\t\tstates: {\n\t\t\t\ttrue: \"Reset\",\n\t\t\t},\n\t\t} as const,\n\t),\n\t...V.dynamicPropertyAndKeyWithName(\n\t\t\"resetSingle\",\n\t\t\"reset\",\n\t\tmeterTypesToPropertyKey,\n\t\t({ property, propertyKey }) =>\n\t\t\tproperty === \"reset\" && typeof propertyKey === \"number\",\n\t\t(meterType: number, rateType: RateType, scale: number) => ({\n\t\t\t...ValueMetadata.WriteOnlyBoolean,\n\t\t\t// This is only a placeholder label. A config manager is needed to\n\t\t\t// determine the actual label.\n\t\t\tlabel: `Reset (${\n\t\t\t\trateType === RateType.Consumed\n\t\t\t\t\t? \"Consumption, \"\n\t\t\t\t\t: rateType === RateType.Produced\n\t\t\t\t\t? \"Production, \"\n\t\t\t\t\t: \"\"\n\t\t\t}${num2hex(scale)})`,\n\t\t\tstates: {\n\t\t\t\ttrue: \"Reset\",\n\t\t\t},\n\t\t\tccSpecific: {\n\t\t\t\tmeterType,\n\t\t\t\trateType,\n\t\t\t\tscale,\n\t\t\t},\n\t\t} as const),\n\t),\n\t...V.dynamicPropertyAndKeyWithName(\n\t\t\"value\",\n\t\t\"value\",\n\t\tmeterTypesToPropertyKey,\n\t\t({ property, propertyKey }) =>\n\t\t\tproperty === \"value\" && typeof propertyKey === \"number\",\n\t\t(meterType: number, rateType: RateType, scale: number) => ({\n\t\t\t...ValueMetadata.ReadOnlyNumber,\n\t\t\t// Label and unit can only be determined with a config manager\n\t\t\tccSpecific: {\n\t\t\t\tmeterType,\n\t\t\t\trateType,\n\t\t\t\tscale,\n\t\t\t},\n\t\t} as const),\n\t),\n});\n\nfunction splitPropertyKey(key: number): {\n\tmeterType: number;\n\trateType: RateType;\n\tscale: number;\n} {\n\treturn {\n\t\trateType: key & 0xff,\n\t\tscale: (key >>> 8) & 0xff,\n\t\tmeterType: key >>> 16,\n\t};\n}\n\nfunction getValueLabel(\n\tmeterType: number,\n\tscale: number,\n\trateType: RateType,\n\tsuffix?: string,\n): string {\n\tlet ret = getMeterName(meterType);\n\tconst scaleLabel =\n\t\t(getMeterScale(meterType, scale) ?? getUnknownMeterScale(scale)).label;\n\tswitch (rateType) {\n\t\tcase RateType.Consumed:\n\t\t\tret += ` Consumption [${scaleLabel}]`;\n\t\t\tbreak;\n\t\tcase RateType.Produced:\n\t\t\tret += ` Production [${scaleLabel}]`;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tret += ` [${scaleLabel}]`;\n\t}\n\tif (suffix) {\n\t\tret += ` (${suffix})`;\n\t}\n\treturn ret;\n}\n\nfunction parseMeterValueAndInfo(data: BytesView, offset: number): {\n\ttype: number;\n\trateType: RateType;\n\tscale1: number;\n\tvalue: number;\n\tbytesRead: number;\n} {\n\tvalidatePayload(data.length >= offset + 1);\n\n\tconst type = data[offset] & 0b0_00_11111;\n\tconst rateType = (data[offset] & 0b0_11_00000) >>> 5;\n\tconst scale1Bit2 = (data[offset] & 0b1_00_00000) >>> 7;\n\n\tconst {\n\t\tscale: scale1Bits10,\n\t\tvalue,\n\t\tbytesRead,\n\t} = parseFloatWithScale(data.subarray(offset + 1));\n\n\treturn {\n\t\ttype,\n\t\trateType,\n\t\t// The scale is composed of two fields\n\t\tscale1: (scale1Bit2 << 2) | scale1Bits10,\n\t\tvalue,\n\t\t// We've read one byte more than the float contains\n\t\tbytesRead: bytesRead + 1,\n\t};\n}\n\nfunction encodeMeterValueAndInfo(\n\ttype: number,\n\trateType: RateType,\n\tscale: number,\n\tvalue: number,\n): { data: Bytes; floatParams: FloatParameters; scale2: number | undefined } {\n\t// We need at least 2 bytes\n\n\tconst scale1 = scale >= 7 ? 7 : scale & 0b111;\n\tconst scale1Bits10 = scale1 & 0b11;\n\tconst scale1Bit2 = scale1 >>> 2;\n\tconst scale2 = scale >= 7 ? scale - 7 : undefined;\n\n\tconst typeByte = (type & 0b0_00_11111)\n\t\t| ((rateType & 0b11) << 5)\n\t\t| (scale1Bit2 << 7);\n\n\tconst floatParams = getFloatParameters(value);\n\tconst valueBytes = encodeFloatWithScale(\n\t\tvalue,\n\t\tscale1Bits10,\n\t\tfloatParams,\n\t);\n\n\treturn {\n\t\tdata: Bytes.concat([Bytes.from([typeByte]), valueBytes]),\n\t\tfloatParams: pick(floatParams, [\"precision\", \"size\"]),\n\t\tscale2,\n\t};\n}\n\nfunction parseScale(\n\tscale1: number,\n\tdata: BytesView,\n\tscale2Offset: number,\n): number {\n\tif (scale1 === 7) {\n\t\tvalidatePayload(data.length >= scale2Offset + 1);\n\t\tconst scale2 = data[scale2Offset];\n\t\treturn scale1 + scale2;\n\t} else {\n\t\treturn scale1;\n\t}\n}\n\nexport function isAccumulatedValue(\n\tmeterType: number,\n\tscale: number,\n): boolean {\n\t// FIXME: We should probably move the meter definitions into code\n\tswitch (meterType) {\n\t\tcase 0x01: // Electric\n\t\t\treturn (\n\t\t\t\t// kVarh\n\t\t\t\t// Pulse count\n\t\t\t\tscale === 0x00 // kWh\n\t\t\t\t|| scale === 0x01 // kVAh\n\t\t\t\t|| scale === 0x03\n\t\t\t\t|| scale === 0x08\n\t\t\t);\n\t\tcase 0x02: // Gas\n\t\t\treturn (\n\t\t\t\t// Pulse count\n\t\t\t\t// ft\u00B3\n\t\t\t\tscale === 0x00 // m\u00B3\n\t\t\t\t|| scale === 0x01\n\t\t\t\t|| scale === 0x03\n\t\t\t);\n\t\tcase 0x03: // Water\n\t\t\treturn (\n\t\t\t\t// Pulse count\n\t\t\t\t// US gallons\n\t\t\t\tscale === 0x00 // m\u00B3\n\t\t\t\t|| scale === 0x01 // ft\u00B3\n\t\t\t\t|| scale === 0x02\n\t\t\t\t|| scale === 0x03\n\t\t\t);\n\t\tcase 0x04: // Heating\n\t\t\treturn scale === 0x00; // kWh\n\t\tcase 0x05: // Cooling\n\t\t\treturn scale === 0x00; // kWh\n\t}\n\treturn false;\n}\n\n@API(CommandClasses.Meter)\nexport class MeterCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: MeterCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase MeterCommand.Get:\n\t\t\tcase MeterCommand.Report:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase MeterCommand.SupportedGet:\n\t\t\tcase MeterCommand.SupportedReport:\n\t\t\t\treturn this.version >= 2;\n\t\t\tcase MeterCommand.Reset: {\n\t\t\t\tconst ret = this.tryGetValueDB()?.getValue<boolean>({\n\t\t\t\t\tcommandClass: getCommandClass(this),\n\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\tproperty: \"supportsReset\",\n\t\t\t\t});\n\t\t\t\treturn ret === true;\n\t\t\t}\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: MeterCCAPI, { property, propertyKey }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"value\":\n\t\t\t\tcase \"previousValue\":\n\t\t\t\tcase \"deltaTime\": {\n\t\t\t\t\tif (propertyKey == undefined) {\n\t\t\t\t\t\tthrowMissingPropertyKey(this.ccId, property);\n\t\t\t\t\t} else if (typeof propertyKey !== \"number\") {\n\t\t\t\t\t\tthrowUnsupportedPropertyKey(\n\t\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { rateType, scale } = splitPropertyKey(propertyKey);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tawait this.get({\n\t\t\t\t\t\t\trateType,\n\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t})\n\t\t\t\t\t)?.[property];\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n\n\t@validateArgs()\n\tpublic async get(\n\t\toptions?: MeterCCGetOptions,\n\t): Promise<MeterReading | undefined> {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.Get);\n\n\t\tconst cc = new MeterCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\tconst response = await this.host.sendCommand<MeterCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\ttype: response.type,\n\t\t\t\tscale: getMeterScale(response.type, response.scale)\n\t\t\t\t\t?? getUnknownMeterScale(response.scale),\n\t\t\t\t...pick(response, [\n\t\t\t\t\t\"value\",\n\t\t\t\t\t\"previousValue\",\n\t\t\t\t\t\"rateType\",\n\t\t\t\t\t\"deltaTime\",\n\t\t\t\t]),\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\toptions: MeterCCReportOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.Report);\n\n\t\tconst cc = new MeterCCReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\tpublic async getAll(\n\t\taccumulatedOnly: boolean = false,\n\t): Promise<MeterReading[]> {\n\t\tconst valueDB = this.tryGetValueDB();\n\n\t\tif (this.version >= 2) {\n\t\t\tconst meterType = valueDB?.getValue<number>(\n\t\t\t\tMeterCCValues.type.endpoint(this.endpoint.index),\n\t\t\t);\n\t\t\tconst supportedScales = valueDB?.getValue<number[]>(\n\t\t\t\tMeterCCValues.supportedScales.endpoint(this.endpoint.index),\n\t\t\t) ?? [];\n\t\t\tconst supportedRateTypes = valueDB?.getValue<RateType[]>(\n\t\t\t\tMeterCCValues.supportedRateTypes.endpoint(\n\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\n\t\t\tconst rateTypes = supportedRateTypes.length\n\t\t\t\t? supportedRateTypes\n\t\t\t\t: [undefined];\n\n\t\t\tconst ret = [];\n\t\t\tfor (const rateType of rateTypes) {\n\t\t\t\tfor (const scale of supportedScales) {\n\t\t\t\t\t// Skip non-accumulated values if requested\n\t\t\t\t\tif (\n\t\t\t\t\t\taccumulatedOnly\n\t\t\t\t\t\t&& meterType != undefined\n\t\t\t\t\t\t&& !isAccumulatedValue(meterType, scale)\n\t\t\t\t\t) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst response = await this.get({\n\t\t\t\t\t\tscale,\n\t\t\t\t\t\trateType,\n\t\t\t\t\t});\n\t\t\t\t\tif (response) ret.push(response);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ret;\n\t\t} else {\n\t\t\tconst response = await this.get();\n\t\t\treturn response ? [response] : [];\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getSupported() {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.SupportedGet);\n\n\t\tconst cc = new MeterCCSupportedGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMeterCCSupportedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\n\t\t\t\t\"type\",\n\t\t\t\t\"supportsReset\",\n\t\t\t\t\"supportedScales\",\n\t\t\t\t\"supportedRateTypes\",\n\t\t\t]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendSupportedReport(\n\t\toptions: MeterCCSupportedReportOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.SupportedReport);\n\n\t\tconst cc = new MeterCCSupportedReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\tpublic async reset(\n\t\toptions?: MeterCCResetOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(MeterCommand, MeterCommand.Reset);\n\n\t\tconst cc = new MeterCCReset({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\tprotected override get [SET_VALUE](): SetValueImplementation {\n\t\treturn async function(\n\t\t\tthis: MeterCCAPI,\n\t\t\t{ property, propertyKey },\n\t\t\tvalue,\n\t\t) {\n\t\t\tif (property !== \"reset\") {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t} else if (\n\t\t\t\tpropertyKey != undefined\n\t\t\t\t&& typeof propertyKey !== \"number\"\n\t\t\t) {\n\t\t\t\tthrowUnsupportedPropertyKey(this.ccId, property, propertyKey);\n\t\t\t} else if (value !== true) {\n\t\t\t\tthrowWrongValueType(\n\t\t\t\t\tthis.ccId,\n\t\t\t\t\tproperty,\n\t\t\t\t\t\"true\",\n\t\t\t\t\tvalue === false ? \"false\" : typeof value,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof propertyKey === \"number\") {\n\t\t\t\tconst { meterType, scale, rateType } = splitPropertyKey(\n\t\t\t\t\tpropertyKey,\n\t\t\t\t);\n\t\t\t\treturn this.reset({\n\t\t\t\t\ttype: meterType,\n\t\t\t\t\tscale,\n\t\t\t\t\trateType,\n\t\t\t\t\ttargetValue: 0,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn this.reset();\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t};\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory = (\n\t\t{ property, propertyKey },\n\t\t_value,\n\t\t_options,\n\t) => {\n\t\tif (property !== \"reset\") return;\n\n\t\tif (typeof propertyKey === \"number\") {\n\t\t\t// Reset single\n\t\t\tconst { meterType, rateType, scale } = splitPropertyKey(\n\t\t\t\tpropertyKey,\n\t\t\t);\n\t\t\tconst readingValueId = MeterCCValues.value(\n\t\t\t\tmeterType,\n\t\t\t\trateType,\n\t\t\t\tscale,\n\t\t\t).endpoint(this.endpoint.index);\n\n\t\t\treturn {\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\tsupervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\tif (!supervisedAndSuccessful) return;\n\n\t\t\t\t\t// After resetting a single reading with supervision, store zero\n\t\t\t\t\t// in the corresponding value\n\t\t\t\t\tconst valueDB = this.tryGetValueDB();\n\t\t\t\t\tif (!valueDB) return;\n\n\t\t\t\t\tif (isAccumulatedValue(meterType, scale)) {\n\t\t\t\t\t\tvalueDB.setValue({\n\t\t\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t\t}, 0);\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\tthis.schedulePoll(\n\t\t\t\t\t\treadingValueId,\n\t\t\t\t\t\t0,\n\t\t\t\t\t\t{ transition: \"fast\" },\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else {\n\t\t\t// Reset all\n\t\t\tconst valueDB = this.tryGetValueDB();\n\t\t\tif (!valueDB) return;\n\n\t\t\tconst accumulatedValues = valueDB.findValues((vid) =>\n\t\t\t\tvid.commandClass === this.ccId\n\t\t\t\t&& vid.endpoint === this.endpoint.index\n\t\t\t\t&& MeterCCValues.value.is(vid)\n\t\t\t).filter(({ propertyKey }) => {\n\t\t\t\tif (typeof propertyKey !== \"number\") return false;\n\t\t\t\tconst { meterType, scale } = splitPropertyKey(propertyKey);\n\t\t\t\treturn isAccumulatedValue(meterType, scale);\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\toptimisticallyUpdateRelatedValues: (\n\t\t\t\t\tsupervisedAndSuccessful,\n\t\t\t\t) => {\n\t\t\t\t\tif (!supervisedAndSuccessful) return;\n\n\t\t\t\t\t// After setting the reset all value with supervision,\n\t\t\t\t\t// reset all accumulated values, since we know they are now zero.\n\t\t\t\t\tfor (const value of accumulatedValues) {\n\t\t\t\t\t\tvalueDB.setValue(value, 0);\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tverifyChanges: () => {\n\t\t\t\t\t// Poll all accumulated values, unless they were updated by the device\n\t\t\t\t\tfor (const valueID of accumulatedValues) {\n\t\t\t\t\t\tthis.schedulePoll(\n\t\t\t\t\t\t\tvalueID,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t{ transition: \"fast\" },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t};\n}\n\n@commandClass(CommandClasses.Meter)\n@implementedVersion(6)\n@ccValues(MeterCCValues)\nexport class MeterCC extends CommandClass {\n\tdeclare ccCommand: MeterCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses.Meter,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tif (api.version >= 2) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying meter support...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\n\t\t\tconst suppResp = await api.getSupported();\n\t\t\tif (suppResp) {\n\t\t\t\tconst logMessage = `received meter support:\ntype: ${getMeterName(suppResp.type)}\nsupported scales: ${\n\t\t\t\t\tsuppResp.supportedScales\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(s) =>\n\t\t\t\t\t\t\t\t(getMeterScale(suppResp.type, s)\n\t\t\t\t\t\t\t\t\t?? getUnknownMeterScale(s)).label,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map((label) => `\\n\u00B7 ${label}`)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}\nsupported rate types: ${\n\t\t\t\t\tsuppResp.supportedRateTypes\n\t\t\t\t\t\t.map((rt) => getEnumMemberName(RateType, rt))\n\t\t\t\t\t\t.map((label) => `\\n\u00B7 ${label}`)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}\nsupports reset: ${suppResp.supportsReset}`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Querying meter support timed out, skipping interview...\",\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Query current meter values\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses.Meter,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tif (api.version === 1) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `querying default meter value...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tawait api.get();\n\t\t} else {\n\t\t\tconst type: number = this.getValue(ctx, MeterCCValues.type)\n\t\t\t\t?? 0;\n\n\t\t\tconst supportedScales: readonly number[] =\n\t\t\t\tthis.getValue(ctx, MeterCCValues.supportedScales) ?? [];\n\n\t\t\tconst supportedRateTypes: readonly RateType[] =\n\t\t\t\tthis.getValue(ctx, MeterCCValues.supportedRateTypes) ?? [];\n\n\t\t\tconst rateTypes = supportedRateTypes.length\n\t\t\t\t? supportedRateTypes\n\t\t\t\t: [undefined];\n\t\t\tfor (const rateType of rateTypes) {\n\t\t\t\tfor (const scale of supportedScales) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\t\tmessage: `querying meter value (type = ${\n\t\t\t\t\t\t\tgetMeterName(type)\n\t\t\t\t\t\t}, scale = ${\n\t\t\t\t\t\t\t(getMeterScale(type, scale)\n\t\t\t\t\t\t\t\t?? getUnknownMeterScale(scale)).label\n\t\t\t\t\t\t}${\n\t\t\t\t\t\t\trateType != undefined\n\t\t\t\t\t\t\t\t? `, rate type = ${\n\t\t\t\t\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\t\t\t\t\tRateType,\n\t\t\t\t\t\t\t\t\t\trateType,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`\n\t\t\t\t\t\t\t\t: \"\"\n\t\t\t\t\t\t})...`,\n\t\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t\t});\n\t\t\t\t\tawait api.get({ scale, rateType });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// Poll the device when all of the supported values were last updated longer than 6 hours ago.\n\t\t// This may lead to some values not being updated, but the user may have disabled some unnecessary\n\t\t// reports to reduce traffic.\n\t\tconst valueDB = ctx.tryGetValueDB(this.nodeId);\n\t\tif (!valueDB) return true;\n\n\t\tconst values = this.getDefinedValueIDs(ctx).filter((v) =>\n\t\t\tMeterCCValues.value.is(v)\n\t\t);\n\t\treturn values.every((v) => {\n\t\t\tconst lastUpdated = valueDB.getTimestamp(v);\n\t\t\treturn (\n\t\t\t\tlastUpdated == undefined\n\t\t\t\t|| Date.now() - lastUpdated > timespan.hours(6)\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Returns which type this meter has.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getMeterTypeCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<number> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(MeterCCValues.type.endpoint(endpoint.index));\n\t}\n\n\t/**\n\t * Returns which scales are supported by this meter.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getSupportedScalesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<number[]> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(MeterCCValues.supportedScales.endpoint(endpoint.index));\n\t}\n\n\t/**\n\t * Returns whether reset is supported by this meter.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static supportsResetCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<boolean> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(MeterCCValues.supportsReset.endpoint(endpoint.index));\n\t}\n\n\t/**\n\t * Returns which rate types are supported by this meter.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getSupportedRateTypesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): MaybeNotKnown<RateType[]> {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMeterCCValues.supportedRateTypes.endpoint(endpoint.index),\n\t\t\t);\n\t}\n\n\tpublic translatePropertyKey(\n\t\tctx: GetValueDB,\n\t\tproperty: string | number,\n\t\tpropertyKey: string | number,\n\t): string | undefined {\n\t\tif (property === \"value\" && typeof propertyKey === \"number\") {\n\t\t\tconst { meterType, rateType, scale } = splitPropertyKey(\n\t\t\t\tpropertyKey,\n\t\t\t);\n\t\t\tlet ret: string;\n\t\t\tif (meterType !== 0) {\n\t\t\t\tret = `${getMeterName(meterType)}_${\n\t\t\t\t\t(getMeterScale(meterType, scale)\n\t\t\t\t\t\t?? getUnknownMeterScale(scale)).label\n\t\t\t\t}`;\n\t\t\t} else {\n\t\t\t\tret = \"default\";\n\t\t\t}\n\t\t\tif (rateType !== RateType.Unspecified) {\n\t\t\t\tret += \"_\" + getEnumMemberName(RateType, rateType);\n\t\t\t}\n\t\t\treturn ret;\n\t\t} else if (property === \"reset\" && typeof propertyKey === \"number\") {\n\t\t\treturn getMeterName(propertyKey);\n\t\t}\n\t\treturn super.translatePropertyKey(ctx, property, propertyKey);\n\t}\n}\n\n// @publicAPI\nexport interface MeterCCReportOptions {\n\ttype: number;\n\tscale: number;\n\tvalue: number;\n\tpreviousValue?: MaybeNotKnown<number>;\n\trateType?: RateType;\n\tdeltaTime?: MaybeUnknown<number>;\n}\n\n@CCCommand(MeterCommand.Report)\nexport class MeterCCReport extends MeterCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MeterCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.type = options.type;\n\t\tthis.scale = options.scale;\n\t\tthis.value = options.value;\n\t\tthis.previousValue = options.previousValue;\n\t\tthis.rateType = options.rateType ?? RateType.Unspecified;\n\t\tthis.deltaTime = options.deltaTime ?? UNKNOWN_STATE;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): MeterCCReport {\n\t\tconst { type, rateType, scale1, value, bytesRead } =\n\t\t\tparseMeterValueAndInfo(raw.payload, 0);\n\t\tlet offset = bytesRead;\n\t\tconst floatSize = bytesRead - 2;\n\t\tlet deltaTime: MaybeUnknown<number>;\n\t\tlet previousValue: MaybeNotKnown<number>;\n\n\t\tif (raw.payload.length >= offset + 2) {\n\t\t\tdeltaTime = raw.payload.readUInt16BE(offset);\n\t\t\toffset += 2;\n\t\t\tif (deltaTime === 0xffff) {\n\t\t\t\tdeltaTime = UNKNOWN_STATE;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// Previous value is included only if delta time is not 0\n\t\t\t\tdeltaTime !== 0\n\t\t\t\t&& raw.payload.length >= offset + floatSize\n\t\t\t) {\n\t\t\t\tconst { value: prevValue } = parseFloatWithScale(\n\t\t\t\t\t// This float is split in the payload\n\t\t\t\t\tBytes.concat([\n\t\t\t\t\t\tBytes.from([raw.payload[1]]),\n\t\t\t\t\t\traw.payload.subarray(offset),\n\t\t\t\t\t]),\n\t\t\t\t);\n\t\t\t\toffset += floatSize;\n\t\t\t\tpreviousValue = prevValue;\n\t\t\t}\n\t\t} else {\n\t\t\t// 0 means that no previous value is included\n\t\t\tdeltaTime = 0;\n\t\t}\n\t\tconst scale = parseScale(scale1, raw.payload, offset);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttype,\n\t\t\trateType,\n\t\t\tvalue,\n\t\t\tdeltaTime,\n\t\t\tpreviousValue,\n\t\t\tscale,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\n\t\tconst meter = getMeter(this.type);\n\t\tconst scale = getMeterScale(this.type, this.scale)\n\t\t\t?? getUnknownMeterScale(this.scale);\n\n\t\t// Filter out unknown meter types and scales, unless the strict validation is disabled\n\t\tconst measurementValidation = !ctx.getDeviceConfig?.(\n\t\t\tthis.nodeId as number,\n\t\t)?.compat?.disableStrictMeasurementValidation;\n\n\t\tif (measurementValidation) {\n\t\t\tvalidatePayload.withReason(\n\t\t\t\t`Unknown meter type ${num2hex(this.type)} or corrupted data`,\n\t\t\t)(!!meter);\n\t\t\tvalidatePayload.withReason(\n\t\t\t\t`Unknown meter scale ${num2hex(this.scale)} or corrupted data`,\n\t\t\t)(scale.label !== getUnknownMeterScale(this.scale).label);\n\n\t\t\t// Filter out unsupported meter types, scales and rate types if possible\n\t\t\tif (ccVersion >= 2) {\n\t\t\t\tconst expectedType = this.getValue<number>(\n\t\t\t\t\tctx,\n\t\t\t\t\tMeterCCValues.type,\n\t\t\t\t);\n\t\t\t\tif (expectedType != undefined) {\n\t\t\t\t\tvalidatePayload.withReason(\n\t\t\t\t\t\t\"Unexpected meter type or corrupted data\",\n\t\t\t\t\t)(this.type === expectedType);\n\t\t\t\t}\n\n\t\t\t\tconst supportedScales = this.getValue<number[]>(\n\t\t\t\t\tctx,\n\t\t\t\t\tMeterCCValues.supportedScales,\n\t\t\t\t);\n\t\t\t\tif (supportedScales?.length) {\n\t\t\t\t\tvalidatePayload.withReason(\n\t\t\t\t\t\t`Unsupported meter scale ${scale.label} or corrupted data`,\n\t\t\t\t\t)(supportedScales.includes(this.scale));\n\t\t\t\t}\n\n\t\t\t\tconst supportedRateTypes = this.getValue<RateType[]>(\n\t\t\t\t\tctx,\n\t\t\t\t\tMeterCCValues.supportedRateTypes,\n\t\t\t\t);\n\t\t\t\tif (supportedRateTypes?.length) {\n\t\t\t\t\tvalidatePayload.withReason(\n\t\t\t\t\t\t`Unsupported rate type ${\n\t\t\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\t\t\tRateType,\n\t\t\t\t\t\t\t\tthis.rateType,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} or corrupted data`,\n\t\t\t\t\t)(supportedRateTypes.includes(this.rateType));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst valueValue = MeterCCValues.value(\n\t\t\tthis.type,\n\t\t\tthis.rateType,\n\t\t\tthis.scale,\n\t\t);\n\t\tthis.setMetadata(ctx, valueValue, {\n\t\t\t...valueValue.meta,\n\t\t\tlabel: getValueLabel(this.type, this.scale, this.rateType),\n\t\t\tunit: scale.unit,\n\t\t\tccSpecific: {\n\t\t\t\tmeterType: this.type,\n\t\t\t\tscale: this.scale,\n\t\t\t\trateType: this.rateType,\n\t\t\t},\n\t\t});\n\t\tthis.setValue(ctx, valueValue, this.value);\n\n\t\treturn true;\n\t}\n\n\tpublic type: number;\n\tpublic scale: number;\n\tpublic value: number;\n\tpublic previousValue: MaybeNotKnown<number>;\n\tpublic rateType: RateType;\n\tpublic deltaTime: MaybeUnknown<number>;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst { data: typeAndValue, floatParams, scale2 } =\n\t\t\tencodeMeterValueAndInfo(\n\t\t\t\tthis.type,\n\t\t\t\tthis.rateType,\n\t\t\t\tthis.scale,\n\t\t\t\tthis.value,\n\t\t\t);\n\n\t\tconst deltaTime = this.deltaTime ?? 0xffff;\n\t\tconst deltaTimeBytes = new Bytes(2);\n\t\tdeltaTimeBytes.writeUInt16BE(deltaTime, 0);\n\n\t\tthis.payload = Bytes.concat([\n\t\t\ttypeAndValue,\n\t\t\tdeltaTimeBytes,\n\t\t]);\n\n\t\tif (this.deltaTime !== 0 && this.previousValue != undefined) {\n\t\t\t// Encode the float, but only keep the value bytes\n\t\t\tconst prevValueBytes = encodeFloatWithScale(\n\t\t\t\tthis.previousValue,\n\t\t\t\t0, // we discard the scale anyways\n\t\t\t\tfloatParams,\n\t\t\t).subarray(1);\n\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tprevValueBytes,\n\t\t\t]);\n\t\t}\n\n\t\tif (scale2 != undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([scale2]),\n\t\t\t]);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst scale = getMeterScale(this.type, this.scale)\n\t\t\t?? getUnknownMeterScale(this.scale);\n\n\t\tconst message: MessageRecord = {\n\t\t\t\"meter type\": getMeterName(this.type),\n\t\t\tscale: scale.label,\n\t\t\t\"rate type\": getEnumMemberName(RateType, this.rateType),\n\t\t\tvalue: this.value,\n\t\t};\n\t\tif (this.deltaTime !== UNKNOWN_STATE) {\n\t\t\tmessage[\"time delta\"] = `${this.deltaTime} seconds`;\n\t\t}\n\t\tif (this.previousValue != undefined) {\n\t\t\tmessage[\"prev. value\"] = this.previousValue;\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\nfunction testResponseForMeterGet(sent: MeterCCGet, received: MeterCCReport) {\n\t// We expect a Meter Report that matches the requested scale and rate type\n\t// (if they were requested)\n\treturn (\n\t\t(sent.scale == undefined || sent.scale === received.scale)\n\t\t&& (sent.rateType == undefined || sent.rateType == received.rateType)\n\t);\n}\n\n// @publicAPI\nexport interface MeterCCGetOptions {\n\tscale?: number;\n\trateType?: RateType;\n}\n\n@CCCommand(MeterCommand.Get)\n@expectedCCResponse(MeterCCReport, testResponseForMeterGet)\nexport class MeterCCGet extends MeterCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MeterCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.rateType = options.rateType;\n\t\tthis.scale = options.scale;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): MeterCCGet {\n\t\tlet rateType: RateType | undefined;\n\t\tlet scale: number | undefined;\n\n\t\tif (raw.payload.length >= 1) {\n\t\t\trateType = (raw.payload[0] & 0b11_000_000) >>> 6;\n\t\t\tscale = (raw.payload[0] & 0b00_111_000) >>> 3;\n\t\t\tif (scale === 7) {\n\t\t\t\tvalidatePayload(raw.payload.length >= 2);\n\t\t\t\tscale += raw.payload[1];\n\t\t\t}\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\trateType,\n\t\t\tscale,\n\t\t});\n\t}\n\n\tpublic rateType: RateType | undefined;\n\tpublic scale: number | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tlet scale1: number;\n\t\tlet scale2: number | undefined;\n\t\tlet bufferLength = 0;\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (this.scale == undefined) {\n\t\t\tscale1 = 0;\n\t\t} else if (ccVersion >= 4 && this.scale >= 7) {\n\t\t\tscale1 = 7;\n\t\t\tscale2 = this.scale >>> 3;\n\t\t\tbufferLength = 2;\n\t\t} else if (ccVersion >= 3) {\n\t\t\tscale1 = this.scale & 0b111;\n\t\t\tbufferLength = 1;\n\t\t} else if (ccVersion >= 2) {\n\t\t\tscale1 = this.scale & 0b11;\n\t\t\tbufferLength = 1;\n\t\t} else {\n\t\t\tscale1 = 0;\n\t\t}\n\n\t\tlet rateTypeFlags = 0;\n\t\tif (ccVersion >= 4 && this.rateType != undefined) {\n\t\t\trateTypeFlags = this.rateType & 0b11;\n\t\t\tbufferLength = Math.max(bufferLength, 1);\n\t\t}\n\n\t\tthis.payload = Bytes.alloc(bufferLength, 0);\n\t\tthis.payload[0] = (rateTypeFlags << 6) | (scale1 << 3);\n\t\tif (scale2) this.payload[1] = scale2;\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {};\n\t\tif (this.rateType != undefined) {\n\t\t\tmessage[\"rate type\"] = getEnumMemberName(RateType, this.rateType);\n\t\t}\n\t\tif (this.scale != undefined) {\n\t\t\tif (ctx) {\n\t\t\t\t// Try to lookup the meter type to translate the scale\n\t\t\t\tconst type = this.getValue<number>(ctx, MeterCCValues.type);\n\t\t\t\tif (type != undefined) {\n\t\t\t\t\tmessage.scale = (getMeterScale(type, this.scale)\n\t\t\t\t\t\t?? getUnknownMeterScale(this.scale)).label;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmessage.scale = this.scale;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MeterCCSupportedReportOptions {\n\ttype: number;\n\tsupportsReset: boolean;\n\tsupportedScales: readonly number[];\n\tsupportedRateTypes: readonly RateType[];\n}\n\n@CCCommand(MeterCommand.SupportedReport)\n@ccValueProperty(\"type\", MeterCCValues.type)\n@ccValueProperty(\"supportsReset\", MeterCCValues.supportsReset)\n@ccValueProperty(\"supportedScales\", MeterCCValues.supportedScales)\n@ccValueProperty(\"supportedRateTypes\", MeterCCValues.supportedRateTypes)\nexport class MeterCCSupportedReport extends MeterCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MeterCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.type = options.type;\n\t\tthis.supportsReset = options.supportsReset;\n\t\tthis.supportedScales = options.supportedScales;\n\t\tthis.supportedRateTypes = options.supportedRateTypes;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MeterCCSupportedReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst type = raw.payload[0] & 0b0_00_11111;\n\t\tconst supportsReset = !!(raw.payload[0] & 0b1_00_00000);\n\t\tconst hasMoreScales = !!(raw.payload[1] & 0b1_0000000);\n\n\t\tlet supportedScales: number[] | undefined;\n\t\tif (hasMoreScales) {\n\t\t\t// The bitmask is spread out\n\t\t\tvalidatePayload(raw.payload.length >= 3);\n\t\t\tconst extraBytes = raw.payload[2];\n\t\t\tvalidatePayload(raw.payload.length >= 3 + extraBytes);\n\t\t\t// The bitmask is the original payload byte plus all following bytes\n\t\t\t// Since the first byte only has 7 bits, we need to reduce all following bits by 1\n\t\t\tsupportedScales = parseBitMask(\n\t\t\t\tBytes.concat([\n\t\t\t\t\tBytes.from([raw.payload[1] & 0b0_1111111]),\n\t\t\t\t\traw.payload.subarray(3, 3 + extraBytes),\n\t\t\t\t]),\n\t\t\t\t0,\n\t\t\t).map((scale) => (scale >= 8 ? scale - 1 : scale));\n\t\t} else {\n\t\t\t// only 7 bits in the bitmask. Bit 7 is 0, so no need to mask it out\n\t\t\tsupportedScales = parseBitMask(\n\t\t\t\tBytes.from([raw.payload[1]]),\n\t\t\t\t0,\n\t\t\t);\n\t\t}\n\t\t// This is only present in V4+\n\t\tconst supportedRateTypes: RateType[] = parseBitMask(\n\t\t\tBytes.from([(raw.payload[0] & 0b0_11_00000) >>> 5]),\n\t\t\t1,\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttype,\n\t\t\tsupportsReset,\n\t\t\tsupportedScales,\n\t\t\tsupportedRateTypes,\n\t\t});\n\t}\n\n\tpublic readonly type: number;\n\n\tpublic readonly supportsReset: boolean;\n\n\tpublic readonly supportedScales: readonly number[];\n\n\tpublic readonly supportedRateTypes: readonly RateType[];\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\t\tif (!this.supportsReset) return true;\n\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\n\t\t// Create reset values\n\t\tif (ccVersion < 6) {\n\t\t\tthis.ensureMetadata(ctx, MeterCCValues.resetAll);\n\t\t} else {\n\t\t\tfor (const scale of this.supportedScales) {\n\t\t\t\t// Only accumulated values can be reset\n\t\t\t\tif (!isAccumulatedValue(this.type, scale)) continue;\n\n\t\t\t\tfor (const rateType of this.supportedRateTypes) {\n\t\t\t\t\tconst resetSingleValue = MeterCCValues.resetSingle(\n\t\t\t\t\t\tthis.type,\n\t\t\t\t\t\trateType,\n\t\t\t\t\t\tscale,\n\t\t\t\t\t);\n\t\t\t\t\tthis.ensureMetadata(ctx, resetSingleValue, {\n\t\t\t\t\t\t...resetSingleValue.meta,\n\t\t\t\t\t\tlabel: `Reset ${\n\t\t\t\t\t\t\tgetValueLabel(\n\t\t\t\t\t\t\t\tthis.type,\n\t\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t\t\trateType,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst typeByte = (this.type & 0b0_00_11111)\n\t\t\t| (this.supportedRateTypes.includes(RateType.Consumed)\n\t\t\t\t? 0b0_01_00000\n\t\t\t\t: 0)\n\t\t\t| (this.supportedRateTypes.includes(RateType.Produced)\n\t\t\t\t? 0b0_10_00000\n\t\t\t\t: 0)\n\t\t\t| (this.supportsReset ? 0b1_00_00000 : 0);\n\t\tconst supportedScales = encodeBitMask(\n\t\t\tthis.supportedScales,\n\t\t\tundefined,\n\t\t\t// The first byte only has 7 bits for the bitmask,\n\t\t\t// so we add a fake bit for the value -1 and later shift\n\t\t\t// the first byte one to the right\n\t\t\t-1,\n\t\t);\n\t\tconst scalesByte1 = (supportedScales[0] >>> 1)\n\t\t\t| (supportedScales.length > 1 ? 0b1000_0000 : 0);\n\n\t\tthis.payload = Bytes.from([\n\t\t\ttypeByte,\n\t\t\tscalesByte1,\n\t\t]);\n\t\tif (supportedScales.length > 1) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([supportedScales.length - 1]),\n\t\t\t\tBytes.from(supportedScales.subarray(1)),\n\t\t\t]);\n\t\t}\n\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"meter type\": getMeterName(this.type),\n\t\t\t\"supports reset\": this.supportsReset,\n\t\t\t\"supported scales\": `${\n\t\t\t\tthis.supportedScales\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(scale) => `\n\u00B7 ${(getMeterScale(this.type, scale) ?? getUnknownMeterScale(scale)).label}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\")\n\t\t\t}`,\n\t\t\t\"supported rate types\": this.supportedRateTypes\n\t\t\t\t.map((rt) => getEnumMemberName(RateType, rt))\n\t\t\t\t.join(\", \"),\n\t\t};\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(MeterCommand.SupportedGet)\n@expectedCCResponse(MeterCCSupportedReport)\nexport class MeterCCSupportedGet extends MeterCC {}\n\n// @publicAPI\nexport type MeterCCResetOptions = AllOrNone<{\n\ttype: number;\n\tscale: number;\n\trateType: RateType;\n\ttargetValue: number;\n}>;\n\n@CCCommand(MeterCommand.Reset)\n@useSupervision()\nexport class MeterCCReset extends MeterCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MeterCCResetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.type = options.type;\n\t\tthis.scale = options.scale;\n\t\tthis.rateType = options.rateType;\n\t\tthis.targetValue = options.targetValue;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): MeterCCReset {\n\t\tif (raw.payload.length === 0) {\n\t\t\treturn new this({\n\t\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t});\n\t\t}\n\n\t\tconst {\n\t\t\ttype,\n\t\t\trateType,\n\t\t\tscale1,\n\t\t\tvalue: targetValue,\n\t\t\tbytesRead: scale2Offset,\n\t\t} = parseMeterValueAndInfo(raw.payload, 0);\n\t\tconst scale = parseScale(scale1, raw.payload, scale2Offset);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\ttype,\n\t\t\trateType,\n\t\t\ttargetValue,\n\t\t\tscale,\n\t\t});\n\t}\n\n\tpublic type: number | undefined;\n\tpublic scale: number | undefined;\n\tpublic rateType: RateType | undefined;\n\tpublic targetValue: number | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tif (\n\t\t\tthis.type != undefined\n\t\t\t&& this.scale != undefined\n\t\t\t&& this.rateType != undefined\n\t\t\t&& this.targetValue != undefined\n\t\t) {\n\t\t\tconst { data: typeAndValue, scale2 } = encodeMeterValueAndInfo(\n\t\t\t\tthis.type,\n\t\t\t\tthis.rateType,\n\t\t\t\tthis.scale,\n\t\t\t\tthis.targetValue,\n\t\t\t);\n\n\t\t\tthis.payload = typeAndValue;\n\n\t\t\tif (scale2 != undefined) {\n\t\t\t\tthis.payload = Bytes.concat([\n\t\t\t\t\tthis.payload,\n\t\t\t\t\tBytes.from([scale2]),\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {};\n\t\tif (this.type != undefined) {\n\t\t\tmessage.type = getMeterName(this.type);\n\t\t}\n\t\tif (this.rateType != undefined) {\n\t\t\tmessage[\"rate type\"] = getEnumMemberName(RateType, this.rateType);\n\t\t}\n\t\tif (this.type != undefined && this.scale != undefined) {\n\t\t\tmessage.scale = (getMeterScale(this.type, this.scale)\n\t\t\t\t?? getUnknownMeterScale(this.scale)).label;\n\t\t}\n\t\tif (this.targetValue != undefined) {\n\t\t\tmessage[\"target value\"] = this.targetValue;\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kBAgCO;AACP,oBAOO;AAEP,iBAaO;AACP,0BAAwC;AACxC,0BAOO;AACP,oCAUO;AACP,oBAAkB;AAClB,mBAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiE1D,SAAS,iBAAiB,KAAW;AAKpC,SAAO;IACN,UAAU,MAAM;IAChB,OAAQ,QAAQ,IAAK;IACrB,WAAW,QAAQ;;AAErB;AAVS;AAYT,SAAS,cACR,WACA,OACA,UACA,QAAe;AAEf,MAAI,UAAM,0BAAa,SAAS;AAChC,QAAM,kBACJ,2BAAc,WAAW,KAAK,SAAK,kCAAqB,KAAK,GAAG;AAClE,UAAQ,UAAU;IACjB,KAAK,sBAAS;AACb,aAAO,iBAAiB,UAAU;AAClC;IACD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AAI;QACZ;QACA;QACA;QACA;OACA;IACF;IAEO;IACA;IACA;IACA;IAEA,UAAU,KAAsB;AACtC,UACC,KAAK,QAAQ,UACV,KAAK,SAAS,UACd,KAAK,YAAY,UACjB,KAAK,eAAe,QACtB;AACD,cAAM,EAAE,MAAM,cAAc,OAAM,IAAK,wBACtC,KAAK,MACL,KAAK,UACL,KAAK,OACL,KAAK,WAAW;AAGjB,aAAK,UAAU;AAEf,YAAI,UAAU,QAAW;AACxB,eAAK,UAAU,oBAAM,OAAO;YAC3B,KAAK;YACL,oBAAM,KAAK,CAAC,MAAM,CAAC;WACnB;QACF;MACD;AACA,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,YAAM,UAAyB,CAAA;AAC/B,UAAI,KAAK,QAAQ,QAAW;AAC3B,gBAAQ,WAAO,0BAAa,KAAK,IAAI;MACtC;AACA,UAAI,KAAK,YAAY,QAAW;AAC/B,gBAAQ,WAAW,QAAI,iCAAkB,uBAAU,KAAK,QAAQ;MACjE;AACA,UAAI,KAAK,QAAQ,UAAa,KAAK,SAAS,QAAW;AACtD,gBAAQ,aAAS,2BAAc,KAAK,MAAM,KAAK,KAAK,SAChD,kCAAqB,KAAK,KAAK,GAAG;MACvC;AACA,UAAI,KAAK,eAAe,QAAW;AAClC,gBAAQ,cAAc,IAAI,KAAK;MAChC;AACA,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB;;IAEF;;;;",
6
6
  "names": ["propertyKey"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cc/MultiChannelAssociationCC.ts"],
4
- "sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype EndpointId,\n\ttype GetValueDB,\n\tMAX_NODES,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tencodeBitMask,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\ttype AssociationAddress,\n\ttype EndpointAddress,\n\tMultiChannelAssociationCommand,\n} from \"../lib/_Types.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { AssociationCCValues } from \"./AssociationCC.js\";\n\nexport const MultiChannelAssociationCCValues = V.defineCCValues(\n\tCommandClasses[\"Multi Channel Association\"],\n\t{\n\t\t...V.staticProperty(\"groupCount\", undefined, { internal: true }),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"maxNodes\",\n\t\t\t\"maxNodes\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"maxNodes\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"nodeIds\",\n\t\t\t\"nodeIds\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"nodeIds\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"endpoints\",\n\t\t\t\"endpoints\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"endpoints\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t},\n);\n\nfunction endpointAddressesToString(\n\tendpoints: readonly EndpointAddress[],\n): string {\n\treturn endpoints\n\t\t.map(({ nodeId, endpoint }) => {\n\t\t\tif (typeof endpoint === \"number\") {\n\t\t\t\treturn `${nodeId}:${endpoint}`;\n\t\t\t} else {\n\t\t\t\treturn `${nodeId}:[${endpoint.map(String).join(\", \")}]`;\n\t\t\t}\n\t\t})\n\t\t.join(\", \");\n}\n\nconst MULTI_CHANNEL_ASSOCIATION_MARKER = 0x00;\n\nfunction serializeMultiChannelAssociationDestination(\n\tnodeIds: number[],\n\tendpoints: EndpointAddress[],\n): Bytes {\n\tconst nodeAddressBytes = nodeIds.length;\n\tconst endpointAddressBytes = endpoints.length * 2;\n\tconst payload = new Bytes(\n\t\t// node addresses\n\t\tnodeAddressBytes\n\t\t\t// endpoint marker\n\t\t\t+ (endpointAddressBytes > 0 ? 1 : 0)\n\t\t\t// endpoints\n\t\t\t+ endpointAddressBytes,\n\t);\n\t// write node addresses\n\tfor (let i = 0; i < nodeIds.length; i++) {\n\t\tpayload[i] = nodeIds[i];\n\t}\n\t// write endpoint addresses\n\tif (endpointAddressBytes > 0) {\n\t\tlet offset = nodeIds.length;\n\t\tpayload[offset] = MULTI_CHANNEL_ASSOCIATION_MARKER;\n\t\toffset += 1;\n\t\tfor (let i = 0; i < endpoints.length; i++) {\n\t\t\tconst endpoint = endpoints[i];\n\t\t\tconst destination = typeof endpoint.endpoint === \"number\"\n\t\t\t\t// The destination is a single number\n\t\t\t\t? endpoint.endpoint & 0b0111_1111\n\t\t\t\t// The destination is a bit mask\n\t\t\t\t: encodeBitMask(endpoint.endpoint, 7)[0] | 0b1000_0000;\n\n\t\t\tpayload[offset + 2 * i] = endpoint.nodeId;\n\t\t\tpayload[offset + 2 * i + 1] = destination;\n\t\t}\n\t}\n\treturn payload;\n}\n\nfunction deserializeMultiChannelAssociationDestination(data: Uint8Array): {\n\tnodeIds: number[];\n\tendpoints: EndpointAddress[];\n} {\n\tconst nodeIds: number[] = [];\n\tlet endpointOffset = data.length;\n\t// Scan node ids until we find the marker\n\tfor (let i = 0; i < data.length; i++) {\n\t\tif (data[i] === MULTI_CHANNEL_ASSOCIATION_MARKER) {\n\t\t\tendpointOffset = i + 1;\n\t\t\tbreak;\n\t\t}\n\t\tnodeIds.push(data[i]);\n\t}\n\tconst endpoints: EndpointAddress[] = [];\n\tfor (let i = endpointOffset; i < data.length; i += 2) {\n\t\tconst nodeId = data[i];\n\t\tconst isBitMask = !!(data[i + 1] & 0b1000_0000);\n\t\tconst destination = data[i + 1] & 0b0111_1111;\n\t\tconst endpoint = isBitMask\n\t\t\t? parseBitMask(Bytes.from([destination]))\n\t\t\t: destination;\n\n\t\tendpoints.push({ nodeId, endpoint });\n\t}\n\n\treturn { nodeIds, endpoints };\n}\n\n// @noSetValueAPI\n\n@API(CommandClasses[\"Multi Channel Association\"])\nexport class MultiChannelAssociationCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(\n\t\tcmd: MultiChannelAssociationCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase MultiChannelAssociationCommand.Get:\n\t\t\tcase MultiChannelAssociationCommand.Set:\n\t\t\tcase MultiChannelAssociationCommand.Report:\n\t\t\tcase MultiChannelAssociationCommand.Remove:\n\t\t\tcase MultiChannelAssociationCommand.SupportedGroupingsGet:\n\t\t\tcase MultiChannelAssociationCommand.SupportedGroupingsReport:\n\t\t\t\treturn true; // This is mandatory\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t/**\n\t * Returns the number of association groups a node supports.\n\t * Association groups are consecutive, starting at 1.\n\t */\n\tpublic async getGroupCount(): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.SupportedGroupingsGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSupportedGroupingsGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelAssociationCCSupportedGroupingsReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.groupCount;\n\t}\n\n\t@validateArgs()\n\tpublic async reportGroupCount(groupCount: number): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.SupportedGroupingsReport,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSupportedGroupingsReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupCount,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Returns information about an association group.\n\t */\n\t@validateArgs()\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getGroup(groupId: number) {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Get,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupId,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelAssociationCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"maxNodes\", \"nodeIds\", \"endpoints\"]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\toptions: MultiChannelAssociationCCReportOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Report,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Adds new nodes or endpoints to an association group\n\t */\n\t@validateArgs()\n\tpublic async addDestinations(\n\t\toptions: MultiChannelAssociationCCSetOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Set,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Removes nodes or endpoints from an association group\n\t */\n\t@validateArgs()\n\tpublic async removeDestinations(\n\t\toptions: MultiChannelAssociationCCRemoveOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Remove,\n\t\t);\n\n\t\tif (!options.groupId && this.version === 1) {\n\t\t\t// V1 does not support omitting the group, manually remove the destination from all groups\n\t\t\t// We don't want to do too much work, so find out which groups the destination is in\n\t\t\tconst currentDestinations = MultiChannelAssociationCC\n\t\t\t\t.getAllDestinationsCached(\n\t\t\t\t\tthis.host,\n\t\t\t\t\tthis.endpoint,\n\t\t\t\t);\n\t\t\tfor (const [group, destinations] of currentDestinations) {\n\t\t\t\tconst cc = new MultiChannelAssociationCCRemove({\n\t\t\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t\t\tgroupId: group,\n\t\t\t\t\tnodeIds: destinations\n\t\t\t\t\t\t.filter((d) => d.endpoint != undefined)\n\t\t\t\t\t\t.map((d) => d.nodeId),\n\t\t\t\t\tendpoints: destinations.filter(\n\t\t\t\t\t\t(d): d is AssociationAddress & { endpoint: number } =>\n\t\t\t\t\t\t\td.endpoint != undefined,\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t\t// TODO: evaluate intermediate supervision results\n\t\t\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t\t\t}\n\t\t} else if (options.groupId && options.groupId < 0) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must not be negative!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t} else {\n\t\t\tconst cc = new MultiChannelAssociationCCRemove({\n\t\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t\t...options,\n\t\t\t});\n\t\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t\t}\n\t}\n}\n\n@commandClass(CommandClasses[\"Multi Channel Association\"])\n@implementedVersion(5)\n@ccValues(MultiChannelAssociationCCValues)\nexport class MultiChannelAssociationCC extends CommandClass {\n\tdeclare ccCommand: MultiChannelAssociationCommand;\n\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// MultiChannelAssociationCC must be interviewed after Z-Wave+ if that is supported\n\t\treturn [\n\t\t\t...super.determineRequiredCCInterviews(),\n\t\t\tCommandClasses[\"Z-Wave Plus Info\"],\n\t\t\t// We need information about endpoints to correctly configure the lifeline associations\n\t\t\tCommandClasses[\"Multi Channel\"],\n\t\t\t// AssociationCC will short-circuit if this CC is supported\n\t\t\tCommandClasses.Association,\n\t\t];\n\t}\n\n\t/**\n\t * Returns the number of association groups reported by the node/endpoint.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getGroupCountCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): number {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMultiChannelAssociationCCValues.groupCount.endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) || 0;\n\t}\n\n\t/**\n\t * Returns the number of nodes an association group supports.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getMaxNodesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t\tgroupId: number,\n\t): number {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMultiChannelAssociationCCValues.maxNodes(groupId).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? 0;\n\t}\n\n\t/**\n\t * Returns all the destinations of all association groups reported by the node/endpoint.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getAllDestinationsCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): ReadonlyMap<number, readonly AssociationAddress[]> {\n\t\tconst ret = new Map<number, AssociationAddress[]>();\n\t\tconst groupCount = this.getGroupCountCached(ctx, endpoint);\n\t\tconst valueDB = ctx.getValueDB(endpoint.nodeId);\n\t\tfor (let i = 1; i <= groupCount; i++) {\n\t\t\tconst groupDestinations: AssociationAddress[] = [];\n\t\t\t// Add all node destinations\n\t\t\tconst nodes = valueDB.getValue<number[]>(\n\t\t\t\tMultiChannelAssociationCCValues.nodeIds(i).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\t\t\tgroupDestinations.push(...nodes.map((nodeId) => ({ nodeId })));\n\t\t\t// And all endpoint destinations\n\t\t\tconst endpoints = valueDB.getValue<EndpointAddress[]>(\n\t\t\t\tMultiChannelAssociationCCValues.endpoints(i).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\t\t\tfor (const ep of endpoints) {\n\t\t\t\tif (typeof ep.endpoint === \"number\") {\n\t\t\t\t\tgroupDestinations.push({\n\t\t\t\t\t\tnodeId: ep.nodeId,\n\t\t\t\t\t\tendpoint: ep.endpoint,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tgroupDestinations.push(\n\t\t\t\t\t\t...ep.endpoint.map((e) => ({\n\t\t\t\t\t\t\tnodeId: ep.nodeId,\n\t\t\t\t\t\t\tendpoint: e,\n\t\t\t\t\t\t})),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tret.set(\n\t\t\t\ti,\n\t\t\t\t// Filter out duplicates\n\t\t\t\tgroupDestinations.filter(\n\t\t\t\t\t(addr, index) =>\n\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t=== groupDestinations.findIndex(\n\t\t\t\t\t\t\t\t({ nodeId, endpoint }) =>\n\t\t\t\t\t\t\t\t\tnodeId === addr.nodeId\n\t\t\t\t\t\t\t\t\t&& endpoint === addr.endpoint,\n\t\t\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst mcAPI = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// First find out how many groups are supported as multi channel\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying number of multi channel association groups...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst mcGroupCount = await mcAPI.getGroupCount();\n\t\tif (mcGroupCount != undefined) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`supports ${mcGroupCount} multi channel association groups`,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t} else {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t\"Querying multi channel association groups timed out, skipping interview...\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// Query each association group for its members\n\t\tawait this.refreshValues(ctx);\n\n\t\t// And set up lifeline associations\n\t\tawait ccUtils.configureLifelineAssociations(ctx, endpoint);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst mcAPI = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\t\tconst assocAPI = CCAPI.create(\n\t\t\tCommandClasses.Association,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tconst mcGroupCount: number = this.getValue(\n\t\t\tctx,\n\t\t\tMultiChannelAssociationCCValues.groupCount,\n\t\t) ?? 0;\n\n\t\t// Some devices report more association groups than multi channel association groups, so we need this info here\n\t\tconst assocGroupCount: number =\n\t\t\tthis.getValue(ctx, AssociationCCValues.groupCount)\n\t\t\t|| mcGroupCount;\n\n\t\t// Then query each multi channel association group\n\t\tfor (let groupId = 1; groupId <= mcGroupCount; groupId++) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`querying multi channel association group #${groupId}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst group = await mcAPI.getGroup(groupId);\n\t\t\tif (!group) continue;\n\t\t\tconst logMessage =\n\t\t\t\t`received information for multi channel association group #${groupId}:\nmaximum # of nodes: ${group.maxNodes}\ncurrently assigned nodes: ${group.nodeIds.map(String).join(\", \")}\ncurrently assigned endpoints: ${\n\t\t\t\t\tgroup.endpoints\n\t\t\t\t\t\t.map(({ nodeId, endpoint }) => {\n\t\t\t\t\t\t\tif (typeof endpoint === \"number\") {\n\t\t\t\t\t\t\t\treturn `${nodeId}:${endpoint}`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn `${nodeId}:[${\n\t\t\t\t\t\t\t\t\tendpoint.map(String).join(\", \")\n\t\t\t\t\t\t\t\t}]`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`;\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\n\t\t// Check if there are more non-multi-channel association groups we haven't queried yet\n\t\tif (assocAPI.isSupported() && assocGroupCount > mcGroupCount) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`querying additional non-multi-channel association groups...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tfor (\n\t\t\t\tlet groupId = mcGroupCount + 1;\n\t\t\t\tgroupId <= assocGroupCount;\n\t\t\t\tgroupId++\n\t\t\t) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `querying association group #${groupId}...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tconst group = await assocAPI.getGroup(groupId);\n\t\t\t\tif (!group) continue;\n\t\t\t\tconst logMessage =\n\t\t\t\t\t`received information for association group #${groupId}:\nmaximum # of nodes: ${group.maxNodes}\ncurrently assigned nodes: ${group.nodeIds.map(String).join(\", \")}`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n// @publicAPI\nexport type MultiChannelAssociationCCSetOptions =\n\t& {\n\t\tgroupId: number;\n\t}\n\t& (\n\t\t| { nodeIds: number[] }\n\t\t| { endpoints: EndpointAddress[] }\n\t\t| { nodeIds: number[]; endpoints: EndpointAddress[] }\n\t);\n\n@CCCommand(MultiChannelAssociationCommand.Set)\n@useSupervision()\nexport class MultiChannelAssociationCCSet extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tif (options.groupId < 1) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.groupId = options.groupId;\n\t\tthis.nodeIds = (\"nodeIds\" in options && options.nodeIds) || [];\n\t\tif (this.nodeIds.some((n) => n < 1 || n > MAX_NODES)) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`All node IDs must be between 1 and ${MAX_NODES}!`,\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.endpoints = (\"endpoints\" in options && options.endpoints)\n\t\t\t|| [];\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(1),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic nodeIds: number[];\n\tpublic endpoints: EndpointAddress[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.groupId]),\n\t\t\tserializeMultiChannelAssociationDestination(\n\t\t\t\tthis.nodeIds,\n\t\t\t\tthis.endpoints,\n\t\t\t),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"group id\": this.groupId,\n\t\t\t\t\"node ids\": this.nodeIds.join(\", \"),\n\t\t\t\tendpoints: endpointAddressesToString(this.endpoints),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCRemoveOptions {\n\t/** The group from which to remove the nodes. If none is specified, the nodes will be removed from all groups. */\n\tgroupId?: number;\n\t/** The nodes to remove. If no nodeIds and no endpoint addresses are specified, ALL nodes will be removed. */\n\tnodeIds?: number[];\n\t/** The single endpoints to remove. If no nodeIds and no endpoint addresses are specified, ALL will be removed. */\n\tendpoints?: EndpointAddress[];\n}\n\n@CCCommand(MultiChannelAssociationCommand.Remove)\n@useSupervision()\nexport class MultiChannelAssociationCCRemove extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCRemoveOptions>,\n\t) {\n\t\tsuper(options);\n\t\t// When removing associations, we allow invalid node IDs.\n\t\t// See GH#3606 - it is possible that those exist.\n\t\tthis.groupId = options.groupId;\n\t\tthis.nodeIds = options.nodeIds;\n\t\tthis.endpoints = options.endpoints;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCRemove {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId: number | undefined = raw.payload[0];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(1),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t});\n\t}\n\n\tpublic groupId?: number;\n\tpublic nodeIds?: number[];\n\tpublic endpoints?: EndpointAddress[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.groupId || 0]),\n\t\t\tserializeMultiChannelAssociationDestination(\n\t\t\t\tthis.nodeIds || [],\n\t\t\t\tthis.endpoints || [],\n\t\t\t),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"group id\": this.groupId || \"(all groups)\",\n\t\t};\n\t\tif (this.nodeIds) {\n\t\t\tmessage[\"node ids\"] = this.nodeIds.join(\", \");\n\t\t}\n\t\tif (this.endpoints) {\n\t\t\tmessage.endpoints = endpointAddressesToString(this.endpoints);\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCReportOptions {\n\tgroupId: number;\n\tmaxNodes: number;\n\tnodeIds: number[];\n\tendpoints: EndpointAddress[];\n\treportsToFollow: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.Report)\n@ccValueProperty(\n\t\"maxNodes\",\n\tMultiChannelAssociationCCValues.maxNodes,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"nodeIds\",\n\tMultiChannelAssociationCCValues.nodeIds,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"endpoints\",\n\tMultiChannelAssociationCCValues.endpoints,\n\t(self) => [self.groupId],\n)\nexport class MultiChannelAssociationCCReport extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.groupId = options.groupId;\n\t\tthis.maxNodes = options.maxNodes;\n\t\tthis.nodeIds = options.nodeIds;\n\t\tthis.endpoints = options.endpoints;\n\t\tthis.reportsToFollow = options.reportsToFollow;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCReport {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst groupId = raw.payload[0];\n\t\tconst maxNodes = raw.payload[1];\n\t\tconst reportsToFollow = raw.payload[2];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(3),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tmaxNodes,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t\treportsToFollow,\n\t\t});\n\t}\n\n\tpublic readonly groupId: number;\n\n\tpublic maxNodes: number;\n\n\tpublic nodeIds: number[];\n\n\tpublic endpoints: EndpointAddress[];\n\n\tpublic reportsToFollow: number;\n\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\t// Distinguish sessions by the association group ID\n\t\treturn { groupId: this.groupId };\n\t}\n\n\tpublic expectMoreMessages(): boolean {\n\t\treturn this.reportsToFollow > 0;\n\t}\n\n\tpublic mergePartialCCs(\n\t\tpartials: MultiChannelAssociationCCReport[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// Concat the list of nodes\n\t\tthis.nodeIds = [...partials, this]\n\t\t\t.map((report) => [...report.nodeIds])\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\t// Concat the list of endpoints\n\t\tthis.endpoints = [...partials, this]\n\t\t\t.map((report) => [...report.endpoints])\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\treturn Promise.resolve();\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst destinations = serializeMultiChannelAssociationDestination(\n\t\t\tthis.nodeIds,\n\t\t\tthis.endpoints,\n\t\t);\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\tthis.groupId,\n\t\t\t\tthis.maxNodes,\n\t\t\t\tthis.reportsToFollow,\n\t\t\t]),\n\t\t\tdestinations,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"group id\": this.groupId,\n\t\t\t\t\"maximum # of nodes\": this.maxNodes,\n\t\t\t\t\"node ids\": this.nodeIds.join(\", \"),\n\t\t\t\tendpoints: endpointAddressesToString(this.endpoints),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCGetOptions {\n\tgroupId: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.Get)\n@expectedCCResponse(MultiChannelAssociationCCReport)\nexport class MultiChannelAssociationCCGet extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tif (options.groupId < 1) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.groupId = options.groupId;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCGet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.groupId]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"group id\": this.groupId },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCSupportedGroupingsReportOptions {\n\tgroupCount: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.SupportedGroupingsReport)\n@ccValueProperty(\"groupCount\", MultiChannelAssociationCCValues.groupCount)\nexport class MultiChannelAssociationCCSupportedGroupingsReport\n\textends MultiChannelAssociationCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<\n\t\t\tMultiChannelAssociationCCSupportedGroupingsReportOptions\n\t\t>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.groupCount = options.groupCount;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCSupportedGroupingsReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupCount = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupCount,\n\t\t});\n\t}\n\n\tpublic readonly groupCount: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.groupCount]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"group count\": this.groupCount },\n\t\t};\n\t}\n}\n\n@CCCommand(MultiChannelAssociationCommand.SupportedGroupingsGet)\n@expectedCCResponse(MultiChannelAssociationCCSupportedGroupingsReport)\nexport class MultiChannelAssociationCCSupportedGro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A;;;AAAa,wBAAA,YAAA,uBAAA;;IAGZ,YACC,SAEC;AAED,YAAM,OAAO;AAEb,WAAK,aAAa,QAAQ;IAC3B;IAEO,OAAO,KACb,KACA,KAAqB;AAErB,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,aAAa,IAAI,QAAQ,CAAC;AAEhC,aAAO,IAAI,KAAK;QACf,QAAQ,IAAI;QACZ;OACA;IACF;IAEgB;IAET,UAAU,KAAsB;AACtC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,UAAU,CAAC;AAC3C,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,eAAe,KAAK,WAAU;;IAE3C;;;;IAKY,kDAA8C,MAAA;8BAF1D,yCAAU,4CAA+B,qBAAqB,OAC9D,kDAAmB,iDAAiD,CAAC;;;;oBAE7D;sEAAA,YAAyB;WAAA;;;;;;;;AADlC,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
4
+ "sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype EndpointId,\n\ttype GetValueDB,\n\tMAX_NODES,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tencodeBitMask,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, type BytesView, pick } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\ttype AssociationAddress,\n\ttype EndpointAddress,\n\tMultiChannelAssociationCommand,\n} from \"../lib/_Types.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { AssociationCCValues } from \"./AssociationCC.js\";\n\nexport const MultiChannelAssociationCCValues = V.defineCCValues(\n\tCommandClasses[\"Multi Channel Association\"],\n\t{\n\t\t...V.staticProperty(\"groupCount\", undefined, { internal: true }),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"maxNodes\",\n\t\t\t\"maxNodes\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"maxNodes\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"nodeIds\",\n\t\t\t\"nodeIds\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"nodeIds\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"endpoints\",\n\t\t\t\"endpoints\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"endpoints\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t},\n);\n\nfunction endpointAddressesToString(\n\tendpoints: readonly EndpointAddress[],\n): string {\n\treturn endpoints\n\t\t.map(({ nodeId, endpoint }) => {\n\t\t\tif (typeof endpoint === \"number\") {\n\t\t\t\treturn `${nodeId}:${endpoint}`;\n\t\t\t} else {\n\t\t\t\treturn `${nodeId}:[${endpoint.map(String).join(\", \")}]`;\n\t\t\t}\n\t\t})\n\t\t.join(\", \");\n}\n\nconst MULTI_CHANNEL_ASSOCIATION_MARKER = 0x00;\n\nfunction serializeMultiChannelAssociationDestination(\n\tnodeIds: number[],\n\tendpoints: EndpointAddress[],\n): Bytes {\n\tconst nodeAddressBytes = nodeIds.length;\n\tconst endpointAddressBytes = endpoints.length * 2;\n\tconst payload = new Bytes(\n\t\t// node addresses\n\t\tnodeAddressBytes\n\t\t\t// endpoint marker\n\t\t\t+ (endpointAddressBytes > 0 ? 1 : 0)\n\t\t\t// endpoints\n\t\t\t+ endpointAddressBytes,\n\t);\n\t// write node addresses\n\tfor (let i = 0; i < nodeIds.length; i++) {\n\t\tpayload[i] = nodeIds[i];\n\t}\n\t// write endpoint addresses\n\tif (endpointAddressBytes > 0) {\n\t\tlet offset = nodeIds.length;\n\t\tpayload[offset] = MULTI_CHANNEL_ASSOCIATION_MARKER;\n\t\toffset += 1;\n\t\tfor (let i = 0; i < endpoints.length; i++) {\n\t\t\tconst endpoint = endpoints[i];\n\t\t\tconst destination = typeof endpoint.endpoint === \"number\"\n\t\t\t\t// The destination is a single number\n\t\t\t\t? endpoint.endpoint & 0b0111_1111\n\t\t\t\t// The destination is a bit mask\n\t\t\t\t: encodeBitMask(endpoint.endpoint, 7)[0] | 0b1000_0000;\n\n\t\t\tpayload[offset + 2 * i] = endpoint.nodeId;\n\t\t\tpayload[offset + 2 * i + 1] = destination;\n\t\t}\n\t}\n\treturn payload;\n}\n\nfunction deserializeMultiChannelAssociationDestination(data: BytesView): {\n\tnodeIds: number[];\n\tendpoints: EndpointAddress[];\n} {\n\tconst nodeIds: number[] = [];\n\tlet endpointOffset = data.length;\n\t// Scan node ids until we find the marker\n\tfor (let i = 0; i < data.length; i++) {\n\t\tif (data[i] === MULTI_CHANNEL_ASSOCIATION_MARKER) {\n\t\t\tendpointOffset = i + 1;\n\t\t\tbreak;\n\t\t}\n\t\tnodeIds.push(data[i]);\n\t}\n\tconst endpoints: EndpointAddress[] = [];\n\tfor (let i = endpointOffset; i < data.length; i += 2) {\n\t\tconst nodeId = data[i];\n\t\tconst isBitMask = !!(data[i + 1] & 0b1000_0000);\n\t\tconst destination = data[i + 1] & 0b0111_1111;\n\t\tconst endpoint = isBitMask\n\t\t\t? parseBitMask(Bytes.from([destination]))\n\t\t\t: destination;\n\n\t\tendpoints.push({ nodeId, endpoint });\n\t}\n\n\treturn { nodeIds, endpoints };\n}\n\n// @noSetValueAPI\n\n@API(CommandClasses[\"Multi Channel Association\"])\nexport class MultiChannelAssociationCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(\n\t\tcmd: MultiChannelAssociationCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase MultiChannelAssociationCommand.Get:\n\t\t\tcase MultiChannelAssociationCommand.Set:\n\t\t\tcase MultiChannelAssociationCommand.Report:\n\t\t\tcase MultiChannelAssociationCommand.Remove:\n\t\t\tcase MultiChannelAssociationCommand.SupportedGroupingsGet:\n\t\t\tcase MultiChannelAssociationCommand.SupportedGroupingsReport:\n\t\t\t\treturn true; // This is mandatory\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t/**\n\t * Returns the number of association groups a node supports.\n\t * Association groups are consecutive, starting at 1.\n\t */\n\tpublic async getGroupCount(): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.SupportedGroupingsGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSupportedGroupingsGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelAssociationCCSupportedGroupingsReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.groupCount;\n\t}\n\n\t@validateArgs()\n\tpublic async reportGroupCount(groupCount: number): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.SupportedGroupingsReport,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSupportedGroupingsReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupCount,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Returns information about an association group.\n\t */\n\t@validateArgs()\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getGroup(groupId: number) {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Get,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupId,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelAssociationCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"maxNodes\", \"nodeIds\", \"endpoints\"]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\toptions: MultiChannelAssociationCCReportOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Report,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Adds new nodes or endpoints to an association group\n\t */\n\t@validateArgs()\n\tpublic async addDestinations(\n\t\toptions: MultiChannelAssociationCCSetOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Set,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Removes nodes or endpoints from an association group\n\t */\n\t@validateArgs()\n\tpublic async removeDestinations(\n\t\toptions: MultiChannelAssociationCCRemoveOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Remove,\n\t\t);\n\n\t\tif (!options.groupId && this.version === 1) {\n\t\t\t// V1 does not support omitting the group, manually remove the destination from all groups\n\t\t\t// We don't want to do too much work, so find out which groups the destination is in\n\t\t\tconst currentDestinations = MultiChannelAssociationCC\n\t\t\t\t.getAllDestinationsCached(\n\t\t\t\t\tthis.host,\n\t\t\t\t\tthis.endpoint,\n\t\t\t\t);\n\t\t\tfor (const [group, destinations] of currentDestinations) {\n\t\t\t\tconst cc = new MultiChannelAssociationCCRemove({\n\t\t\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t\t\tgroupId: group,\n\t\t\t\t\tnodeIds: destinations\n\t\t\t\t\t\t.filter((d) => d.endpoint != undefined)\n\t\t\t\t\t\t.map((d) => d.nodeId),\n\t\t\t\t\tendpoints: destinations.filter(\n\t\t\t\t\t\t(d): d is AssociationAddress & { endpoint: number } =>\n\t\t\t\t\t\t\td.endpoint != undefined,\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t\t// TODO: evaluate intermediate supervision results\n\t\t\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t\t\t}\n\t\t} else if (options.groupId && options.groupId < 0) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must not be negative!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t} else {\n\t\t\tconst cc = new MultiChannelAssociationCCRemove({\n\t\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t\t...options,\n\t\t\t});\n\t\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t\t}\n\t}\n}\n\n@commandClass(CommandClasses[\"Multi Channel Association\"])\n@implementedVersion(5)\n@ccValues(MultiChannelAssociationCCValues)\nexport class MultiChannelAssociationCC extends CommandClass {\n\tdeclare ccCommand: MultiChannelAssociationCommand;\n\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// MultiChannelAssociationCC must be interviewed after Z-Wave+ if that is supported\n\t\treturn [\n\t\t\t...super.determineRequiredCCInterviews(),\n\t\t\tCommandClasses[\"Z-Wave Plus Info\"],\n\t\t\t// We need information about endpoints to correctly configure the lifeline associations\n\t\t\tCommandClasses[\"Multi Channel\"],\n\t\t\t// AssociationCC will short-circuit if this CC is supported\n\t\t\tCommandClasses.Association,\n\t\t];\n\t}\n\n\t/**\n\t * Returns the number of association groups reported by the node/endpoint.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getGroupCountCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): number {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMultiChannelAssociationCCValues.groupCount.endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) || 0;\n\t}\n\n\t/**\n\t * Returns the number of nodes an association group supports.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getMaxNodesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t\tgroupId: number,\n\t): number {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMultiChannelAssociationCCValues.maxNodes(groupId).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? 0;\n\t}\n\n\t/**\n\t * Returns all the destinations of all association groups reported by the node/endpoint.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getAllDestinationsCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): ReadonlyMap<number, readonly AssociationAddress[]> {\n\t\tconst ret = new Map<number, AssociationAddress[]>();\n\t\tconst groupCount = this.getGroupCountCached(ctx, endpoint);\n\t\tconst valueDB = ctx.getValueDB(endpoint.nodeId);\n\t\tfor (let i = 1; i <= groupCount; i++) {\n\t\t\tconst groupDestinations: AssociationAddress[] = [];\n\t\t\t// Add all node destinations\n\t\t\tconst nodes = valueDB.getValue<number[]>(\n\t\t\t\tMultiChannelAssociationCCValues.nodeIds(i).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\t\t\tgroupDestinations.push(...nodes.map((nodeId) => ({ nodeId })));\n\t\t\t// And all endpoint destinations\n\t\t\tconst endpoints = valueDB.getValue<EndpointAddress[]>(\n\t\t\t\tMultiChannelAssociationCCValues.endpoints(i).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\t\t\tfor (const ep of endpoints) {\n\t\t\t\tif (typeof ep.endpoint === \"number\") {\n\t\t\t\t\tgroupDestinations.push({\n\t\t\t\t\t\tnodeId: ep.nodeId,\n\t\t\t\t\t\tendpoint: ep.endpoint,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tgroupDestinations.push(\n\t\t\t\t\t\t...ep.endpoint.map((e) => ({\n\t\t\t\t\t\t\tnodeId: ep.nodeId,\n\t\t\t\t\t\t\tendpoint: e,\n\t\t\t\t\t\t})),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tret.set(\n\t\t\t\ti,\n\t\t\t\t// Filter out duplicates\n\t\t\t\tgroupDestinations.filter(\n\t\t\t\t\t(addr, index) =>\n\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t=== groupDestinations.findIndex(\n\t\t\t\t\t\t\t\t({ nodeId, endpoint }) =>\n\t\t\t\t\t\t\t\t\tnodeId === addr.nodeId\n\t\t\t\t\t\t\t\t\t&& endpoint === addr.endpoint,\n\t\t\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst mcAPI = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// First find out how many groups are supported as multi channel\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying number of multi channel association groups...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst mcGroupCount = await mcAPI.getGroupCount();\n\t\tif (mcGroupCount != undefined) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`supports ${mcGroupCount} multi channel association groups`,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t} else {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t\"Querying multi channel association groups timed out, skipping interview...\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// Query each association group for its members\n\t\tawait this.refreshValues(ctx);\n\n\t\t// And set up lifeline associations\n\t\tawait ccUtils.configureLifelineAssociations(ctx, endpoint);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst mcAPI = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\t\tconst assocAPI = CCAPI.create(\n\t\t\tCommandClasses.Association,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tconst mcGroupCount: number = this.getValue(\n\t\t\tctx,\n\t\t\tMultiChannelAssociationCCValues.groupCount,\n\t\t) ?? 0;\n\n\t\t// Some devices report more association groups than multi channel association groups, so we need this info here\n\t\tconst assocGroupCount: number =\n\t\t\tthis.getValue(ctx, AssociationCCValues.groupCount)\n\t\t\t|| mcGroupCount;\n\n\t\t// Then query each multi channel association group\n\t\tfor (let groupId = 1; groupId <= mcGroupCount; groupId++) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`querying multi channel association group #${groupId}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst group = await mcAPI.getGroup(groupId);\n\t\t\tif (!group) continue;\n\t\t\tconst logMessage =\n\t\t\t\t`received information for multi channel association group #${groupId}:\nmaximum # of nodes: ${group.maxNodes}\ncurrently assigned nodes: ${group.nodeIds.map(String).join(\", \")}\ncurrently assigned endpoints: ${\n\t\t\t\t\tgroup.endpoints\n\t\t\t\t\t\t.map(({ nodeId, endpoint }) => {\n\t\t\t\t\t\t\tif (typeof endpoint === \"number\") {\n\t\t\t\t\t\t\t\treturn `${nodeId}:${endpoint}`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn `${nodeId}:[${\n\t\t\t\t\t\t\t\t\tendpoint.map(String).join(\", \")\n\t\t\t\t\t\t\t\t}]`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`;\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\n\t\t// Check if there are more non-multi-channel association groups we haven't queried yet\n\t\tif (assocAPI.isSupported() && assocGroupCount > mcGroupCount) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`querying additional non-multi-channel association groups...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tfor (\n\t\t\t\tlet groupId = mcGroupCount + 1;\n\t\t\t\tgroupId <= assocGroupCount;\n\t\t\t\tgroupId++\n\t\t\t) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `querying association group #${groupId}...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tconst group = await assocAPI.getGroup(groupId);\n\t\t\t\tif (!group) continue;\n\t\t\t\tconst logMessage =\n\t\t\t\t\t`received information for association group #${groupId}:\nmaximum # of nodes: ${group.maxNodes}\ncurrently assigned nodes: ${group.nodeIds.map(String).join(\", \")}`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n// @publicAPI\nexport type MultiChannelAssociationCCSetOptions =\n\t& {\n\t\tgroupId: number;\n\t}\n\t& (\n\t\t| { nodeIds: number[] }\n\t\t| { endpoints: EndpointAddress[] }\n\t\t| { nodeIds: number[]; endpoints: EndpointAddress[] }\n\t);\n\n@CCCommand(MultiChannelAssociationCommand.Set)\n@useSupervision()\nexport class MultiChannelAssociationCCSet extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tif (options.groupId < 1) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.groupId = options.groupId;\n\t\tthis.nodeIds = (\"nodeIds\" in options && options.nodeIds) || [];\n\t\tif (this.nodeIds.some((n) => n < 1 || n > MAX_NODES)) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`All node IDs must be between 1 and ${MAX_NODES}!`,\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.endpoints = (\"endpoints\" in options && options.endpoints)\n\t\t\t|| [];\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(1),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic nodeIds: number[];\n\tpublic endpoints: EndpointAddress[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.groupId]),\n\t\t\tserializeMultiChannelAssociationDestination(\n\t\t\t\tthis.nodeIds,\n\t\t\t\tthis.endpoints,\n\t\t\t),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"group id\": this.groupId,\n\t\t\t\t\"node ids\": this.nodeIds.join(\", \"),\n\t\t\t\tendpoints: endpointAddressesToString(this.endpoints),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCRemoveOptions {\n\t/** The group from which to remove the nodes. If none is specified, the nodes will be removed from all groups. */\n\tgroupId?: number;\n\t/** The nodes to remove. If no nodeIds and no endpoint addresses are specified, ALL nodes will be removed. */\n\tnodeIds?: number[];\n\t/** The single endpoints to remove. If no nodeIds and no endpoint addresses are specified, ALL will be removed. */\n\tendpoints?: EndpointAddress[];\n}\n\n@CCCommand(MultiChannelAssociationCommand.Remove)\n@useSupervision()\nexport class MultiChannelAssociationCCRemove extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCRemoveOptions>,\n\t) {\n\t\tsuper(options);\n\t\t// When removing associations, we allow invalid node IDs.\n\t\t// See GH#3606 - it is possible that those exist.\n\t\tthis.groupId = options.groupId;\n\t\tthis.nodeIds = options.nodeIds;\n\t\tthis.endpoints = options.endpoints;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCRemove {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId: number | undefined = raw.payload[0];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(1),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t});\n\t}\n\n\tpublic groupId?: number;\n\tpublic nodeIds?: number[];\n\tpublic endpoints?: EndpointAddress[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.groupId || 0]),\n\t\t\tserializeMultiChannelAssociationDestination(\n\t\t\t\tthis.nodeIds || [],\n\t\t\t\tthis.endpoints || [],\n\t\t\t),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"group id\": this.groupId || \"(all groups)\",\n\t\t};\n\t\tif (this.nodeIds) {\n\t\t\tmessage[\"node ids\"] = this.nodeIds.join(\", \");\n\t\t}\n\t\tif (this.endpoints) {\n\t\t\tmessage.endpoints = endpointAddressesToString(this.endpoints);\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCReportOptions {\n\tgroupId: number;\n\tmaxNodes: number;\n\tnodeIds: number[];\n\tendpoints: EndpointAddress[];\n\treportsToFollow: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.Report)\n@ccValueProperty(\n\t\"maxNodes\",\n\tMultiChannelAssociationCCValues.maxNodes,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"nodeIds\",\n\tMultiChannelAssociationCCValues.nodeIds,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"endpoints\",\n\tMultiChannelAssociationCCValues.endpoints,\n\t(self) => [self.groupId],\n)\nexport class MultiChannelAssociationCCReport extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.groupId = options.groupId;\n\t\tthis.maxNodes = options.maxNodes;\n\t\tthis.nodeIds = options.nodeIds;\n\t\tthis.endpoints = options.endpoints;\n\t\tthis.reportsToFollow = options.reportsToFollow;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCReport {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst groupId = raw.payload[0];\n\t\tconst maxNodes = raw.payload[1];\n\t\tconst reportsToFollow = raw.payload[2];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(3),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tmaxNodes,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t\treportsToFollow,\n\t\t});\n\t}\n\n\tpublic readonly groupId: number;\n\n\tpublic maxNodes: number;\n\n\tpublic nodeIds: number[];\n\n\tpublic endpoints: EndpointAddress[];\n\n\tpublic reportsToFollow: number;\n\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\t// Distinguish sessions by the association group ID\n\t\treturn { groupId: this.groupId };\n\t}\n\n\tpublic expectMoreMessages(): boolean {\n\t\treturn this.reportsToFollow > 0;\n\t}\n\n\tpublic mergePartialCCs(\n\t\tpartials: MultiChannelAssociationCCReport[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// Concat the list of nodes\n\t\tthis.nodeIds = [...partials, this]\n\t\t\t.map((report) => [...report.nodeIds])\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\t// Concat the list of endpoints\n\t\tthis.endpoints = [...partials, this]\n\t\t\t.map((report) => [...report.endpoints])\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\treturn Promise.resolve();\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst destinations = serializeMultiChannelAssociationDestination(\n\t\t\tthis.nodeIds,\n\t\t\tthis.endpoints,\n\t\t);\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\tthis.groupId,\n\t\t\t\tthis.maxNodes,\n\t\t\t\tthis.reportsToFollow,\n\t\t\t]),\n\t\t\tdestinations,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"group id\": this.groupId,\n\t\t\t\t\"maximum # of nodes\": this.maxNodes,\n\t\t\t\t\"node ids\": this.nodeIds.join(\", \"),\n\t\t\t\tendpoints: endpointAddressesToString(this.endpoints),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCGetOptions {\n\tgroupId: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.Get)\n@expectedCCResponse(MultiChannelAssociationCCReport)\nexport class MultiChannelAssociationCCGet extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tif (options.groupId < 1) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.groupId = options.groupId;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCGet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.groupId]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"group id\": this.groupId },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCSupportedGroupingsReportOptions {\n\tgroupCount: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.SupportedGroupingsReport)\n@ccValueProperty(\"groupCount\", MultiChannelAssociationCCValues.groupCount)\nexport class MultiChannelAssociationCCSupportedGroupingsReport\n\textends MultiChannelAssociationCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<\n\t\t\tMultiChannelAssociationCCSupportedGroupingsReportOptions\n\t\t>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.groupCount = options.groupCount;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCSupportedGroupingsReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupCount = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupCount,\n\t\t});\n\t}\n\n\tpublic readonly groupCount: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.groupCount]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"group count\": this.groupCount },\n\t\t};\n\t}\n}\n\n@CCCommand(MultiChannelAssociationCommand.SupportedGroupingsGet)\n@expectedCCResponse(MultiChannelAssociationCCSupportedGroupingsReport)\nexport class MultiChannelAssociationCCSupportedGroupingsGet\n\textends MultiChannelAssociationCC\n{}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAgBO;AACP,oBAA4C;AAE5C,iBAAqC;AACrC,0BAKO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAIO;AACP,cAAyB;AACzB,2BAAoC;;;;;;;;;;;;;;;;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