@zwave-js/cc 14.0.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AssociationCC.js +1 -1
- package/build/cjs/cc/AssociationCC.js.map +1 -1
- package/build/cjs/cc/CentralSceneCC.js +2 -3
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ClimateControlScheduleCC.js +5 -6
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ClockCC.js +2 -3
- package/build/cjs/cc/ClockCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.js +2 -2
- package/build/cjs/cc/ColorSwitchCC.js.map +1 -1
- package/build/cjs/cc/ConfigurationCC.js +4 -6
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/DoorLockCC.js +1 -1
- package/build/cjs/cc/DoorLockCC.js.map +1 -1
- package/build/cjs/cc/IndicatorCC.js +2 -2
- package/build/cjs/cc/IndicatorCC.js.map +1 -1
- package/build/cjs/cc/IrrigationCC.js +7 -8
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.js +1 -1
- package/build/cjs/cc/MultiChannelCC.js.map +1 -1
- package/build/cjs/cc/NotificationCC.js +1 -1
- package/build/cjs/cc/NotificationCC.js.map +1 -1
- package/build/cjs/cc/ProtectionCC.js +1 -2
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.js +2 -2
- package/build/cjs/cc/Security2CC.js.map +1 -1
- package/build/cjs/cc/SecurityCC.js +1 -1
- package/build/cjs/cc/SecurityCC.js.map +1 -1
- package/build/cjs/cc/SoundSwitchCC.js +1 -1
- package/build/cjs/cc/SoundSwitchCC.js.map +1 -1
- package/build/cjs/cc/ThermostatSetbackCC.js +6 -8
- package/build/cjs/cc/ThermostatSetbackCC.js.map +2 -2
- package/build/cjs/cc/TimeCC.js +2 -3
- package/build/cjs/cc/TimeCC.js.map +2 -2
- package/build/cjs/cc/WakeUpCC.js +1 -1
- package/build/cjs/cc/WakeUpCC.js.map +1 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/cjs/index_browser.d.ts +8 -0
- package/build/cjs/index_browser.js +40 -0
- package/build/cjs/index_browser.js.map +7 -0
- package/build/cjs/lib/API.js +1 -1
- package/build/cjs/lib/API.js.map +1 -1
- package/build/cjs/lib/CommandClass.js +1 -1
- package/build/cjs/lib/CommandClass.js.map +1 -1
- package/build/cjs/lib/EncapsulatingCommandClass.js +1 -1
- package/build/cjs/lib/EncapsulatingCommandClass.js.map +1 -1
- package/build/cjs/lib/Values.d.ts +2 -2
- package/build/cjs/lib/Values.js +9 -9
- package/build/cjs/lib/Values.js.map +3 -3
- package/build/cjs/lib/serializers.d.ts +2 -2
- package/build/cjs/lib/serializers.js +19 -10
- package/build/cjs/lib/serializers.js.map +2 -2
- package/build/cjs/lib/utils.js +1 -1
- package/build/cjs/lib/utils.js.map +1 -1
- package/build/esm/cc/AssociationCC.js +1 -1
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +2 -3
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +7 -7
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.d.ts.map +1 -1
- package/build/esm/cc/ClockCC.js +2 -3
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +2 -2
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +4 -6
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.js +1 -1
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.js +2 -2
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +7 -8
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +1 -1
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.js +1 -1
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +1 -2
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/Security2CC.js +2 -2
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.js +1 -1
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +1 -1
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +10 -12
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/TimeCC.d.ts.map +1 -1
- package/build/esm/cc/TimeCC.js +2 -3
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.js +1 -1
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/index_browser.d.ts +8 -0
- package/build/esm/index_browser.d.ts.map +1 -0
- package/build/esm/index_browser.js +8 -0
- package/build/esm/index_browser.js.map +1 -0
- package/build/esm/lib/API.js +1 -1
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.js +1 -1
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/EncapsulatingCommandClass.js +1 -1
- package/build/esm/lib/EncapsulatingCommandClass.js.map +1 -1
- package/build/esm/lib/Values.d.ts +2 -2
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js +1 -1
- package/build/esm/lib/Values.js.map +1 -1
- package/build/esm/lib/serializers.d.ts +2 -2
- package/build/esm/lib/serializers.d.ts.map +1 -1
- package/build/esm/lib/serializers.js +20 -10
- package/build/esm/lib/serializers.js.map +1 -1
- package/build/esm/lib/utils.js +1 -1
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +8 -7
|
@@ -43,7 +43,7 @@ __export(AssociationCC_exports, {
|
|
|
43
43
|
module.exports = __toCommonJS(AssociationCC_exports);
|
|
44
44
|
var import_safe = require("@zwave-js/core/safe");
|
|
45
45
|
var import_safe2 = require("@zwave-js/shared/safe");
|
|
46
|
-
var import_arrays = require("alcalzone-shared/arrays
|
|
46
|
+
var import_arrays = require("alcalzone-shared/arrays");
|
|
47
47
|
var import_API = require("../lib/API.js");
|
|
48
48
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
49
49
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/AssociationCC.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n\tEndpointId,\n\tMaybeNotKnown,\n\tMessageRecord,\n\tSupervisionResult,\n\tWithAddress,\n} from \"@zwave-js/core/safe\";\nimport {\n\tCommandClasses,\n\tMAX_NODES,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetDeviceConfig,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { distinct } from \"alcalzone-shared/arrays/index.js\";\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 { type AssociationAddress, AssociationCommand } from \"../lib/_Types.js\";\nimport * as ccUtils from \"../lib/utils.js\";\n\nexport const AssociationCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses.Association, {\n\t\t/** Whether the node has a lifeline association */\n\t\t...V.staticProperty(\"hasLifeline\", undefined, { internal: true }),\n\t\t/** How many association groups the node has */\n\t\t...V.staticProperty(\"groupCount\", undefined, { internal: true }),\n\t}),\n\n\t...V.defineDynamicCCValues(CommandClasses.Association, {\n\t\t/** The maximum number of nodes in an association group */\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/** The node IDs currently belonging to an association group */\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}),\n});\n\n// @noSetValueAPI\n\n@API(CommandClasses.Association)\nexport class AssociationCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: AssociationCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase AssociationCommand.Get:\n\t\t\tcase AssociationCommand.Set:\n\t\t\tcase AssociationCommand.Report:\n\t\t\tcase AssociationCommand.Remove:\n\t\t\tcase AssociationCommand.SupportedGroupingsGet:\n\t\t\tcase AssociationCommand.SupportedGroupingsReport:\n\t\t\t\treturn true;\n\t\t\tcase AssociationCommand.SpecificGroupGet:\n\t\t\tcase AssociationCommand.SpecificGroupReport:\n\t\t\t\treturn this.version >= 2;\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\tAssociationCommand,\n\t\t\tAssociationCommand.SupportedGroupingsGet,\n\t\t);\n\n\t\tconst cc = new AssociationCCSupportedGroupingsGet({\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\tAssociationCCSupportedGroupingsReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) return response.groupCount;\n\t}\n\n\t@validateArgs()\n\tpublic async reportGroupCount(groupCount: number): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.SupportedGroupingsReport,\n\t\t);\n\n\t\tconst cc = new AssociationCCSupportedGroupingsReport({\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(AssociationCommand, AssociationCommand.Get);\n\n\t\tconst cc = new AssociationCCGet({\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<AssociationCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\tmaxNodes: response.maxNodes,\n\t\t\t\tnodeIds: response.nodeIds,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\toptions: AssociationCCReportOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.Report,\n\t\t);\n\n\t\tconst cc = new AssociationCCReport({\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 to an association group\n\t */\n\t@validateArgs()\n\tpublic async addNodeIds(\n\t\tgroupId: number,\n\t\t...nodeIds: number[]\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(AssociationCommand, AssociationCommand.Set);\n\n\t\tconst cc = new AssociationCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Removes nodes from an association group\n\t */\n\t@validateArgs()\n\tpublic async removeNodeIds(\n\t\toptions: AssociationCCRemoveOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.Remove,\n\t\t);\n\n\t\t// Validate options\n\t\tif (!options.groupId) {\n\t\t\tif (this.version === 1) {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t`Node ${this.endpoint.nodeId} only supports AssociationCC V1 which requires the group Id to be set`,\n\t\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (options.groupId < 0) {\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\n\t\tconst cc = new AssociationCCRemove({\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 from all association groups\n\t */\n\t@validateArgs()\n\tpublic async removeNodeIdsFromAllGroups(\n\t\tnodeIds: number[],\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.Remove,\n\t\t);\n\n\t\tif (this.version >= 2) {\n\t\t\t// The node supports bulk removal\n\t\t\treturn this.removeNodeIds({ nodeIds, groupId: 0 });\n\t\t} else {\n\t\t\t// We have to remove the node manually from all groups\n\t\t\tconst groupCount = this.tryGetValueDB()?.getValue<number>(\n\t\t\t\tAssociationCCValues.groupCount.endpoint(\n\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t),\n\t\t\t) ?? 0;\n\t\t\tfor (let groupId = 1; groupId <= groupCount; groupId++) {\n\t\t\t\t// TODO: evaluate intermediate supervision results\n\t\t\t\tawait this.removeNodeIds({ nodeIds, groupId });\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Request the association group that represents the most recently detected button press\n\t */\n\t@validateArgs()\n\tpublic async getSpecificGroup(): Promise<number | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.SpecificGroupGet,\n\t\t);\n\n\t\tconst cc = new AssociationCCSpecificGroupGet({\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\tAssociationCCSpecificGroupReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.group;\n\t}\n\n\t/**\n\t * Report the association group that represents the most recently detected button press\n\t */\n\t@validateArgs()\n\tpublic async reportSpecificGroup(\n\t\tgroup: number,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.SpecificGroupReport,\n\t\t);\n\n\t\tconst cc = new AssociationCCSpecificGroupReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroup,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses.Association)\n@implementedVersion(4)\n@ccValues(AssociationCCValues)\nexport class AssociationCC extends CommandClass {\n\tdeclare ccCommand: AssociationCommand;\n\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// AssociationCC 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];\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\tAssociationCCValues.groupCount.endpoint(endpoint.index),\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 & GetDeviceConfig,\n\t\tendpoint: EndpointId,\n\t\tgroupId: number,\n\t): number {\n\t\treturn (\n\t\t\tctx\n\t\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t\t.getValue(\n\t\t\t\t\tAssociationCCValues.maxNodes(groupId).endpoint(\n\t\t\t\t\t\tendpoint.index,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\t// If the information is not available, fall back to the configuration file if possible\n\t\t\t\t// This can happen on some legacy devices which have \"hidden\" association groups\n\t\t\t\t?? ctx\n\t\t\t\t\t.getDeviceConfig?.(endpoint.nodeId)\n\t\t\t\t\t?.getAssociationConfigForEndpoint(endpoint.index, groupId)\n\t\t\t\t\t?.maxNodes\n\t\t\t\t?? 0\n\t\t);\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\t// Add all root destinations\n\t\t\tconst nodes = valueDB.getValue<number[]>(\n\t\t\t\tAssociationCCValues.nodeIds(i).endpoint(endpoint.index),\n\t\t\t) ?? [];\n\n\t\t\tret.set(\n\t\t\t\ti,\n\t\t\t\t// Filter out duplicates\n\t\t\t\tdistinct(nodes).map((nodeId) => ({ nodeId })),\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 api = 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\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// Even if Multi Channel Association is supported, we still need to query the number of\n\t\t// normal association groups since some devices report more association groups than\n\t\t// multi channel association groups\n\n\t\t// Find out how many groups are supported\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying number of association groups...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst groupCount = await api.getGroupCount();\n\t\tif (groupCount != undefined) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `supports ${groupCount} 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 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// Skip the remaining Association CC interview in favor of Multi Channel Association if possible\n\t\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\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`${this.constructor.name}: delaying configuration of lifeline associations until after Multi Channel Association interview...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\tthis.setInterviewComplete(ctx, true);\n\t\t\treturn;\n\t\t}\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 api = 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 groupCount = AssociationCC.getGroupCountCached(\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\n\t\t// Query each association group\n\t\tfor (let groupId = 1; groupId <= groupCount; groupId++) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `querying association group #${groupId}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst group = await api.getGroup(groupId);\n\t\t\tif (group != undefined) {\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 interface AssociationCCSetOptions {\n\tgroupId: number;\n\tnodeIds: number[];\n}\n\n@CCCommand(AssociationCommand.Set)\n@useSupervision()\nexport class AssociationCCSet extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCSetOptions>,\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\tif (options.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.groupId = options.groupId;\n\t\tthis.nodeIds = options.nodeIds;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): AssociationCCSet {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst groupId = raw.payload[0];\n\t\tconst nodeIds = [...raw.payload.subarray(1)];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic nodeIds: number[];\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.groupId, ...this.nodeIds]);\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\t\"node ids\": this.nodeIds.length\n\t\t\t\t? this.nodeIds.join(\", \")\n\t\t\t\t: \"all nodes\",\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 AssociationCCRemoveOptions {\n\t/** The group from which to remove the nodes. If none is specified, the nodes will be removed from all nodes. */\n\tgroupId?: number;\n\t/** The nodes to remove. If none are specified, ALL nodes will be removed. */\n\tnodeIds?: number[];\n}\n\n@CCCommand(AssociationCommand.Remove)\n@useSupervision()\nexport class AssociationCCRemove extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCRemoveOptions>,\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}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): AssociationCCRemove {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\n\t\tlet groupId: number | undefined;\n\t\tif (raw.payload[0] !== 0) {\n\t\t\tgroupId = raw.payload[0];\n\t\t}\n\t\tconst nodeIds = [...raw.payload.subarray(1)];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t});\n\t}\n\n\tpublic groupId?: number;\n\tpublic nodeIds?: number[];\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.groupId || 0,\n\t\t\t...(this.nodeIds || []),\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\t\"node ids\": this.nodeIds && this.nodeIds.length\n\t\t\t\t? this.nodeIds.join(\", \")\n\t\t\t\t: \"all nodes\",\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 AssociationCCReportOptions {\n\tgroupId: number;\n\tmaxNodes: number;\n\tnodeIds: number[];\n\treportsToFollow: number;\n}\n\n@CCCommand(AssociationCommand.Report)\n@ccValueProperty(\n\t\"maxNodes\",\n\tAssociationCCValues.maxNodes,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"nodeIds\",\n\tAssociationCCValues.nodeIds,\n\t(self) => [self.groupId],\n)\nexport class AssociationCCReport extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCReportOptions>,\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.reportsToFollow = options.reportsToFollow;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): AssociationCCReport {\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\t\tconst nodeIds = [...raw.payload.subarray(3)];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tmaxNodes,\n\t\t\treportsToFollow,\n\t\t\tnodeIds,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic maxNodes: number;\n\n\tpublic nodeIds: number[];\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: AssociationCCReport[],\n\t\t_ctx: CCParsingContext,\n\t): 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}\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.groupId,\n\t\t\tthis.maxNodes,\n\t\t\tthis.reportsToFollow,\n\t\t\t...this.nodeIds,\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\"max # of nodes\": this.maxNodes,\n\t\t\t\t\"node IDs\": this.nodeIds.join(\", \"),\n\t\t\t\t\"reports to follow\": this.reportsToFollow,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface AssociationCCGetOptions {\n\tgroupId: number;\n}\n\n@CCCommand(AssociationCommand.Get)\n@expectedCCResponse(AssociationCCReport)\nexport class AssociationCCGet extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCGetOptions>,\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(raw: CCRaw, ctx: CCParsingContext): AssociationCCGet {\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): 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 AssociationCCSupportedGroupingsReportOptions {\n\tgroupCount: number;\n}\n\n@CCCommand(AssociationCommand.SupportedGroupingsReport)\n@ccValueProperty(\"groupCount\", AssociationCCValues.groupCount)\nexport class AssociationCCSupportedGroupingsReport extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCSupportedGroupingsReportOptions>,\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): AssociationCCSupportedGroupingsReport {\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 groupCount: number;\n\n\tpublic serialize(ctx: CCEncodingContext): 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(AssociationCommand.SupportedGroupingsGet)\n@expectedCCResponse(AssociationCCSupportedGroupingsReport)\nexport class AssociationCCSupportedGroupingsGet extends AssociationCC {}\n\n// @publicAPI\nexport interface AssociationCCSpecificGroupReportOptions {\n\tgroup: number;\n}\n\n@CCCommand(AssociationCommand.SpecificGroupReport)\nexport class AssociationCCSpecificGroupReport extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCSpecificGroupReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.group = options.group;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): AssociationCCSpecificGroupReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst group = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroup,\n\t\t});\n\t}\n\n\tpublic group: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.group]);\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: this.group },\n\t\t};\n\t}\n}\n\n@CCCommand(AssociationCommand.SpecificGroupGet)\n@expectedCCResponse(AssociationCCSpecificGroupReport)\nexport class AssociationCCSpecificGroupGet extends AssociationCC {}\n"],
|
|
4
|
+
"sourcesContent": ["import type {\n\tEndpointId,\n\tMaybeNotKnown,\n\tMessageRecord,\n\tSupervisionResult,\n\tWithAddress,\n} from \"@zwave-js/core/safe\";\nimport {\n\tCommandClasses,\n\tMAX_NODES,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetDeviceConfig,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { distinct } from \"alcalzone-shared/arrays\";\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 { type AssociationAddress, AssociationCommand } from \"../lib/_Types.js\";\nimport * as ccUtils from \"../lib/utils.js\";\n\nexport const AssociationCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses.Association, {\n\t\t/** Whether the node has a lifeline association */\n\t\t...V.staticProperty(\"hasLifeline\", undefined, { internal: true }),\n\t\t/** How many association groups the node has */\n\t\t...V.staticProperty(\"groupCount\", undefined, { internal: true }),\n\t}),\n\n\t...V.defineDynamicCCValues(CommandClasses.Association, {\n\t\t/** The maximum number of nodes in an association group */\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/** The node IDs currently belonging to an association group */\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}),\n});\n\n// @noSetValueAPI\n\n@API(CommandClasses.Association)\nexport class AssociationCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: AssociationCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase AssociationCommand.Get:\n\t\t\tcase AssociationCommand.Set:\n\t\t\tcase AssociationCommand.Report:\n\t\t\tcase AssociationCommand.Remove:\n\t\t\tcase AssociationCommand.SupportedGroupingsGet:\n\t\t\tcase AssociationCommand.SupportedGroupingsReport:\n\t\t\t\treturn true;\n\t\t\tcase AssociationCommand.SpecificGroupGet:\n\t\t\tcase AssociationCommand.SpecificGroupReport:\n\t\t\t\treturn this.version >= 2;\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\tAssociationCommand,\n\t\t\tAssociationCommand.SupportedGroupingsGet,\n\t\t);\n\n\t\tconst cc = new AssociationCCSupportedGroupingsGet({\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\tAssociationCCSupportedGroupingsReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) return response.groupCount;\n\t}\n\n\t@validateArgs()\n\tpublic async reportGroupCount(groupCount: number): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.SupportedGroupingsReport,\n\t\t);\n\n\t\tconst cc = new AssociationCCSupportedGroupingsReport({\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(AssociationCommand, AssociationCommand.Get);\n\n\t\tconst cc = new AssociationCCGet({\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<AssociationCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\tmaxNodes: response.maxNodes,\n\t\t\t\tnodeIds: response.nodeIds,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\toptions: AssociationCCReportOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.Report,\n\t\t);\n\n\t\tconst cc = new AssociationCCReport({\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 to an association group\n\t */\n\t@validateArgs()\n\tpublic async addNodeIds(\n\t\tgroupId: number,\n\t\t...nodeIds: number[]\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(AssociationCommand, AssociationCommand.Set);\n\n\t\tconst cc = new AssociationCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Removes nodes from an association group\n\t */\n\t@validateArgs()\n\tpublic async removeNodeIds(\n\t\toptions: AssociationCCRemoveOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.Remove,\n\t\t);\n\n\t\t// Validate options\n\t\tif (!options.groupId) {\n\t\t\tif (this.version === 1) {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t`Node ${this.endpoint.nodeId} only supports AssociationCC V1 which requires the group Id to be set`,\n\t\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (options.groupId < 0) {\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\n\t\tconst cc = new AssociationCCRemove({\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 from all association groups\n\t */\n\t@validateArgs()\n\tpublic async removeNodeIdsFromAllGroups(\n\t\tnodeIds: number[],\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.Remove,\n\t\t);\n\n\t\tif (this.version >= 2) {\n\t\t\t// The node supports bulk removal\n\t\t\treturn this.removeNodeIds({ nodeIds, groupId: 0 });\n\t\t} else {\n\t\t\t// We have to remove the node manually from all groups\n\t\t\tconst groupCount = this.tryGetValueDB()?.getValue<number>(\n\t\t\t\tAssociationCCValues.groupCount.endpoint(\n\t\t\t\t\tthis.endpoint.index,\n\t\t\t\t),\n\t\t\t) ?? 0;\n\t\t\tfor (let groupId = 1; groupId <= groupCount; groupId++) {\n\t\t\t\t// TODO: evaluate intermediate supervision results\n\t\t\t\tawait this.removeNodeIds({ nodeIds, groupId });\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Request the association group that represents the most recently detected button press\n\t */\n\t@validateArgs()\n\tpublic async getSpecificGroup(): Promise<number | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.SpecificGroupGet,\n\t\t);\n\n\t\tconst cc = new AssociationCCSpecificGroupGet({\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\tAssociationCCSpecificGroupReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.group;\n\t}\n\n\t/**\n\t * Report the association group that represents the most recently detected button press\n\t */\n\t@validateArgs()\n\tpublic async reportSpecificGroup(\n\t\tgroup: number,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tAssociationCommand,\n\t\t\tAssociationCommand.SpecificGroupReport,\n\t\t);\n\n\t\tconst cc = new AssociationCCSpecificGroupReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroup,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses.Association)\n@implementedVersion(4)\n@ccValues(AssociationCCValues)\nexport class AssociationCC extends CommandClass {\n\tdeclare ccCommand: AssociationCommand;\n\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// AssociationCC 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];\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\tAssociationCCValues.groupCount.endpoint(endpoint.index),\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 & GetDeviceConfig,\n\t\tendpoint: EndpointId,\n\t\tgroupId: number,\n\t): number {\n\t\treturn (\n\t\t\tctx\n\t\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t\t.getValue(\n\t\t\t\t\tAssociationCCValues.maxNodes(groupId).endpoint(\n\t\t\t\t\t\tendpoint.index,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\t// If the information is not available, fall back to the configuration file if possible\n\t\t\t\t// This can happen on some legacy devices which have \"hidden\" association groups\n\t\t\t\t?? ctx\n\t\t\t\t\t.getDeviceConfig?.(endpoint.nodeId)\n\t\t\t\t\t?.getAssociationConfigForEndpoint(endpoint.index, groupId)\n\t\t\t\t\t?.maxNodes\n\t\t\t\t?? 0\n\t\t);\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\t// Add all root destinations\n\t\t\tconst nodes = valueDB.getValue<number[]>(\n\t\t\t\tAssociationCCValues.nodeIds(i).endpoint(endpoint.index),\n\t\t\t) ?? [];\n\n\t\t\tret.set(\n\t\t\t\ti,\n\t\t\t\t// Filter out duplicates\n\t\t\t\tdistinct(nodes).map((nodeId) => ({ nodeId })),\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 api = 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\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// Even if Multi Channel Association is supported, we still need to query the number of\n\t\t// normal association groups since some devices report more association groups than\n\t\t// multi channel association groups\n\n\t\t// Find out how many groups are supported\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying number of association groups...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst groupCount = await api.getGroupCount();\n\t\tif (groupCount != undefined) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `supports ${groupCount} 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 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// Skip the remaining Association CC interview in favor of Multi Channel Association if possible\n\t\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\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`${this.constructor.name}: delaying configuration of lifeline associations until after Multi Channel Association interview...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\tthis.setInterviewComplete(ctx, true);\n\t\t\treturn;\n\t\t}\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 api = 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 groupCount = AssociationCC.getGroupCountCached(\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\n\t\t// Query each association group\n\t\tfor (let groupId = 1; groupId <= groupCount; groupId++) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `querying association group #${groupId}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst group = await api.getGroup(groupId);\n\t\t\tif (group != undefined) {\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 interface AssociationCCSetOptions {\n\tgroupId: number;\n\tnodeIds: number[];\n}\n\n@CCCommand(AssociationCommand.Set)\n@useSupervision()\nexport class AssociationCCSet extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCSetOptions>,\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\tif (options.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.groupId = options.groupId;\n\t\tthis.nodeIds = options.nodeIds;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): AssociationCCSet {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst groupId = raw.payload[0];\n\t\tconst nodeIds = [...raw.payload.subarray(1)];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic nodeIds: number[];\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.groupId, ...this.nodeIds]);\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\t\"node ids\": this.nodeIds.length\n\t\t\t\t? this.nodeIds.join(\", \")\n\t\t\t\t: \"all nodes\",\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 AssociationCCRemoveOptions {\n\t/** The group from which to remove the nodes. If none is specified, the nodes will be removed from all nodes. */\n\tgroupId?: number;\n\t/** The nodes to remove. If none are specified, ALL nodes will be removed. */\n\tnodeIds?: number[];\n}\n\n@CCCommand(AssociationCommand.Remove)\n@useSupervision()\nexport class AssociationCCRemove extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCRemoveOptions>,\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}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): AssociationCCRemove {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\n\t\tlet groupId: number | undefined;\n\t\tif (raw.payload[0] !== 0) {\n\t\t\tgroupId = raw.payload[0];\n\t\t}\n\t\tconst nodeIds = [...raw.payload.subarray(1)];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t});\n\t}\n\n\tpublic groupId?: number;\n\tpublic nodeIds?: number[];\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.groupId || 0,\n\t\t\t...(this.nodeIds || []),\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\t\"node ids\": this.nodeIds && this.nodeIds.length\n\t\t\t\t? this.nodeIds.join(\", \")\n\t\t\t\t: \"all nodes\",\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 AssociationCCReportOptions {\n\tgroupId: number;\n\tmaxNodes: number;\n\tnodeIds: number[];\n\treportsToFollow: number;\n}\n\n@CCCommand(AssociationCommand.Report)\n@ccValueProperty(\n\t\"maxNodes\",\n\tAssociationCCValues.maxNodes,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"nodeIds\",\n\tAssociationCCValues.nodeIds,\n\t(self) => [self.groupId],\n)\nexport class AssociationCCReport extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCReportOptions>,\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.reportsToFollow = options.reportsToFollow;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): AssociationCCReport {\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\t\tconst nodeIds = [...raw.payload.subarray(3)];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tmaxNodes,\n\t\t\treportsToFollow,\n\t\t\tnodeIds,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic maxNodes: number;\n\n\tpublic nodeIds: number[];\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: AssociationCCReport[],\n\t\t_ctx: CCParsingContext,\n\t): 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}\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.groupId,\n\t\t\tthis.maxNodes,\n\t\t\tthis.reportsToFollow,\n\t\t\t...this.nodeIds,\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\"max # of nodes\": this.maxNodes,\n\t\t\t\t\"node IDs\": this.nodeIds.join(\", \"),\n\t\t\t\t\"reports to follow\": this.reportsToFollow,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface AssociationCCGetOptions {\n\tgroupId: number;\n}\n\n@CCCommand(AssociationCommand.Get)\n@expectedCCResponse(AssociationCCReport)\nexport class AssociationCCGet extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCGetOptions>,\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(raw: CCRaw, ctx: CCParsingContext): AssociationCCGet {\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): 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 AssociationCCSupportedGroupingsReportOptions {\n\tgroupCount: number;\n}\n\n@CCCommand(AssociationCommand.SupportedGroupingsReport)\n@ccValueProperty(\"groupCount\", AssociationCCValues.groupCount)\nexport class AssociationCCSupportedGroupingsReport extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCSupportedGroupingsReportOptions>,\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): AssociationCCSupportedGroupingsReport {\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 groupCount: number;\n\n\tpublic serialize(ctx: CCEncodingContext): 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(AssociationCommand.SupportedGroupingsGet)\n@expectedCCResponse(AssociationCCSupportedGroupingsReport)\nexport class AssociationCCSupportedGroupingsGet extends AssociationCC {}\n\n// @publicAPI\nexport interface AssociationCCSpecificGroupReportOptions {\n\tgroup: number;\n}\n\n@CCCommand(AssociationCommand.SpecificGroupReport)\nexport class AssociationCCSpecificGroupReport extends AssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<AssociationCCSpecificGroupReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.group = options.group;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): AssociationCCSpecificGroupReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst group = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroup,\n\t\t});\n\t}\n\n\tpublic group: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.group]);\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: this.group },\n\t\t};\n\t}\n}\n\n@CCCommand(AssociationCommand.SpecificGroupGet)\n@expectedCCResponse(AssociationCCSpecificGroupReport)\nexport class AssociationCCSpecificGroupGet extends AssociationCC {}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,kBAQO;AAOP,IAAAA,eAAsB;AAEtB,oBAAyB;AACzB,iBAAqC;AACrC,0BAKO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAA4D;AAC5D,cAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElB,MAAM,sBAAsB,OAAO,OAAO;EAChD,GAAG,gBAAE,qBAAqB,2BAAe,aAAa;;IAErD,GAAG,gBAAE,eAAe,eAAe,QAAW,EAAE,UAAU,KAAI,CAAE;;IAEhE,GAAG,gBAAE,eAAe,cAAc,QAAW,EAAE,UAAU,KAAI,CAAE;GAC/D;EAED,GAAG,gBAAE,sBAAsB,2BAAe,aAAa;;IAEtD,GAAG,gBAAE,8BACJ,YACA,YACA,CAAC,YAAoB,SACrB,CAAC,EAAE,UAAU,YAAW,MACvB,aAAa,cAAc,OAAO,gBAAgB,UACnD,QACA,EAAE,UAAU,KAAI,CAAE;;IAGnB,GAAG,gBAAE,8BACJ,WACA,WACA,CAAC,YAAoB,SACrB,CAAC,EAAE,UAAU,YAAW,MACvB,aAAa,aAAa,OAAO,gBAAgB,UAClD,QACA,EAAE,UAAU,KAAI,CAAE;GAEnB;CACD;IAKY,oBAAgB,MAAA;8BAD5B,mCAAI,2BAAe,WAAW,CAAC;;;;oBACM;wCAAA,YAAa;;;;;;AAAnD,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA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AAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IACZ,YACC,SAA6D;AAE7D,YAAM,OAAO;AAEb,WAAK,QAAQ,QAAQ;IACtB;IAEO,OAAO,KACb,KACA,KAAqB;AAErB,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,QAAQ,IAAI,QAAQ,CAAC;AAE3B,aAAO,IAAI,KAAK;QACf,QAAQ,IAAI;QACZ;OACA;IACF;IAEO;IAEA,UAAU,KAAsB;AACtC,WAAK,UAAU,mBAAM,KAAK,CAAC,KAAK,KAAK,CAAC;AACtC,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,OAAO,KAAK,MAAK;;IAE9B;;;;IAKY,iCAA6B,MAAA;8BAFzC,yCAAU,gCAAmB,gBAAgB,OAC7C,kDAAmB,gCAAgC,CAAC;;;;oBACF;qDAAA,YAAa;;;;;;AAAhE,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
|
|
6
6
|
"names": ["import_safe", "AssociationCC"]
|
|
7
7
|
}
|
|
@@ -42,7 +42,6 @@ module.exports = __toCommonJS(CentralSceneCC_exports);
|
|
|
42
42
|
var import_safe = require("@zwave-js/core/safe");
|
|
43
43
|
var import_safe2 = require("@zwave-js/shared/safe");
|
|
44
44
|
var import_safe3 = require("@zwave-js/shared/safe");
|
|
45
|
-
var import_strings = require("alcalzone-shared/strings/index.js");
|
|
46
45
|
var import_API = require("../lib/API.js");
|
|
47
46
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
48
47
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
@@ -118,9 +117,9 @@ const CentralSceneCCValues = Object.freeze({
|
|
|
118
117
|
})
|
|
119
118
|
}),
|
|
120
119
|
...import_Values.V.defineDynamicCCValues(import_safe.CommandClasses["Central Scene"], {
|
|
121
|
-
...import_Values.V.dynamicPropertyAndKeyWithName("scene", "scene", (sceneNumber) =>
|
|
120
|
+
...import_Values.V.dynamicPropertyAndKeyWithName("scene", "scene", (sceneNumber) => sceneNumber.toString().padStart(3, "0"), ({ property, propertyKey }) => property === "scene" && typeof propertyKey === "string" && /^\d{3}$/.test(propertyKey), (sceneNumber) => ({
|
|
122
121
|
...import_safe.ValueMetadata.ReadOnlyUInt8,
|
|
123
|
-
label: `Scene ${
|
|
122
|
+
label: `Scene ${sceneNumber.toString().padStart(3, "0")}`
|
|
124
123
|
}), { stateful: false })
|
|
125
124
|
})
|
|
126
125
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/CentralSceneCC.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tCommandClasses,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tenumValuesToMetadataStates,\n\tgetCCName,\n\tmaybeUnknownToString,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { getEnumMemberName, pick } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { padStart } from \"alcalzone-shared/strings/index.js\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\ttype SetValueImplementation,\n\tthrowUnsupportedProperty,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\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 { CentralSceneCommand, CentralSceneKeys } from \"../lib/_Types.js\";\nimport * as ccUtils from \"../lib/utils.js\";\n\nexport const CentralSceneCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses[\"Central Scene\"], {\n\t\t...V.staticProperty(\"sceneCount\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t\t...V.staticProperty(\"supportsSlowRefresh\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t\t...V.staticProperty(\"supportedKeyAttributes\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\n\t\t...V.staticProperty(\n\t\t\t\"slowRefresh\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Boolean,\n\t\t\t\tlabel: \"Send held down notifications at a slow rate\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"When this is true, KeyHeldDown notifications are sent every 55s. When this is false, the notifications are sent every 200ms.\",\n\t\t\t} as const,\n\t\t),\n\t}),\n\n\t...V.defineDynamicCCValues(CommandClasses[\"Central Scene\"], {\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"scene\",\n\t\t\t\"scene\",\n\t\t\t(sceneNumber: number) => padStart(sceneNumber.toString(), 3, \"0\"),\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"scene\"\n\t\t\t\t&& typeof propertyKey === \"string\"\n\t\t\t\t&& /^\\d{3}$/.test(propertyKey),\n\t\t\t(sceneNumber: number) => ({\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tlabel: `Scene ${padStart(sceneNumber.toString(), 3, \"0\")}`,\n\t\t\t} as const),\n\t\t\t{ stateful: false } as const,\n\t\t),\n\t}),\n});\n\n@API(CommandClasses[\"Central Scene\"])\nexport class CentralSceneCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: CentralSceneCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase CentralSceneCommand.SupportedGet:\n\t\t\t\treturn this.isSinglecast(); // this is mandatory\n\t\t\tcase CentralSceneCommand.ConfigurationGet:\n\t\t\t\treturn this.version >= 3 && this.isSinglecast();\n\t\t\tcase CentralSceneCommand.ConfigurationSet:\n\t\t\t\treturn this.version >= 3;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getSupported() {\n\t\tthis.assertSupportsCommand(\n\t\t\tCentralSceneCommand,\n\t\t\tCentralSceneCommand.SupportedGet,\n\t\t);\n\n\t\tconst cc = new CentralSceneCCSupportedGet({\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\tCentralSceneCCSupportedReport\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\"sceneCount\",\n\t\t\t\t\"supportsSlowRefresh\",\n\t\t\t\t\"supportedKeyAttributes\",\n\t\t\t]);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getConfiguration() {\n\t\tthis.assertSupportsCommand(\n\t\t\tCentralSceneCommand,\n\t\t\tCentralSceneCommand.ConfigurationGet,\n\t\t);\n\n\t\tconst cc = new CentralSceneCCConfigurationGet({\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\tCentralSceneCCConfigurationReport\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, [\"slowRefresh\"]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async setConfiguration(\n\t\tslowRefresh: boolean,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tCentralSceneCommand,\n\t\t\tCentralSceneCommand.ConfigurationSet,\n\t\t);\n\n\t\tconst cc = new CentralSceneCCConfigurationSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tslowRefresh,\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(this: CentralSceneCCAPI, { property }, value) {\n\t\t\tif (property !== \"slowRefresh\") {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t\tif (typeof value !== \"boolean\") {\n\t\t\t\tthrowWrongValueType(\n\t\t\t\t\tthis.ccId,\n\t\t\t\t\tproperty,\n\t\t\t\t\t\"boolean\",\n\t\t\t\t\ttypeof value,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn this.setConfiguration(value);\n\t\t};\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: CentralSceneCCAPI, { property }) {\n\t\t\tif (property === \"slowRefresh\") {\n\t\t\t\treturn (await this.getConfiguration())?.[property];\n\t\t\t}\n\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Central Scene\"])\n@implementedVersion(3)\n@ccValues(CentralSceneCCValues)\nexport class CentralSceneCC extends CommandClass {\n\tdeclare ccCommand: CentralSceneCommand;\n\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\treturn [\n\t\t\t...super.determineRequiredCCInterviews(),\n\t\t\tCommandClasses.Association,\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tCommandClasses[\"Association Group Information\"],\n\t\t];\n\t}\n\n\tpublic skipEndpointInterview(): boolean {\n\t\t// Central scene notifications are issued by the root device\n\t\treturn true;\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 api = CCAPI.create(\n\t\t\tCommandClasses[\"Central Scene\"],\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\t// If one Association group issues CentralScene notifications,\n\t\t// we must associate ourselves with that channel\n\t\ttry {\n\t\t\tawait ccUtils.assignLifelineIssueingCommand(\n\t\t\t\tctx,\n\t\t\t\tendpoint,\n\t\t\t\tthis.ccId,\n\t\t\t\tCentralSceneCommand.Notification,\n\t\t\t);\n\t\t} catch {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: endpoint.index,\n\t\t\t\tmessage: `Configuring associations to receive ${\n\t\t\t\t\tgetCCName(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t)\n\t\t\t\t} commands failed!`,\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t}\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"Querying supported scenes...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst ccSupported = await api.getSupported();\n\t\tif (ccSupported) {\n\t\t\tconst logMessage = `received supported scenes:\n# of scenes: ${ccSupported.sceneCount}\nsupports slow refresh: ${ccSupported.supportsSlowRefresh}`;\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} 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 supported scenes 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// The slow refresh capability should be enabled whenever possible\n\t\tif (api.version >= 3 && ccSupported?.supportsSlowRefresh) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"Enabling slow refresh capability...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tawait api.setConfiguration(true);\n\t\t}\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n}\n\n// @publicAPI\nexport interface CentralSceneCCNotificationOptions {\n\tsequenceNumber: number;\n\tkeyAttribute: CentralSceneKeys;\n\tsceneNumber: number;\n\tslowRefresh?: boolean;\n}\n\n@CCCommand(CentralSceneCommand.Notification)\nexport class CentralSceneCCNotification extends CentralSceneCC {\n\tpublic constructor(\n\t\toptions: WithAddress<CentralSceneCCNotificationOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.sequenceNumber = options.sequenceNumber;\n\t\tthis.keyAttribute = options.keyAttribute;\n\t\tthis.sceneNumber = options.sceneNumber;\n\t\tthis.slowRefresh = options.slowRefresh;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CentralSceneCCNotification {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst sequenceNumber = raw.payload[0];\n\t\tconst keyAttribute: CentralSceneKeys = raw.payload[1] & 0b111;\n\t\tconst sceneNumber = raw.payload[2];\n\t\tlet slowRefresh: boolean | undefined;\n\t\tif (keyAttribute === CentralSceneKeys.KeyHeldDown) {\n\t\t\t// A receiving node MUST ignore this field if the command is not\n\t\t\t// carrying the Key Held Down key attribute.\n\t\t\tslowRefresh = !!(raw.payload[1] & 0b1000_0000);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsequenceNumber,\n\t\t\tkeyAttribute,\n\t\t\tsceneNumber,\n\t\t\tslowRefresh,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// In case the interview is not yet completed, we still create some basic metadata\n\t\tconst sceneValue = CentralSceneCCValues.scene(this.sceneNumber);\n\t\tthis.ensureMetadata(ctx, sceneValue);\n\n\t\t// The spec behavior is pretty complicated, so we cannot just store\n\t\t// the value and call it a day. Handling of these notifications will\n\t\t// happen in the receiving node class\n\n\t\treturn true;\n\t}\n\n\tpublic readonly sequenceNumber: number;\n\tpublic readonly keyAttribute: CentralSceneKeys;\n\tpublic readonly sceneNumber: number;\n\tpublic readonly slowRefresh: boolean | undefined;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"sequence number\": this.sequenceNumber,\n\t\t\t\"key attribute\": getEnumMemberName(\n\t\t\t\tCentralSceneKeys,\n\t\t\t\tthis.keyAttribute,\n\t\t\t),\n\t\t\t\"scene number\": this.sceneNumber,\n\t\t};\n\t\tif (this.slowRefresh != undefined) {\n\t\t\tmessage[\"slow refresh\"] = this.slowRefresh;\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 CentralSceneCCSupportedReportOptions {\n\tsceneCount: number;\n\tsupportsSlowRefresh: MaybeNotKnown<boolean>;\n\tsupportedKeyAttributes: Record<number, readonly CentralSceneKeys[]>;\n}\n\n@CCCommand(CentralSceneCommand.SupportedReport)\n@ccValueProperty(\"sceneCount\", CentralSceneCCValues.sceneCount)\n@ccValueProperty(\n\t\"supportsSlowRefresh\",\n\tCentralSceneCCValues.supportsSlowRefresh,\n)\n@ccValueProperty(\n\t\"supportedKeyAttributes\",\n\tCentralSceneCCValues.supportedKeyAttributes,\n)\nexport class CentralSceneCCSupportedReport extends CentralSceneCC {\n\tpublic constructor(\n\t\toptions: WithAddress<CentralSceneCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.sceneCount = options.sceneCount;\n\t\tthis.supportsSlowRefresh = options.supportsSlowRefresh;\n\t\tfor (\n\t\t\tconst [scene, keys] of Object.entries(\n\t\t\t\toptions.supportedKeyAttributes,\n\t\t\t)\n\t\t) {\n\t\t\tthis._supportedKeyAttributes.set(\n\t\t\t\tparseInt(scene),\n\t\t\t\tkeys,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CentralSceneCCSupportedReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst sceneCount = raw.payload[0];\n\t\tconst supportsSlowRefresh: MaybeNotKnown<boolean> =\n\t\t\t!!(raw.payload[1] & 0b1000_0000);\n\t\tconst bitMaskBytes = (raw.payload[1] & 0b110) >>> 1;\n\t\tconst identicalKeyAttributes = !!(raw.payload[1] & 0b1);\n\t\tconst numEntries = identicalKeyAttributes ? 1 : sceneCount;\n\t\tvalidatePayload(raw.payload.length >= 2 + bitMaskBytes * numEntries);\n\t\tconst supportedKeyAttributes: Record<\n\t\t\tnumber,\n\t\t\treadonly CentralSceneKeys[]\n\t\t> = {};\n\t\tfor (let i = 0; i < numEntries; i++) {\n\t\t\tconst mask = raw.payload.subarray(\n\t\t\t\t2 + i * bitMaskBytes,\n\t\t\t\t2 + (i + 1) * bitMaskBytes,\n\t\t\t);\n\t\t\tsupportedKeyAttributes[i + 1] = parseBitMask(\n\t\t\t\tmask,\n\t\t\t\tCentralSceneKeys.KeyPressed,\n\t\t\t);\n\t\t}\n\n\t\tif (identicalKeyAttributes) {\n\t\t\t// The key attributes are only transmitted for scene 1, copy them to the others\n\t\t\tfor (let i = 2; i <= sceneCount; i++) {\n\t\t\t\tsupportedKeyAttributes[i] = supportedKeyAttributes[1];\n\t\t\t}\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsceneCount,\n\t\t\tsupportsSlowRefresh,\n\t\t\tsupportedKeyAttributes,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Create/extend metadata for all scenes\n\t\tfor (let i = 1; i <= this.sceneCount; i++) {\n\t\t\tconst sceneValue = CentralSceneCCValues.scene(i);\n\t\t\tthis.setMetadata(ctx, sceneValue, {\n\t\t\t\t...sceneValue.meta,\n\t\t\t\tstates: enumValuesToMetadataStates(\n\t\t\t\t\tCentralSceneKeys,\n\t\t\t\t\tthis._supportedKeyAttributes.get(i),\n\t\t\t\t),\n\t\t\t});\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic readonly sceneCount: number;\n\n\t// TODO: Only offer `slowRefresh` if this is true\n\n\tpublic readonly supportsSlowRefresh: MaybeNotKnown<boolean>;\n\n\tprivate _supportedKeyAttributes = new Map<\n\t\tnumber,\n\t\treadonly CentralSceneKeys[]\n\t>();\n\n\tpublic get supportedKeyAttributes(): ReadonlyMap<\n\t\tnumber,\n\t\treadonly CentralSceneKeys[]\n\t> {\n\t\treturn this._supportedKeyAttributes;\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"scene count\": this.sceneCount,\n\t\t\t\"supports slow refresh\": maybeUnknownToString(\n\t\t\t\tthis.supportsSlowRefresh,\n\t\t\t),\n\t\t};\n\t\tfor (const [scene, keys] of this.supportedKeyAttributes) {\n\t\t\tmessage[`supported attributes (scene #${scene})`] = keys\n\t\t\t\t.map((k) => `\\n\u00B7 ${getEnumMemberName(CentralSceneKeys, k)}`)\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(CentralSceneCommand.SupportedGet)\n@expectedCCResponse(CentralSceneCCSupportedReport)\nexport class CentralSceneCCSupportedGet extends CentralSceneCC {}\n\n// @publicAPI\nexport interface CentralSceneCCConfigurationReportOptions {\n\tslowRefresh: boolean;\n}\n\n@CCCommand(CentralSceneCommand.ConfigurationReport)\n@ccValueProperty(\"slowRefresh\", CentralSceneCCValues.slowRefresh)\nexport class CentralSceneCCConfigurationReport extends CentralSceneCC {\n\tpublic constructor(\n\t\toptions: WithAddress<CentralSceneCCConfigurationReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.slowRefresh = options.slowRefresh;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CentralSceneCCConfigurationReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst slowRefresh = !!(raw.payload[0] & 0b1000_0000);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tslowRefresh,\n\t\t});\n\t}\n\n\tpublic readonly slowRefresh: boolean;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"slow refresh\": this.slowRefresh },\n\t\t};\n\t}\n}\n\n@CCCommand(CentralSceneCommand.ConfigurationGet)\n@expectedCCResponse(CentralSceneCCConfigurationReport)\nexport class CentralSceneCCConfigurationGet extends CentralSceneCC {}\n\n// @publicAPI\nexport interface CentralSceneCCConfigurationSetOptions {\n\tslowRefresh: boolean;\n}\n\n@CCCommand(CentralSceneCommand.ConfigurationSet)\n@useSupervision()\nexport class CentralSceneCCConfigurationSet extends CentralSceneCC {\n\tpublic constructor(\n\t\toptions: WithAddress<CentralSceneCCConfigurationSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.slowRefresh = options.slowRefresh;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): CentralSceneCCConfigurationSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new CentralSceneCCConfigurationSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic slowRefresh: boolean;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.slowRefresh ? 0b1000_0000 : 0]);\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: { \"slow refresh\": this.slowRefresh },\n\t\t};\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAgBO;AAMP,IAAAA,eAAsB;AACtB,IAAAA,eAAwC;AAExC,
|
|
4
|
+
"sourcesContent": ["import {\n\tCommandClasses,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tenumValuesToMetadataStates,\n\tgetCCName,\n\tmaybeUnknownToString,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { getEnumMemberName, pick } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\ttype PollValueImplementation,\n\tSET_VALUE,\n\ttype SetValueImplementation,\n\tthrowUnsupportedProperty,\n\tthrowWrongValueType,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\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 { CentralSceneCommand, CentralSceneKeys } from \"../lib/_Types.js\";\nimport * as ccUtils from \"../lib/utils.js\";\n\nexport const CentralSceneCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses[\"Central Scene\"], {\n\t\t...V.staticProperty(\"sceneCount\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t\t...V.staticProperty(\"supportsSlowRefresh\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\t\t...V.staticProperty(\"supportedKeyAttributes\", undefined, {\n\t\t\tinternal: true,\n\t\t}),\n\n\t\t...V.staticProperty(\n\t\t\t\"slowRefresh\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Boolean,\n\t\t\t\tlabel: \"Send held down notifications at a slow rate\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"When this is true, KeyHeldDown notifications are sent every 55s. When this is false, the notifications are sent every 200ms.\",\n\t\t\t} as const,\n\t\t),\n\t}),\n\n\t...V.defineDynamicCCValues(CommandClasses[\"Central Scene\"], {\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"scene\",\n\t\t\t\"scene\",\n\t\t\t(sceneNumber: number) => sceneNumber.toString().padStart(3, \"0\"),\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"scene\"\n\t\t\t\t&& typeof propertyKey === \"string\"\n\t\t\t\t&& /^\\d{3}$/.test(propertyKey),\n\t\t\t(sceneNumber: number) => ({\n\t\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\t\tlabel: `Scene ${sceneNumber.toString().padStart(3, \"0\")}`,\n\t\t\t} as const),\n\t\t\t{ stateful: false } as const,\n\t\t),\n\t}),\n});\n\n@API(CommandClasses[\"Central Scene\"])\nexport class CentralSceneCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: CentralSceneCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase CentralSceneCommand.SupportedGet:\n\t\t\t\treturn this.isSinglecast(); // this is mandatory\n\t\t\tcase CentralSceneCommand.ConfigurationGet:\n\t\t\t\treturn this.version >= 3 && this.isSinglecast();\n\t\t\tcase CentralSceneCommand.ConfigurationSet:\n\t\t\t\treturn this.version >= 3;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getSupported() {\n\t\tthis.assertSupportsCommand(\n\t\t\tCentralSceneCommand,\n\t\t\tCentralSceneCommand.SupportedGet,\n\t\t);\n\n\t\tconst cc = new CentralSceneCCSupportedGet({\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\tCentralSceneCCSupportedReport\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\"sceneCount\",\n\t\t\t\t\"supportsSlowRefresh\",\n\t\t\t\t\"supportedKeyAttributes\",\n\t\t\t]);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getConfiguration() {\n\t\tthis.assertSupportsCommand(\n\t\t\tCentralSceneCommand,\n\t\t\tCentralSceneCommand.ConfigurationGet,\n\t\t);\n\n\t\tconst cc = new CentralSceneCCConfigurationGet({\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\tCentralSceneCCConfigurationReport\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, [\"slowRefresh\"]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async setConfiguration(\n\t\tslowRefresh: boolean,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tCentralSceneCommand,\n\t\t\tCentralSceneCommand.ConfigurationSet,\n\t\t);\n\n\t\tconst cc = new CentralSceneCCConfigurationSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tslowRefresh,\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(this: CentralSceneCCAPI, { property }, value) {\n\t\t\tif (property !== \"slowRefresh\") {\n\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t\tif (typeof value !== \"boolean\") {\n\t\t\t\tthrowWrongValueType(\n\t\t\t\t\tthis.ccId,\n\t\t\t\t\tproperty,\n\t\t\t\t\t\"boolean\",\n\t\t\t\t\ttypeof value,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn this.setConfiguration(value);\n\t\t};\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: CentralSceneCCAPI, { property }) {\n\t\t\tif (property === \"slowRefresh\") {\n\t\t\t\treturn (await this.getConfiguration())?.[property];\n\t\t\t}\n\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t};\n\t}\n}\n\n@commandClass(CommandClasses[\"Central Scene\"])\n@implementedVersion(3)\n@ccValues(CentralSceneCCValues)\nexport class CentralSceneCC extends CommandClass {\n\tdeclare ccCommand: CentralSceneCommand;\n\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\treturn [\n\t\t\t...super.determineRequiredCCInterviews(),\n\t\t\tCommandClasses.Association,\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tCommandClasses[\"Association Group Information\"],\n\t\t];\n\t}\n\n\tpublic skipEndpointInterview(): boolean {\n\t\t// Central scene notifications are issued by the root device\n\t\treturn true;\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 api = CCAPI.create(\n\t\t\tCommandClasses[\"Central Scene\"],\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\t// If one Association group issues CentralScene notifications,\n\t\t// we must associate ourselves with that channel\n\t\ttry {\n\t\t\tawait ccUtils.assignLifelineIssueingCommand(\n\t\t\t\tctx,\n\t\t\t\tendpoint,\n\t\t\t\tthis.ccId,\n\t\t\t\tCentralSceneCommand.Notification,\n\t\t\t);\n\t\t} catch {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: endpoint.index,\n\t\t\t\tmessage: `Configuring associations to receive ${\n\t\t\t\t\tgetCCName(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t)\n\t\t\t\t} commands failed!`,\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t}\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"Querying supported scenes...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst ccSupported = await api.getSupported();\n\t\tif (ccSupported) {\n\t\t\tconst logMessage = `received supported scenes:\n# of scenes: ${ccSupported.sceneCount}\nsupports slow refresh: ${ccSupported.supportsSlowRefresh}`;\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} 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 supported scenes 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// The slow refresh capability should be enabled whenever possible\n\t\tif (api.version >= 3 && ccSupported?.supportsSlowRefresh) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"Enabling slow refresh capability...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tawait api.setConfiguration(true);\n\t\t}\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n}\n\n// @publicAPI\nexport interface CentralSceneCCNotificationOptions {\n\tsequenceNumber: number;\n\tkeyAttribute: CentralSceneKeys;\n\tsceneNumber: number;\n\tslowRefresh?: boolean;\n}\n\n@CCCommand(CentralSceneCommand.Notification)\nexport class CentralSceneCCNotification extends CentralSceneCC {\n\tpublic constructor(\n\t\toptions: WithAddress<CentralSceneCCNotificationOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.sequenceNumber = options.sequenceNumber;\n\t\tthis.keyAttribute = options.keyAttribute;\n\t\tthis.sceneNumber = options.sceneNumber;\n\t\tthis.slowRefresh = options.slowRefresh;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CentralSceneCCNotification {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst sequenceNumber = raw.payload[0];\n\t\tconst keyAttribute: CentralSceneKeys = raw.payload[1] & 0b111;\n\t\tconst sceneNumber = raw.payload[2];\n\t\tlet slowRefresh: boolean | undefined;\n\t\tif (keyAttribute === CentralSceneKeys.KeyHeldDown) {\n\t\t\t// A receiving node MUST ignore this field if the command is not\n\t\t\t// carrying the Key Held Down key attribute.\n\t\t\tslowRefresh = !!(raw.payload[1] & 0b1000_0000);\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsequenceNumber,\n\t\t\tkeyAttribute,\n\t\t\tsceneNumber,\n\t\t\tslowRefresh,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// In case the interview is not yet completed, we still create some basic metadata\n\t\tconst sceneValue = CentralSceneCCValues.scene(this.sceneNumber);\n\t\tthis.ensureMetadata(ctx, sceneValue);\n\n\t\t// The spec behavior is pretty complicated, so we cannot just store\n\t\t// the value and call it a day. Handling of these notifications will\n\t\t// happen in the receiving node class\n\n\t\treturn true;\n\t}\n\n\tpublic readonly sequenceNumber: number;\n\tpublic readonly keyAttribute: CentralSceneKeys;\n\tpublic readonly sceneNumber: number;\n\tpublic readonly slowRefresh: boolean | undefined;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"sequence number\": this.sequenceNumber,\n\t\t\t\"key attribute\": getEnumMemberName(\n\t\t\t\tCentralSceneKeys,\n\t\t\t\tthis.keyAttribute,\n\t\t\t),\n\t\t\t\"scene number\": this.sceneNumber,\n\t\t};\n\t\tif (this.slowRefresh != undefined) {\n\t\t\tmessage[\"slow refresh\"] = this.slowRefresh;\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 CentralSceneCCSupportedReportOptions {\n\tsceneCount: number;\n\tsupportsSlowRefresh: MaybeNotKnown<boolean>;\n\tsupportedKeyAttributes: Record<number, readonly CentralSceneKeys[]>;\n}\n\n@CCCommand(CentralSceneCommand.SupportedReport)\n@ccValueProperty(\"sceneCount\", CentralSceneCCValues.sceneCount)\n@ccValueProperty(\n\t\"supportsSlowRefresh\",\n\tCentralSceneCCValues.supportsSlowRefresh,\n)\n@ccValueProperty(\n\t\"supportedKeyAttributes\",\n\tCentralSceneCCValues.supportedKeyAttributes,\n)\nexport class CentralSceneCCSupportedReport extends CentralSceneCC {\n\tpublic constructor(\n\t\toptions: WithAddress<CentralSceneCCSupportedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.sceneCount = options.sceneCount;\n\t\tthis.supportsSlowRefresh = options.supportsSlowRefresh;\n\t\tfor (\n\t\t\tconst [scene, keys] of Object.entries(\n\t\t\t\toptions.supportedKeyAttributes,\n\t\t\t)\n\t\t) {\n\t\t\tthis._supportedKeyAttributes.set(\n\t\t\t\tparseInt(scene),\n\t\t\t\tkeys,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CentralSceneCCSupportedReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst sceneCount = raw.payload[0];\n\t\tconst supportsSlowRefresh: MaybeNotKnown<boolean> =\n\t\t\t!!(raw.payload[1] & 0b1000_0000);\n\t\tconst bitMaskBytes = (raw.payload[1] & 0b110) >>> 1;\n\t\tconst identicalKeyAttributes = !!(raw.payload[1] & 0b1);\n\t\tconst numEntries = identicalKeyAttributes ? 1 : sceneCount;\n\t\tvalidatePayload(raw.payload.length >= 2 + bitMaskBytes * numEntries);\n\t\tconst supportedKeyAttributes: Record<\n\t\t\tnumber,\n\t\t\treadonly CentralSceneKeys[]\n\t\t> = {};\n\t\tfor (let i = 0; i < numEntries; i++) {\n\t\t\tconst mask = raw.payload.subarray(\n\t\t\t\t2 + i * bitMaskBytes,\n\t\t\t\t2 + (i + 1) * bitMaskBytes,\n\t\t\t);\n\t\t\tsupportedKeyAttributes[i + 1] = parseBitMask(\n\t\t\t\tmask,\n\t\t\t\tCentralSceneKeys.KeyPressed,\n\t\t\t);\n\t\t}\n\n\t\tif (identicalKeyAttributes) {\n\t\t\t// The key attributes are only transmitted for scene 1, copy them to the others\n\t\t\tfor (let i = 2; i <= sceneCount; i++) {\n\t\t\t\tsupportedKeyAttributes[i] = supportedKeyAttributes[1];\n\t\t\t}\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tsceneCount,\n\t\t\tsupportsSlowRefresh,\n\t\t\tsupportedKeyAttributes,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Create/extend metadata for all scenes\n\t\tfor (let i = 1; i <= this.sceneCount; i++) {\n\t\t\tconst sceneValue = CentralSceneCCValues.scene(i);\n\t\t\tthis.setMetadata(ctx, sceneValue, {\n\t\t\t\t...sceneValue.meta,\n\t\t\t\tstates: enumValuesToMetadataStates(\n\t\t\t\t\tCentralSceneKeys,\n\t\t\t\t\tthis._supportedKeyAttributes.get(i),\n\t\t\t\t),\n\t\t\t});\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic readonly sceneCount: number;\n\n\t// TODO: Only offer `slowRefresh` if this is true\n\n\tpublic readonly supportsSlowRefresh: MaybeNotKnown<boolean>;\n\n\tprivate _supportedKeyAttributes = new Map<\n\t\tnumber,\n\t\treadonly CentralSceneKeys[]\n\t>();\n\n\tpublic get supportedKeyAttributes(): ReadonlyMap<\n\t\tnumber,\n\t\treadonly CentralSceneKeys[]\n\t> {\n\t\treturn this._supportedKeyAttributes;\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"scene count\": this.sceneCount,\n\t\t\t\"supports slow refresh\": maybeUnknownToString(\n\t\t\t\tthis.supportsSlowRefresh,\n\t\t\t),\n\t\t};\n\t\tfor (const [scene, keys] of this.supportedKeyAttributes) {\n\t\t\tmessage[`supported attributes (scene #${scene})`] = keys\n\t\t\t\t.map((k) => `\\n\u00B7 ${getEnumMemberName(CentralSceneKeys, k)}`)\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(CentralSceneCommand.SupportedGet)\n@expectedCCResponse(CentralSceneCCSupportedReport)\nexport class CentralSceneCCSupportedGet extends CentralSceneCC {}\n\n// @publicAPI\nexport interface CentralSceneCCConfigurationReportOptions {\n\tslowRefresh: boolean;\n}\n\n@CCCommand(CentralSceneCommand.ConfigurationReport)\n@ccValueProperty(\"slowRefresh\", CentralSceneCCValues.slowRefresh)\nexport class CentralSceneCCConfigurationReport extends CentralSceneCC {\n\tpublic constructor(\n\t\toptions: WithAddress<CentralSceneCCConfigurationReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.slowRefresh = options.slowRefresh;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CentralSceneCCConfigurationReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst slowRefresh = !!(raw.payload[0] & 0b1000_0000);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tslowRefresh,\n\t\t});\n\t}\n\n\tpublic readonly slowRefresh: boolean;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"slow refresh\": this.slowRefresh },\n\t\t};\n\t}\n}\n\n@CCCommand(CentralSceneCommand.ConfigurationGet)\n@expectedCCResponse(CentralSceneCCConfigurationReport)\nexport class CentralSceneCCConfigurationGet extends CentralSceneCC {}\n\n// @publicAPI\nexport interface CentralSceneCCConfigurationSetOptions {\n\tslowRefresh: boolean;\n}\n\n@CCCommand(CentralSceneCommand.ConfigurationSet)\n@useSupervision()\nexport class CentralSceneCCConfigurationSet extends CentralSceneCC {\n\tpublic constructor(\n\t\toptions: WithAddress<CentralSceneCCConfigurationSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.slowRefresh = options.slowRefresh;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): CentralSceneCCConfigurationSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new CentralSceneCCConfigurationSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic slowRefresh: boolean;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.slowRefresh ? 0b1000_0000 : 0]);\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: { \"slow refresh\": this.slowRefresh },\n\t\t};\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAgBO;AAMP,IAAAA,eAAsB;AACtB,IAAAA,eAAwC;AAExC,iBAQO;AACP,0BAKO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAAsD;AACtD,cAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElB,MAAM,uBAAuB,OAAO,OAAO;EACjD,GAAG,gBAAE,qBAAqB,2BAAe,eAAe,GAAG;IAC1D,GAAG,gBAAE,eAAe,cAAc,QAAW;MAC5C,UAAU;KACV;IACD,GAAG,gBAAE,eAAe,uBAAuB,QAAW;MACrD,UAAU;KACV;IACD,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,KAAK,cAAc,MAAc,CAAC,CAAC;AAC9D,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,gBAAgB,KAAK,YAAW;;IAE7C;;;;",
|
|
6
6
|
"names": ["import_safe"]
|
|
7
7
|
}
|
|
@@ -34,7 +34,6 @@ module.exports = __toCommonJS(ClimateControlScheduleCC_exports);
|
|
|
34
34
|
var import_safe = require("@zwave-js/core/safe");
|
|
35
35
|
var import_safe2 = require("@zwave-js/shared/safe");
|
|
36
36
|
var import_safe3 = require("@zwave-js/shared/safe");
|
|
37
|
-
var import_strings = require("alcalzone-shared/strings/index.js");
|
|
38
37
|
var import_API = require("../lib/API.js");
|
|
39
38
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
40
39
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
@@ -362,7 +361,7 @@ let ClimateControlScheduleCCSet = (() => {
|
|
|
362
361
|
message: {
|
|
363
362
|
weekday: (0, import_safe3.getEnumMemberName)(import_Types.Weekday, this.weekday),
|
|
364
363
|
switchpoints: `${this.switchPoints.map((sp) => `
|
|
365
|
-
\xB7 ${
|
|
364
|
+
\xB7 ${sp.hour.toString().padStart(2, "0")}:${sp.minute.toString().padStart(2, "0")} --> ${sp.state}`).join("")}`
|
|
366
365
|
}
|
|
367
366
|
};
|
|
368
367
|
}
|
|
@@ -413,7 +412,7 @@ let ClimateControlScheduleCCReport = (() => {
|
|
|
413
412
|
message: {
|
|
414
413
|
weekday: (0, import_safe3.getEnumMemberName)(import_Types.Weekday, this.weekday),
|
|
415
414
|
schedule: `${this.schedule.map((sp) => `
|
|
416
|
-
\xB7 ${
|
|
415
|
+
\xB7 ${sp.hour.toString().padStart(2, "0")}:${sp.minute.toString().padStart(2, "0")} --> ${sp.state}`).join("")}`
|
|
417
416
|
}
|
|
418
417
|
};
|
|
419
418
|
}
|
|
@@ -542,7 +541,7 @@ let ClimateControlScheduleCCOverrideReport = (() => {
|
|
|
542
541
|
static from(raw, ctx) {
|
|
543
542
|
(0, import_safe.validatePayload)(raw.payload.length >= 2);
|
|
544
543
|
const overrideType = raw.payload[0] & 3;
|
|
545
|
-
const overrideState = (0, import_serializers.decodeSetbackState)(raw.payload
|
|
544
|
+
const overrideState = (0, import_serializers.decodeSetbackState)(raw.payload, 1) || raw.payload.readInt8(1);
|
|
546
545
|
return new this({
|
|
547
546
|
nodeId: ctx.sourceNodeId,
|
|
548
547
|
overrideType,
|
|
@@ -611,8 +610,8 @@ let ClimateControlScheduleCCOverrideSet = (() => {
|
|
|
611
610
|
overrideType;
|
|
612
611
|
overrideState;
|
|
613
612
|
serialize(ctx) {
|
|
614
|
-
this.payload = import_safe2.Bytes.
|
|
615
|
-
this.overrideType & 3,
|
|
613
|
+
this.payload = import_safe2.Bytes.concat([
|
|
614
|
+
[this.overrideType & 3],
|
|
616
615
|
(0, import_serializers.encodeSetbackState)(this.overrideState)
|
|
617
616
|
]);
|
|
618
617
|
return super.serialize(ctx);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/ClimateControlScheduleCC.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tCommandClasses,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tenumValuesToMetadataStates,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { getEnumMemberName } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { padStart } from \"alcalzone-shared/strings/index.js\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } 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\tClimateControlScheduleCommand,\n\tScheduleOverrideType,\n\ttype SetbackState,\n\ttype Switchpoint,\n\tWeekday,\n} from \"../lib/_Types.js\";\nimport {\n\tdecodeSetbackState,\n\tdecodeSwitchpoint,\n\tencodeSetbackState,\n\tencodeSwitchpoint,\n} from \"../lib/serializers.js\";\n\nexport const ClimateControlScheduleCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses[\"Climate Control Schedule\"], {\n\t\t...V.staticProperty(\n\t\t\t\"overrideType\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Number,\n\t\t\t\tlabel: \"Override type\",\n\t\t\t\tstates: enumValuesToMetadataStates(ScheduleOverrideType),\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"overrideState\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Number,\n\t\t\t\tlabel: \"Override state\",\n\t\t\t\tmin: -12.8,\n\t\t\t} as const,\n\t\t),\n\t}),\n\n\t...V.defineDynamicCCValues(CommandClasses[\"Climate Control Schedule\"], {\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"schedule\",\n\t\t\t\"schedule\",\n\t\t\t(weekday: Weekday) => weekday,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"switchPoints\"\n\t\t\t\t&& typeof propertyKey === \"number\"\n\t\t\t\t&& propertyKey >= Weekday.Monday\n\t\t\t\t&& propertyKey <= Weekday.Sunday,\n\t\t\t(weekday: Weekday) => ({\n\t\t\t\t...ValueMetadata.Any,\n\t\t\t\tlabel: `Schedule (${getEnumMemberName(Weekday, weekday)})`,\n\t\t\t} as const),\n\t\t),\n\t}),\n});\n\n@API(CommandClasses[\"Climate Control Schedule\"])\nexport class ClimateControlScheduleCCAPI extends CCAPI {\n\tpublic supportsCommand(\n\t\tcmd: ClimateControlScheduleCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase ClimateControlScheduleCommand.Set:\n\t\t\tcase ClimateControlScheduleCommand.OverrideSet:\n\t\t\t\treturn true; // mandatory\n\t\t\tcase ClimateControlScheduleCommand.Get:\n\t\t\tcase ClimateControlScheduleCommand.ChangedGet:\n\t\t\tcase ClimateControlScheduleCommand.OverrideGet:\n\t\t\t\treturn this.isSinglecast();\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async set(\n\t\tweekday: Weekday,\n\t\tswitchPoints: Switchpoint[],\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.Set,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tweekday,\n\t\t\tswitchPoints,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async get(\n\t\tweekday: Weekday,\n\t): Promise<MaybeNotKnown<readonly Switchpoint[]>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.Get,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tweekday,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tClimateControlScheduleCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.schedule;\n\t}\n\n\tpublic async getChangeCounter(): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.ChangedGet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCChangedGet({\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\tClimateControlScheduleCCChangedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.changeCounter;\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getOverride() {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.OverrideGet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCOverrideGet({\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\tClimateControlScheduleCCOverrideReport\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\ttype: response.overrideType,\n\t\t\t\tstate: response.overrideState,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async setOverride(\n\t\ttype: ScheduleOverrideType,\n\t\tstate: SetbackState,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.OverrideSet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCOverrideSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\toverrideType: type,\n\t\t\toverrideState: state,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses[\"Climate Control Schedule\"])\n@implementedVersion(1)\n@ccValues(ClimateControlScheduleCCValues)\nexport class ClimateControlScheduleCC extends CommandClass {\n\tdeclare ccCommand: ClimateControlScheduleCommand;\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCSetOptions {\n\tweekday: Weekday;\n\tswitchPoints: Switchpoint[];\n}\n\n@CCCommand(ClimateControlScheduleCommand.Set)\n@useSupervision()\nexport class ClimateControlScheduleCCSet extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.switchPoints = options.switchPoints;\n\t\tthis.weekday = options.weekday;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic switchPoints: Switchpoint[];\n\tpublic weekday: Weekday;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\t// Make sure we have exactly 9 entries\n\t\tconst allSwitchPoints = this.switchPoints.slice(0, 9); // maximum 9\n\t\twhile (allSwitchPoints.length < 9) {\n\t\t\tallSwitchPoints.push({\n\t\t\t\thour: 0,\n\t\t\t\tminute: 0,\n\t\t\t\tstate: \"Unused\",\n\t\t\t});\n\t\t}\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.weekday & 0b111]),\n\t\t\t...allSwitchPoints.map((sp) => encodeSwitchpoint(sp)),\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\tweekday: getEnumMemberName(Weekday, this.weekday),\n\t\t\t\tswitchpoints: `${\n\t\t\t\t\tthis.switchPoints\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(sp) => `\n\u00B7 ${padStart(sp.hour.toString(), 2, \"0\")}:${\n\t\t\t\t\t\t\t\tpadStart(\n\t\t\t\t\t\t\t\t\tsp.minute.toString(),\n\t\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\t\"0\",\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t} --> ${sp.state}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCReportOptions {\n\tweekday: Weekday;\n\tschedule: Switchpoint[];\n}\n\n@CCCommand(ClimateControlScheduleCommand.Report)\n@ccValueProperty(\n\t\"schedule\",\n\tClimateControlScheduleCCValues.schedule,\n\t(self) => [self.weekday],\n)\nexport class ClimateControlScheduleCCReport extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.weekday = options.weekday;\n\t\tthis.schedule = options.schedule;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCReport {\n\t\tvalidatePayload(raw.payload.length >= 28);\n\t\tconst weekday: Weekday = raw.payload[0] & 0b111;\n\t\tconst allSwitchpoints: Switchpoint[] = [];\n\t\tfor (let i = 0; i <= 8; i++) {\n\t\t\tallSwitchpoints.push(\n\t\t\t\tdecodeSwitchpoint(raw.payload.subarray(1 + 3 * i)),\n\t\t\t);\n\t\t}\n\n\t\tconst schedule: Switchpoint[] = allSwitchpoints.filter((sp) =>\n\t\t\tsp.state !== \"Unused\"\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tweekday,\n\t\t\tschedule,\n\t\t});\n\t}\n\n\tpublic readonly weekday: Weekday;\n\n\tpublic readonly schedule: readonly Switchpoint[];\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\tweekday: getEnumMemberName(Weekday, this.weekday),\n\t\t\t\tschedule: `${\n\t\t\t\t\tthis.schedule\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(sp) => `\n\u00B7 ${padStart(sp.hour.toString(), 2, \"0\")}:${\n\t\t\t\t\t\t\t\tpadStart(\n\t\t\t\t\t\t\t\t\tsp.minute.toString(),\n\t\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\t\"0\",\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t} --> ${sp.state}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCGetOptions {\n\tweekday: Weekday;\n}\n\n@CCCommand(ClimateControlScheduleCommand.Get)\n@expectedCCResponse(ClimateControlScheduleCCReport)\nexport class ClimateControlScheduleCCGet extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.weekday = options.weekday;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCGet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCGet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic weekday: Weekday;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.weekday & 0b111]);\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: { weekday: getEnumMemberName(Weekday, this.weekday) },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCChangedReportOptions {\n\tchangeCounter: number;\n}\n\n@CCCommand(ClimateControlScheduleCommand.ChangedReport)\nexport class ClimateControlScheduleCCChangedReport\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCChangedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.changeCounter = options.changeCounter;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCChangedReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst changeCounter = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tchangeCounter,\n\t\t});\n\t}\n\n\tpublic readonly changeCounter: number;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"change counter\": this.changeCounter },\n\t\t};\n\t}\n}\n\n@CCCommand(ClimateControlScheduleCommand.ChangedGet)\n@expectedCCResponse(ClimateControlScheduleCCChangedReport)\nexport class ClimateControlScheduleCCChangedGet\n\textends ClimateControlScheduleCC\n{}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideReportOptions {\n\toverrideType: ScheduleOverrideType;\n\toverrideState: SetbackState;\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideReport)\n@ccValueProperty(\"overrideType\", ClimateControlScheduleCCValues.overrideType)\n@ccValueProperty(\"overrideState\", ClimateControlScheduleCCValues.overrideState)\nexport class ClimateControlScheduleCCOverrideReport\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCOverrideReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.overrideType = options.overrideType;\n\t\tthis.overrideState = options.overrideState;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCOverrideReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst overrideType: ScheduleOverrideType = raw.payload[0] & 0b11;\n\t\tconst overrideState: SetbackState = decodeSetbackState(raw.payload[1])\n\t\t\t|| raw.payload[1];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\toverrideType,\n\t\t\toverrideState,\n\t\t});\n\t}\n\n\tpublic readonly overrideType: ScheduleOverrideType;\n\n\tpublic readonly overrideState: SetbackState;\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\"override type\": getEnumMemberName(\n\t\t\t\t\tScheduleOverrideType,\n\t\t\t\t\tthis.overrideType,\n\t\t\t\t),\n\t\t\t\t\"override state\": this.overrideState,\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideGet)\n@expectedCCResponse(ClimateControlScheduleCCOverrideReport)\nexport class ClimateControlScheduleCCOverrideGet\n\textends ClimateControlScheduleCC\n{}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideSetOptions {\n\toverrideType: ScheduleOverrideType;\n\toverrideState: SetbackState;\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideSet)\n@useSupervision()\nexport class ClimateControlScheduleCCOverrideSet\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCOverrideSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.overrideType = options.overrideType;\n\t\tthis.overrideState = options.overrideState;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCOverrideSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCOverrideSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic overrideType: ScheduleOverrideType;\n\tpublic overrideState: SetbackState;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.overrideType & 0b11,\n\t\t\tencodeSetbackState(this.overrideState),\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\"override type\": getEnumMemberName(\n\t\t\t\t\tScheduleOverrideType,\n\t\t\t\t\tthis.overrideType,\n\t\t\t\t),\n\t\t\t\t\"override state\": this.overrideState,\n\t\t\t},\n\t\t};\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAWO;AAMP,IAAAA,eAAsB;AACtB,IAAAA,eAAkC;AAElC,
|
|
4
|
+
"sourcesContent": ["import {\n\tCommandClasses,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\ttype SupervisionResult,\n\tValueMetadata,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tenumValuesToMetadataStates,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { getEnumMemberName } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } 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\tClimateControlScheduleCommand,\n\tScheduleOverrideType,\n\ttype SetbackState,\n\ttype Switchpoint,\n\tWeekday,\n} from \"../lib/_Types.js\";\nimport {\n\tdecodeSetbackState,\n\tdecodeSwitchpoint,\n\tencodeSetbackState,\n\tencodeSwitchpoint,\n} from \"../lib/serializers.js\";\n\nexport const ClimateControlScheduleCCValues = Object.freeze({\n\t...V.defineStaticCCValues(CommandClasses[\"Climate Control Schedule\"], {\n\t\t...V.staticProperty(\n\t\t\t\"overrideType\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Number,\n\t\t\t\tlabel: \"Override type\",\n\t\t\t\tstates: enumValuesToMetadataStates(ScheduleOverrideType),\n\t\t\t} as const,\n\t\t),\n\t\t...V.staticProperty(\n\t\t\t\"overrideState\",\n\t\t\t{\n\t\t\t\t...ValueMetadata.Number,\n\t\t\t\tlabel: \"Override state\",\n\t\t\t\tmin: -12.8,\n\t\t\t} as const,\n\t\t),\n\t}),\n\n\t...V.defineDynamicCCValues(CommandClasses[\"Climate Control Schedule\"], {\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"schedule\",\n\t\t\t\"schedule\",\n\t\t\t(weekday: Weekday) => weekday,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"switchPoints\"\n\t\t\t\t&& typeof propertyKey === \"number\"\n\t\t\t\t&& propertyKey >= Weekday.Monday\n\t\t\t\t&& propertyKey <= Weekday.Sunday,\n\t\t\t(weekday: Weekday) => ({\n\t\t\t\t...ValueMetadata.Any,\n\t\t\t\tlabel: `Schedule (${getEnumMemberName(Weekday, weekday)})`,\n\t\t\t} as const),\n\t\t),\n\t}),\n});\n\n@API(CommandClasses[\"Climate Control Schedule\"])\nexport class ClimateControlScheduleCCAPI extends CCAPI {\n\tpublic supportsCommand(\n\t\tcmd: ClimateControlScheduleCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase ClimateControlScheduleCommand.Set:\n\t\t\tcase ClimateControlScheduleCommand.OverrideSet:\n\t\t\t\treturn true; // mandatory\n\t\t\tcase ClimateControlScheduleCommand.Get:\n\t\t\tcase ClimateControlScheduleCommand.ChangedGet:\n\t\t\tcase ClimateControlScheduleCommand.OverrideGet:\n\t\t\t\treturn this.isSinglecast();\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async set(\n\t\tweekday: Weekday,\n\t\tswitchPoints: Switchpoint[],\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.Set,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tweekday,\n\t\t\tswitchPoints,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async get(\n\t\tweekday: Weekday,\n\t): Promise<MaybeNotKnown<readonly Switchpoint[]>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.Get,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tweekday,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tClimateControlScheduleCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.schedule;\n\t}\n\n\tpublic async getChangeCounter(): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.ChangedGet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCChangedGet({\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\tClimateControlScheduleCCChangedReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.changeCounter;\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getOverride() {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.OverrideGet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCOverrideGet({\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\tClimateControlScheduleCCOverrideReport\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\ttype: response.overrideType,\n\t\t\t\tstate: response.overrideState,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async setOverride(\n\t\ttype: ScheduleOverrideType,\n\t\tstate: SetbackState,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tClimateControlScheduleCommand,\n\t\t\tClimateControlScheduleCommand.OverrideSet,\n\t\t);\n\n\t\tconst cc = new ClimateControlScheduleCCOverrideSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\toverrideType: type,\n\t\t\toverrideState: state,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses[\"Climate Control Schedule\"])\n@implementedVersion(1)\n@ccValues(ClimateControlScheduleCCValues)\nexport class ClimateControlScheduleCC extends CommandClass {\n\tdeclare ccCommand: ClimateControlScheduleCommand;\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCSetOptions {\n\tweekday: Weekday;\n\tswitchPoints: Switchpoint[];\n}\n\n@CCCommand(ClimateControlScheduleCommand.Set)\n@useSupervision()\nexport class ClimateControlScheduleCCSet extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.switchPoints = options.switchPoints;\n\t\tthis.weekday = options.weekday;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic switchPoints: Switchpoint[];\n\tpublic weekday: Weekday;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\t// Make sure we have exactly 9 entries\n\t\tconst allSwitchPoints = this.switchPoints.slice(0, 9); // maximum 9\n\t\twhile (allSwitchPoints.length < 9) {\n\t\t\tallSwitchPoints.push({\n\t\t\t\thour: 0,\n\t\t\t\tminute: 0,\n\t\t\t\tstate: \"Unused\",\n\t\t\t});\n\t\t}\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.weekday & 0b111]),\n\t\t\t...allSwitchPoints.map((sp) => encodeSwitchpoint(sp)),\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\tweekday: getEnumMemberName(Weekday, this.weekday),\n\t\t\t\tswitchpoints: `${\n\t\t\t\t\tthis.switchPoints\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${\n\t\t\t\t\t\t\t\tsp.minute.toString().padStart(\n\t\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\t\"0\",\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t} --> ${sp.state}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCReportOptions {\n\tweekday: Weekday;\n\tschedule: Switchpoint[];\n}\n\n@CCCommand(ClimateControlScheduleCommand.Report)\n@ccValueProperty(\n\t\"schedule\",\n\tClimateControlScheduleCCValues.schedule,\n\t(self) => [self.weekday],\n)\nexport class ClimateControlScheduleCCReport extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.weekday = options.weekday;\n\t\tthis.schedule = options.schedule;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCReport {\n\t\tvalidatePayload(raw.payload.length >= 28);\n\t\tconst weekday: Weekday = raw.payload[0] & 0b111;\n\t\tconst allSwitchpoints: Switchpoint[] = [];\n\t\tfor (let i = 0; i <= 8; i++) {\n\t\t\tallSwitchpoints.push(\n\t\t\t\tdecodeSwitchpoint(raw.payload.subarray(1 + 3 * i)),\n\t\t\t);\n\t\t}\n\n\t\tconst schedule: Switchpoint[] = allSwitchpoints.filter((sp) =>\n\t\t\tsp.state !== \"Unused\"\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tweekday,\n\t\t\tschedule,\n\t\t});\n\t}\n\n\tpublic readonly weekday: Weekday;\n\n\tpublic readonly schedule: readonly Switchpoint[];\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\tweekday: getEnumMemberName(Weekday, this.weekday),\n\t\t\t\tschedule: `${\n\t\t\t\t\tthis.schedule\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(sp) => `\n\u00B7 ${sp.hour.toString().padStart(2, \"0\")}:${\n\t\t\t\t\t\t\t\tsp.minute.toString().padStart(\n\t\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\t\"0\",\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t} --> ${sp.state}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCGetOptions {\n\tweekday: Weekday;\n}\n\n@CCCommand(ClimateControlScheduleCommand.Get)\n@expectedCCResponse(ClimateControlScheduleCCReport)\nexport class ClimateControlScheduleCCGet extends ClimateControlScheduleCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.weekday = options.weekday;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCGet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCGet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic weekday: Weekday;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([this.weekday & 0b111]);\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: { weekday: getEnumMemberName(Weekday, this.weekday) },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCChangedReportOptions {\n\tchangeCounter: number;\n}\n\n@CCCommand(ClimateControlScheduleCommand.ChangedReport)\nexport class ClimateControlScheduleCCChangedReport\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCChangedReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.changeCounter = options.changeCounter;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCChangedReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst changeCounter = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tchangeCounter,\n\t\t});\n\t}\n\n\tpublic readonly changeCounter: number;\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"change counter\": this.changeCounter },\n\t\t};\n\t}\n}\n\n@CCCommand(ClimateControlScheduleCommand.ChangedGet)\n@expectedCCResponse(ClimateControlScheduleCCChangedReport)\nexport class ClimateControlScheduleCCChangedGet\n\textends ClimateControlScheduleCC\n{}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideReportOptions {\n\toverrideType: ScheduleOverrideType;\n\toverrideState: SetbackState;\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideReport)\n@ccValueProperty(\"overrideType\", ClimateControlScheduleCCValues.overrideType)\n@ccValueProperty(\"overrideState\", ClimateControlScheduleCCValues.overrideState)\nexport class ClimateControlScheduleCCOverrideReport\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCOverrideReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.overrideType = options.overrideType;\n\t\tthis.overrideState = options.overrideState;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): ClimateControlScheduleCCOverrideReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst overrideType: ScheduleOverrideType = raw.payload[0] & 0b11;\n\t\tconst overrideState: SetbackState = decodeSetbackState(raw.payload, 1)\n\t\t\t// If we receive an unknown setback state, return the raw value\n\t\t\t|| raw.payload.readInt8(1);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\toverrideType,\n\t\t\toverrideState,\n\t\t});\n\t}\n\n\tpublic readonly overrideType: ScheduleOverrideType;\n\n\tpublic readonly overrideState: SetbackState;\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\"override type\": getEnumMemberName(\n\t\t\t\t\tScheduleOverrideType,\n\t\t\t\t\tthis.overrideType,\n\t\t\t\t),\n\t\t\t\t\"override state\": this.overrideState,\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideGet)\n@expectedCCResponse(ClimateControlScheduleCCOverrideReport)\nexport class ClimateControlScheduleCCOverrideGet\n\textends ClimateControlScheduleCC\n{}\n\n// @publicAPI\nexport interface ClimateControlScheduleCCOverrideSetOptions {\n\toverrideType: ScheduleOverrideType;\n\toverrideState: SetbackState;\n}\n\n@CCCommand(ClimateControlScheduleCommand.OverrideSet)\n@useSupervision()\nexport class ClimateControlScheduleCCOverrideSet\n\textends ClimateControlScheduleCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<ClimateControlScheduleCCOverrideSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.overrideType = options.overrideType;\n\t\tthis.overrideState = options.overrideState;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): ClimateControlScheduleCCOverrideSet {\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClimateControlScheduleCCOverrideSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic overrideType: ScheduleOverrideType;\n\tpublic overrideState: SetbackState;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.overrideType & 0b11],\n\t\t\tencodeSetbackState(this.overrideState),\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\"override type\": getEnumMemberName(\n\t\t\t\t\tScheduleOverrideType,\n\t\t\t\t\tthis.overrideType,\n\t\t\t\t),\n\t\t\t\t\"override state\": this.overrideState,\n\t\t\t},\n\t\t};\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAWO;AAMP,IAAAA,eAAsB;AACtB,IAAAA,eAAkC;AAElC,iBAAsB;AACtB,0BAAyC;AACzC,oCASO;AACP,oBAAkB;AAClB,mBAMO;AACP,yBAKO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,M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AAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;IAYA,uCAAmC,MAAA;8BAF/C,yCAAU,2CAA8B,WAAW,OACnD,8CAAc,CAAE;;;;oBAER;2DAAA,YAAwB;;;;;;AADjC,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IAGZ,YACC,SAAgE;AAEhE,YAAM,OAAO;AACb,WAAK,eAAe,QAAQ;AAC5B,WAAK,gBAAgB,QAAQ;IAC9B;IAEO,OAAO,KACb,MACA,MAAsB;AAEtB,YAAM,IAAI,uBACT,GAAG,KAAK,IAAI,qCACZ,4BAAgB,8BAA8B;IAMhD;IAEO;IACA;IAEA,UAAU,KAAsB;AACtC,WAAK,UAAU,mBAAM,OAAO;QAC3B,CAAC,KAAK,eAAe,CAAI;YACzB,uCAAmB,KAAK,aAAa;OACrC;AACD,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACR,qBAAiB,gCAChB,mCACA,KAAK,YAAY;UAElB,kBAAkB,KAAK;;;IAG1B;;;;",
|
|
6
6
|
"names": ["import_safe"]
|
|
7
7
|
}
|
package/build/cjs/cc/ClockCC.js
CHANGED
|
@@ -28,7 +28,6 @@ module.exports = __toCommonJS(ClockCC_exports);
|
|
|
28
28
|
var import_safe = require("@zwave-js/core/safe");
|
|
29
29
|
var import_safe2 = require("@zwave-js/shared/safe");
|
|
30
30
|
var import_safe3 = require("@zwave-js/shared/safe");
|
|
31
|
-
var import_strings = require("alcalzone-shared/strings/index.js");
|
|
32
31
|
var import_API = require("../lib/API.js");
|
|
33
32
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
34
33
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|
|
@@ -242,7 +241,7 @@ let ClockCCSet = (() => {
|
|
|
242
241
|
return {
|
|
243
242
|
...super.toLogEntry(ctx),
|
|
244
243
|
message: {
|
|
245
|
-
"clock setting": `${(0, import_safe3.getEnumMemberName)(import_Types.Weekday, this.weekday)}, ${
|
|
244
|
+
"clock setting": `${(0, import_safe3.getEnumMemberName)(import_Types.Weekday, this.weekday)}, ${this.hour.toString().padStart(2, "0")}:${this.minute.toString().padStart(2, "0")}`
|
|
246
245
|
}
|
|
247
246
|
};
|
|
248
247
|
}
|
|
@@ -292,7 +291,7 @@ let ClockCCReport = (() => {
|
|
|
292
291
|
return {
|
|
293
292
|
...super.toLogEntry(ctx),
|
|
294
293
|
message: {
|
|
295
|
-
"clock setting": `${(0, import_safe3.getEnumMemberName)(import_Types.Weekday, this.weekday)}, ${
|
|
294
|
+
"clock setting": `${(0, import_safe3.getEnumMemberName)(import_Types.Weekday, this.weekday)}, ${this.hour.toString().padStart(2, "0")}:${this.minute.toString().padStart(2, "0")}`
|
|
296
295
|
}
|
|
297
296
|
};
|
|
298
297
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/ClockCC.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n\tMessageOrCCLogEntry,\n\tSupervisionResult,\n\tWithAddress,\n} from \"@zwave-js/core/safe\";\nimport {\n\tCommandClasses,\n\ttype MaybeNotKnown,\n\tMessagePriority,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { getEnumMemberName, pick } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,kBAOO;AAMP,IAAAA,eAAsB;AACtB,IAAAA,eAAwC;AAExC,
|
|
4
|
+
"sourcesContent": ["import type {\n\tMessageOrCCLogEntry,\n\tSupervisionResult,\n\tWithAddress,\n} from \"@zwave-js/core/safe\";\nimport {\n\tCommandClasses,\n\ttype MaybeNotKnown,\n\tMessagePriority,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport type {\n\tCCEncodingContext,\n\tCCParsingContext,\n\tGetValueDB,\n} from \"@zwave-js/host/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport { getEnumMemberName, pick } from \"@zwave-js/shared/safe\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI } 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\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { ClockCommand, Weekday } from \"../lib/_Types.js\";\n\n// @noSetValueAPI - This CC has no simple value to set\n\n@API(CommandClasses.Clock)\nexport class ClockCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: ClockCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase ClockCommand.Get:\n\t\t\t\treturn this.isSinglecast();\n\t\t\tcase ClockCommand.Set:\n\t\t\t\treturn true; // This is mandatory\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(ClockCommand, ClockCommand.Get);\n\n\t\tconst cc = new ClockCCGet({\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<ClockCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"weekday\", \"hour\", \"minute\"]);\n\t\t}\n\t}\n\n\t@validateArgs({ strictEnums: true })\n\tpublic async set(\n\t\thour: number,\n\t\tminute: number,\n\t\tweekday?: Weekday,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(ClockCommand, ClockCommand.Set);\n\n\t\tconst cc = new ClockCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\thour,\n\t\t\tminute,\n\t\t\tweekday: weekday ?? Weekday.Unknown,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\n@commandClass(CommandClasses.Clock)\n@implementedVersion(1)\nexport class ClockCC extends CommandClass {\n\tdeclare ccCommand: ClockCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\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\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.Clock,\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\tmessage: \"requesting current clock setting...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst response = await api.get();\n\t\tif (response) {\n\t\t\tconst logMessage = `received current clock setting: ${\n\t\t\t\tresponse.weekday !== Weekday.Unknown\n\t\t\t\t\t? Weekday[response.weekday] + \", \"\n\t\t\t\t\t: \"\"\n\t\t\t}${response.hour < 10 ? \"0\" : \"\"}${response.hour}:${\n\t\t\t\tresponse.minute < 10 ? \"0\" : \"\"\n\t\t\t}${response.minute}`;\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\t}\n}\n\n// @publicAPI\nexport interface ClockCCSetOptions {\n\tweekday: Weekday;\n\thour: number;\n\tminute: number;\n}\n\n@CCCommand(ClockCommand.Set)\n@useSupervision()\nexport class ClockCCSet extends ClockCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClockCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.weekday = options.weekday;\n\t\tthis.hour = options.hour;\n\t\tthis.minute = options.minute;\n\t}\n\n\tpublic static from(_raw: CCRaw, _ctx: CCParsingContext): ClockCCSet {\n\t\t// TODO: Deserialize payload\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new ClockCCSet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic weekday: Weekday;\n\tpublic hour: number;\n\tpublic minute: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Bytes {\n\t\tthis.payload = Bytes.from([\n\t\t\t((this.weekday & 0b111) << 5) | (this.hour & 0b11111),\n\t\t\tthis.minute,\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\"clock setting\": `${\n\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\tWeekday,\n\t\t\t\t\t\tthis.weekday,\n\t\t\t\t\t)\n\t\t\t\t}, ${this.hour.toString().padStart(2, \"0\")}:${\n\t\t\t\t\tthis.minute.toString().padStart(\n\t\t\t\t\t\t2,\n\t\t\t\t\t\t\"0\",\n\t\t\t\t\t)\n\t\t\t\t}`,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface ClockCCReportOptions {\n\tweekday: Weekday;\n\thour: number;\n\tminute: number;\n}\n\n@CCCommand(ClockCommand.Report)\nexport class ClockCCReport extends ClockCC {\n\tpublic constructor(\n\t\toptions: WithAddress<ClockCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.weekday = options.weekday;\n\t\tthis.hour = options.hour;\n\t\tthis.minute = options.minute;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): ClockCCReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst weekday: Weekday = raw.payload[0] >>> 5;\n\t\tconst hour = raw.payload[0] & 0b11111;\n\t\tconst minute = raw.payload[1];\n\t\tvalidatePayload(\n\t\t\tweekday <= Weekday.Sunday,\n\t\t\thour <= 23,\n\t\t\tminute <= 59,\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tweekday,\n\t\t\thour,\n\t\t\tminute,\n\t\t});\n\t}\n\n\tpublic readonly weekday: Weekday;\n\tpublic readonly hour: number;\n\tpublic readonly minute: number;\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\"clock setting\": `${\n\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\tWeekday,\n\t\t\t\t\t\tthis.weekday,\n\t\t\t\t\t)\n\t\t\t\t}, ${this.hour.toString().padStart(2, \"0\")}:${\n\t\t\t\t\tthis.minute.toString().padStart(\n\t\t\t\t\t\t2,\n\t\t\t\t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AQ,UAAU,CAAC;AACvC,YAAM,UAAmB,IAAI,QAAQ,CAAC,MAAM;AAC5C,YAAM,OAAO,IAAI,QAAQ,CAAC,IAAI;AAC9B,YAAM,SAAS,IAAI,QAAQ,CAAC;AAC5B,uCACC,WAAW,qBAAQ,QACnB,QAAQ,IACR,UAAU,EAAE;AAGb,aAAO,IAAI,KAAK;QACf,QAAQ,IAAI;QACZ;QACA;QACA;OACA;IACF;IAEgB;IACA;IACA;IAET,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACR,iBAAiB,OAChB,gCACC,sBACA,KAAK,OAAO,CAEd,KAAK,KAAK,KAAK,SAAQ,EAAG,SAAS,GAAG,GAAG,CAAC,IACzC,KAAK,OAAO,SAAQ,EAAG,SACtB,GACA,GAAG,CAEL;;;IAGH;;;;IAKY,cAAU,MAAA;8BAFtB,yCAAU,0BAAa,GAAG,OAC1B,kDAAmB,aAAa,CAAC;;;;oBACF;kCAAA,YAAO;;;;;;AAAvC,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
|
|
6
6
|
"names": ["import_safe"]
|
|
7
7
|
}
|
|
@@ -34,8 +34,8 @@ var import_core = require("@zwave-js/core");
|
|
|
34
34
|
var import_safe = require("@zwave-js/core/safe");
|
|
35
35
|
var import_safe2 = require("@zwave-js/shared/safe");
|
|
36
36
|
var import_safe3 = require("@zwave-js/shared/safe");
|
|
37
|
-
var import_math = require("alcalzone-shared/math
|
|
38
|
-
var import_typeguards = require("alcalzone-shared/typeguards
|
|
37
|
+
var import_math = require("alcalzone-shared/math");
|
|
38
|
+
var import_typeguards = require("alcalzone-shared/typeguards");
|
|
39
39
|
var import_API = require("../lib/API.js");
|
|
40
40
|
var import_CommandClass = require("../lib/CommandClass.js");
|
|
41
41
|
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
|