zwave-js 14.3.3 → 14.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/build/cjs/lib/_version.d.ts +1 -1
  2. package/build/cjs/lib/_version.js +1 -1
  3. package/build/cjs/lib/_version.js.map +1 -1
  4. package/build/cjs/lib/controller/Controller.js +66 -60
  5. package/build/cjs/lib/controller/Controller.js.map +1 -1
  6. package/build/cjs/lib/controller/ControllerStatistics.js +4 -0
  7. package/build/cjs/lib/controller/ControllerStatistics.js.map +1 -1
  8. package/build/cjs/lib/controller/FirmwareUpdateService.js +8 -0
  9. package/build/cjs/lib/controller/FirmwareUpdateService.js.map +1 -1
  10. package/build/cjs/lib/controller/MockControllerBehaviors.js +3 -0
  11. package/build/cjs/lib/controller/MockControllerBehaviors.js.map +1 -1
  12. package/build/cjs/lib/controller/NVMIO.js +7 -0
  13. package/build/cjs/lib/controller/NVMIO.js.map +1 -1
  14. package/build/cjs/lib/controller/NodeInformationFrame.js +2 -0
  15. package/build/cjs/lib/controller/NodeInformationFrame.js.map +1 -1
  16. package/build/cjs/lib/controller/ZWaveSDKVersions.js +3 -0
  17. package/build/cjs/lib/controller/ZWaveSDKVersions.js.map +1 -1
  18. package/build/cjs/lib/controller/utils.js +4 -0
  19. package/build/cjs/lib/controller/utils.js.map +1 -1
  20. package/build/cjs/lib/driver/Bootloader.js +4 -0
  21. package/build/cjs/lib/driver/Bootloader.js.map +1 -1
  22. package/build/cjs/lib/driver/Driver.js +63 -56
  23. package/build/cjs/lib/driver/Driver.js.map +1 -1
  24. package/build/cjs/lib/driver/DriverMock.js +6 -3
  25. package/build/cjs/lib/driver/DriverMock.js.map +1 -1
  26. package/build/cjs/lib/driver/MessageGenerators.js +26 -18
  27. package/build/cjs/lib/driver/MessageGenerators.js.map +1 -1
  28. package/build/cjs/lib/driver/NetworkCache.js +43 -23
  29. package/build/cjs/lib/driver/NetworkCache.js.map +1 -1
  30. package/build/cjs/lib/driver/Queue.js +6 -2
  31. package/build/cjs/lib/driver/Queue.js.map +1 -1
  32. package/build/cjs/lib/driver/SerialAPICommandMachine.js +45 -40
  33. package/build/cjs/lib/driver/SerialAPICommandMachine.js.map +1 -1
  34. package/build/cjs/lib/driver/StateMachineShared.js +5 -0
  35. package/build/cjs/lib/driver/StateMachineShared.js.map +1 -1
  36. package/build/cjs/lib/driver/Statistics.js +4 -0
  37. package/build/cjs/lib/driver/Statistics.js.map +1 -1
  38. package/build/cjs/lib/driver/Task.js +9 -2
  39. package/build/cjs/lib/driver/Task.js.map +1 -1
  40. package/build/cjs/lib/driver/Transaction.js +8 -4
  41. package/build/cjs/lib/driver/Transaction.js.map +1 -1
  42. package/build/cjs/lib/driver/TransportServiceMachine.js +9 -7
  43. package/build/cjs/lib/driver/TransportServiceMachine.js.map +1 -1
  44. package/build/cjs/lib/driver/UpdateConfig.js +8 -4
  45. package/build/cjs/lib/driver/UpdateConfig.js.map +1 -1
  46. package/build/cjs/lib/driver/UserAgent.js +4 -0
  47. package/build/cjs/lib/driver/UserAgent.js.map +1 -1
  48. package/build/cjs/lib/driver/mDNSDiscovery.js +2 -0
  49. package/build/cjs/lib/driver/mDNSDiscovery.js.map +1 -1
  50. package/build/cjs/lib/log/Driver.js +6 -2
  51. package/build/cjs/lib/log/Driver.js.map +1 -1
  52. package/build/cjs/lib/log/Zniffer.js +6 -2
  53. package/build/cjs/lib/log/Zniffer.js.map +1 -1
  54. package/build/cjs/lib/node/DeviceClass.js +4 -0
  55. package/build/cjs/lib/node/DeviceClass.js.map +1 -1
  56. package/build/cjs/lib/node/Endpoint.js +9 -5
  57. package/build/cjs/lib/node/Endpoint.js.map +1 -1
  58. package/build/cjs/lib/node/HealthCheck.js +6 -0
  59. package/build/cjs/lib/node/HealthCheck.js.map +1 -1
  60. package/build/cjs/lib/node/MockNodeBehaviors.js +2 -0
  61. package/build/cjs/lib/node/MockNodeBehaviors.js.map +1 -1
  62. package/build/cjs/lib/node/MultiCCAPIWrapper.js +10 -8
  63. package/build/cjs/lib/node/MultiCCAPIWrapper.js.map +1 -1
  64. package/build/cjs/lib/node/Node.js +51 -46
  65. package/build/cjs/lib/node/Node.js.map +1 -1
  66. package/build/cjs/lib/node/NodeReadyMachine.js +3 -1
  67. package/build/cjs/lib/node/NodeReadyMachine.js.map +1 -1
  68. package/build/cjs/lib/node/NodeStatistics.js +5 -0
  69. package/build/cjs/lib/node/NodeStatistics.js.map +1 -1
  70. package/build/cjs/lib/node/NodeStatusMachine.js +5 -2
  71. package/build/cjs/lib/node/NodeStatusMachine.js.map +1 -1
  72. package/build/cjs/lib/node/VirtualEndpoint.js +8 -4
  73. package/build/cjs/lib/node/VirtualEndpoint.js.map +1 -1
  74. package/build/cjs/lib/node/VirtualNode.js +7 -2
  75. package/build/cjs/lib/node/VirtualNode.js.map +1 -1
  76. package/build/cjs/lib/node/mixins/00_Base.js +4 -0
  77. package/build/cjs/lib/node/mixins/00_Base.js.map +1 -1
  78. package/build/cjs/lib/node/mixins/01_NetworkRole.js +4 -0
  79. package/build/cjs/lib/node/mixins/01_NetworkRole.js.map +1 -1
  80. package/build/cjs/lib/node/mixins/05_Security.js +7 -3
  81. package/build/cjs/lib/node/mixins/05_Security.js.map +1 -1
  82. package/build/cjs/lib/node/mixins/10_Events.js +4 -0
  83. package/build/cjs/lib/node/mixins/10_Events.js.map +1 -1
  84. package/build/cjs/lib/node/mixins/20_Status.js +4 -0
  85. package/build/cjs/lib/node/mixins/20_Status.js.map +1 -1
  86. package/build/cjs/lib/node/mixins/30_Wakeup.js +4 -0
  87. package/build/cjs/lib/node/mixins/30_Wakeup.js.map +1 -1
  88. package/build/cjs/lib/node/mixins/40_Values.js +4 -0
  89. package/build/cjs/lib/node/mixins/40_Values.js.map +1 -1
  90. package/build/cjs/lib/node/mixins/50_Endpoints.js +4 -0
  91. package/build/cjs/lib/node/mixins/50_Endpoints.js.map +1 -1
  92. package/build/cjs/lib/node/mixins/60_ScheduledPoll.js +4 -0
  93. package/build/cjs/lib/node/mixins/60_ScheduledPoll.js.map +1 -1
  94. package/build/cjs/lib/node/mixins/70_FirmwareUpdate.js +8 -3
  95. package/build/cjs/lib/node/mixins/70_FirmwareUpdate.js.map +1 -1
  96. package/build/cjs/lib/node/mixins/index.js +4 -0
  97. package/build/cjs/lib/node/mixins/index.js.map +1 -1
  98. package/build/cjs/lib/node/mockCCBehaviors/ColorSwitch.js +2 -1
  99. package/build/cjs/lib/node/mockCCBehaviors/ColorSwitch.js.map +1 -1
  100. package/build/cjs/lib/node/mockCCBehaviors/Configuration.js +2 -1
  101. package/build/cjs/lib/node/mockCCBehaviors/Configuration.js.map +1 -1
  102. package/build/cjs/lib/node/mockCCBehaviors/ScheduleEntryLock.js +2 -1
  103. package/build/cjs/lib/node/mockCCBehaviors/ScheduleEntryLock.js.map +1 -1
  104. package/build/cjs/lib/node/mockCCBehaviors/ThermostatSetpoint.js +3 -2
  105. package/build/cjs/lib/node/mockCCBehaviors/ThermostatSetpoint.js.map +1 -1
  106. package/build/cjs/lib/node/mockCCBehaviors/UserCode.js +3 -2
  107. package/build/cjs/lib/node/mockCCBehaviors/UserCode.js.map +1 -1
  108. package/build/cjs/lib/node/utils.js +22 -2
  109. package/build/cjs/lib/node/utils.js.map +1 -1
  110. package/build/cjs/lib/telemetry/deviceConfig.js +2 -0
  111. package/build/cjs/lib/telemetry/deviceConfig.js.map +1 -1
  112. package/build/cjs/lib/telemetry/statistics.js +3 -0
  113. package/build/cjs/lib/telemetry/statistics.js.map +1 -1
  114. package/build/cjs/lib/zniffer/MPDU.js +57 -0
  115. package/build/cjs/lib/zniffer/MPDU.js.map +1 -1
  116. package/build/cjs/lib/zniffer/Zniffer.js +10 -3
  117. package/build/cjs/lib/zniffer/Zniffer.js.map +1 -1
  118. package/build/cjs/mockServer.js +14 -0
  119. package/build/cjs/mockServer.js.map +1 -1
  120. package/build/esm/lib/_version.d.ts +1 -1
  121. package/build/esm/lib/_version.js +1 -1
  122. package/package.json +12 -12
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -65,10 +66,11 @@ function createNodeReadyMachine(initialContext = {}) {
65
66
  }
66
67
  }, {
67
68
  guards: {
68
- isDefinitelyNotDead: (ctx) => !ctx.isMaybeDead
69
+ isDefinitelyNotDead: /* @__PURE__ */ __name((ctx) => !ctx.isMaybeDead, "isDefinitelyNotDead")
69
70
  }
70
71
  });
71
72
  }
73
+ __name(createNodeReadyMachine, "createNodeReadyMachine");
72
74
  // Annotate the CommonJS export names for ESM import in node:
73
75
  0 && (module.exports = {
74
76
  createNodeReadyMachine
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/node/NodeReadyMachine.ts"],
4
4
  "sourcesContent": ["import {\n\ttype InterpreterFrom,\n\tMachine,\n\ttype StateMachine,\n\tassign,\n} from \"xstate\";\n\nexport interface NodeReadyStateSchema {\n\tstates: {\n\t\tnotReady: object;\n\t\treadyIfNotDead: object;\n\t\tready: object;\n\t};\n}\n\nexport interface NodeReadyContext {\n\tisMaybeDead: boolean;\n}\n\nexport type NodeReadyEvent =\n\t| { type: \"NOT_DEAD\" }\n\t| { type: \"MAYBE_DEAD\" }\n\t| { type: \"RESTART_FROM_CACHE\" }\n\t| { type: \"INTERVIEW_DONE\" };\n\nexport type NodeReadyMachine = StateMachine<\n\tNodeReadyContext,\n\tNodeReadyStateSchema,\n\tNodeReadyEvent,\n\tany,\n\tany,\n\tany,\n\tany\n>;\nexport type NodeReadyInterpreter = InterpreterFrom<NodeReadyMachine>;\n\nexport function createNodeReadyMachine(\n\tinitialContext: Partial<NodeReadyContext> = {},\n): NodeReadyMachine {\n\treturn Machine<NodeReadyContext, NodeReadyStateSchema, NodeReadyEvent>(\n\t\t{\n\t\t\tid: \"nodeReady\",\n\t\t\tinitial: \"notReady\",\n\t\t\tcontext: {\n\t\t\t\tisMaybeDead: true,\n\t\t\t\t...initialContext,\n\t\t\t},\n\t\t\ton: {\n\t\t\t\tMAYBE_DEAD: {\n\t\t\t\t\tactions: assign({ isMaybeDead: true }) as any,\n\t\t\t\t},\n\t\t\t\tNOT_DEAD: {\n\t\t\t\t\tactions: assign({ isMaybeDead: false }) as any,\n\t\t\t\t},\n\t\t\t\tINTERVIEW_DONE: {\n\t\t\t\t\ttarget: \"ready\",\n\t\t\t\t\tactions: assign({ isMaybeDead: false }) as any,\n\t\t\t\t},\n\t\t\t},\n\t\t\tstates: {\n\t\t\t\tnotReady: {\n\t\t\t\t\tentry: assign({ isMaybeDead: true }) as any,\n\t\t\t\t\ton: {\n\t\t\t\t\t\tRESTART_FROM_CACHE: [{ target: \"readyIfNotDead\" }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\treadyIfNotDead: {\n\t\t\t\t\talways: [{ cond: \"isDefinitelyNotDead\", target: \"ready\" }],\n\t\t\t\t\ton: {\n\t\t\t\t\t\tNOT_DEAD: {\n\t\t\t\t\t\t\ttarget: \"ready\",\n\t\t\t\t\t\t\tactions: assign({ isMaybeDead: false }) as any,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tready: {\n\t\t\t\t\t// If this is final, we will get warnings in the log\n\t\t\t\t\t// So don't :)\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tguards: {\n\t\t\t\tisDefinitelyNotDead: (ctx) => !ctx.isMaybeDead,\n\t\t\t},\n\t\t},\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,oBAKO;AA+BD,SAAU,uBACf,iBAA4C,CAAA,GAAE;AAE9C,aAAO,u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QAAQ;YACR,aAAS,sBAAO,EAAE,aAAa,MAAK,CAAE;;;;MAIzC,OAAO;;;;;KAMT;IACC,QAAQ;MACP,qBAAqB,wBAAC,QAAQ,CAAC,IAAI,aAAd;;GAEtB;AAEH;AAnDgB;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -24,6 +25,9 @@ __export(NodeStatistics_exports, {
24
25
  module.exports = __toCommonJS(NodeStatistics_exports);
25
26
  var import_Statistics = require("../driver/Statistics.js");
26
27
  class NodeStatisticsHost extends import_Statistics.StatisticsHost {
28
+ static {
29
+ __name(this, "NodeStatisticsHost");
30
+ }
27
31
  getAdditionalEventArgs() {
28
32
  return [this];
29
33
  }
@@ -45,6 +49,7 @@ function routeStatisticsEquals(r1, r2) {
45
49
  }
46
50
  return true;
47
51
  }
52
+ __name(routeStatisticsEquals, "routeStatisticsEquals");
48
53
  // Annotate the CommonJS export names for ESM import in node:
49
54
  0 && (module.exports = {
50
55
  NodeStatisticsHost,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/node/NodeStatistics.ts"],
4
4
  "sourcesContent": ["import type { ProtocolDataRate, RSSI } from \"@zwave-js/core\";\nimport { StatisticsHost } from \"../driver/Statistics.js\";\n\nexport class NodeStatisticsHost extends StatisticsHost<NodeStatistics> {\n\tgetAdditionalEventArgs(): any[] {\n\t\t// The node events include the node as the first argument\n\t\treturn [this];\n\t}\n\n\tcreateEmpty(): NodeStatistics {\n\t\treturn {\n\t\t\tcommandsTX: 0,\n\t\t\tcommandsRX: 0,\n\t\t\tcommandsDroppedRX: 0,\n\t\t\tcommandsDroppedTX: 0,\n\t\t\ttimeoutResponse: 0,\n\t\t};\n\t}\n}\n\n/** Statistics about the communication with a node since the last reset or driver startup */\nexport interface NodeStatistics {\n\t/** No. of commands successfully sent to the node */\n\tcommandsTX: number;\n\t/** No. of commands received from the node, including responses to the sent commands */\n\tcommandsRX: number;\n\t/** No. of commands from the node that were dropped by the host */\n\tcommandsDroppedRX: number;\n\t/** No. of outgoing commands that were dropped because they could not be sent */\n\t// TODO: distinguish between NoACK and send failures\n\tcommandsDroppedTX: number;\n\t/** No. of Get-type commands where the node's response did not come in time */\n\ttimeoutResponse: number;\n\n\t/**\n\t * Average round-trip-time in ms of commands to this node.\n\t * Consecutive measurements are combined using an exponential moving average.\n\t */\n\trtt?: number;\n\n\t/**\n\t * Average RSSI of frames received by this node in dBm.\n\t * Consecutive non-error measurements are combined using an exponential moving average.\n\t */\n\trssi?: RSSI;\n\n\t/** The last working route from the controller to this node. */\n\tlwr?: RouteStatistics;\n\t/** The next to last working route from the controller to this node. */\n\tnlwr?: RouteStatistics;\n\n\t/** The last time a command was received from or successfully sent to the node. */\n\tlastSeen?: Date;\n}\n\nexport interface RouteStatistics {\n\t/** The protocol and used data rate for this route */\n\tprotocolDataRate?: ProtocolDataRate;\n\t/** Which nodes are repeaters for this route */\n\trepeaters: number[];\n\n\t/** The RSSI of the ACK frame received by the controller */\n\trssi?: RSSI;\n\t/**\n\t * The RSSI of the ACK frame received by each repeater.\n\t * If this is set, it has the same length as the repeaters array.\n\t */\n\trepeaterRSSI?: RSSI[];\n\n\t/**\n\t * The node IDs of the nodes between which the transmission failed most recently.\n\t * Is only set if there recently was a transmission failure.\n\t */\n\trouteFailedBetween?: [number, number];\n}\n\n/** Checks if the given route statistics belong to the same route */\nexport function routeStatisticsEquals(\n\tr1: RouteStatistics,\n\tr2: RouteStatistics,\n): boolean {\n\tif (r1.repeaters.length !== r2.repeaters.length) return false;\n\tif (!r1.repeaters.every((node) => r2.repeaters.includes(node))) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AACA;;;;;;AAAA,wBAA+B;AAEzB,MAAO,2BAA2B,iCAA8B;EACrE,yBAAsB;AAErB,WAAO,CAAC,IAAI;EACb;EAEA,cAAW;AACV,WAAO;MACN,YAAY;MACZ,YAAY;MACZ,mBAAmB;MACnB,mBAAmB;MACnB,iBAAiB;;EAEnB;;AA4DK,SAAU,sBACf,IACA,IAAmB;AAEnB,MAAI,GAAG,UAAU,WAAW,GAAG,UAAU;AAAQ,WAAO;AACxD,MAAI,CAAC,GAAG,UAAU,MAAM,CAAC,SAAS,GAAG,UAAU,SAAS,IAAI,CAAC,GAAG;AAC/D,WAAO;EACR;AACA,SAAO;AACR;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;;AAAA,wBAA+B;AAEzB,MAAO,2BAA2B,iCAA8B;EAFtE,OAEsE;;;EACrE,yBAAsB;AAErB,WAAO,CAAC,IAAI;EACb;EAEA,cAAW;AACV,WAAO;MACN,YAAY;MACZ,YAAY;MACZ,mBAAmB;MACnB,mBAAmB;MACnB,iBAAiB;;EAEnB;;AA4DK,SAAU,sBACf,IACA,IAAmB;AAEnB,MAAI,GAAG,UAAU,WAAW,GAAG,UAAU;AAAQ,WAAO;AACxD,MAAI,CAAC,GAAG,UAAU,MAAM,CAAC,SAAS,GAAG,UAAU,SAAS,IAAI,CAAC,GAAG;AAC/D,WAAO;EACR;AACA,SAAO;AACR;AATgB;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -34,6 +35,7 @@ const statusDict = {
34
35
  function nodeStatusMachineStateToNodeStatus(state) {
35
36
  return statusDict[state] ?? import_Types.NodeStatus.Unknown;
36
37
  }
38
+ __name(nodeStatusMachineStateToNodeStatus, "nodeStatusMachineStateToNodeStatus");
37
39
  function createNodeStatusMachine(node) {
38
40
  return (0, import_xstate.Machine)({
39
41
  id: "nodeStatus",
@@ -92,11 +94,12 @@ function createNodeStatusMachine(node) {
92
94
  }
93
95
  }, {
94
96
  guards: {
95
- canSleep: () => !!node.canSleep,
96
- cannotSleep: () => !node.canSleep
97
+ canSleep: /* @__PURE__ */ __name(() => !!node.canSleep, "canSleep"),
98
+ cannotSleep: /* @__PURE__ */ __name(() => !node.canSleep, "cannotSleep")
97
99
  }
98
100
  });
99
101
  }
102
+ __name(createNodeStatusMachine, "createNodeStatusMachine");
100
103
  // Annotate the CommonJS export names for ESM import in node:
101
104
  0 && (module.exports = {
102
105
  createNodeStatusMachine,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/node/NodeStatusMachine.ts"],
4
4
  "sourcesContent": ["import { type InterpreterFrom, Machine, type StateMachine } from \"xstate\";\nimport { NodeStatus } from \"./_Types.js\";\nimport { type NodeNetworkRole } from \"./mixins/01_NetworkRole.js\";\n\nexport interface NodeStatusStateSchema {\n\tstates: {\n\t\tunknown: object;\n\t\t// non-sleeping nodes are either dead or alive\n\t\tdead: object;\n\t\talive: object;\n\t\t// sleeping nodes are asleep or awake\n\t\tasleep: object;\n\t\tawake: object;\n\t};\n}\n\nconst statusDict = {\n\tunknown: NodeStatus.Unknown,\n\tdead: NodeStatus.Dead,\n\talive: NodeStatus.Alive,\n\tasleep: NodeStatus.Asleep,\n\tawake: NodeStatus.Awake,\n} as const;\nexport function nodeStatusMachineStateToNodeStatus(\n\tstate: keyof NodeStatusStateSchema[\"states\"],\n): NodeStatus {\n\treturn statusDict[state] ?? NodeStatus.Unknown;\n}\n\nexport type NodeStatusEvent =\n\t| { type: \"DEAD\" }\n\t| { type: \"ALIVE\" }\n\t| { type: \"ASLEEP\" }\n\t| { type: \"AWAKE\" };\n\nexport type NodeStatusMachine = StateMachine<\n\tany,\n\tNodeStatusStateSchema,\n\tNodeStatusEvent,\n\tany,\n\tany,\n\tany,\n\tany\n>;\nexport type NodeStatusInterpreter = InterpreterFrom<NodeStatusMachine>;\n\nexport function createNodeStatusMachine(\n\tnode: NodeNetworkRole,\n): NodeStatusMachine {\n\treturn Machine<any, NodeStatusStateSchema, NodeStatusEvent>(\n\t\t{\n\t\t\tid: \"nodeStatus\",\n\t\t\tinitial: \"unknown\",\n\t\t\tstates: {\n\t\t\t\tunknown: {\n\t\t\t\t\ton: {\n\t\t\t\t\t\tDEAD: {\n\t\t\t\t\t\t\ttarget: \"dead\",\n\t\t\t\t\t\t\tcond: \"cannotSleep\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tALIVE: {\n\t\t\t\t\t\t\ttarget: \"alive\",\n\t\t\t\t\t\t\tcond: \"cannotSleep\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tASLEEP: {\n\t\t\t\t\t\t\ttarget: \"asleep\",\n\t\t\t\t\t\t\tcond: \"canSleep\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tAWAKE: {\n\t\t\t\t\t\t\ttarget: \"awake\",\n\t\t\t\t\t\t\tcond: \"canSleep\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdead: {\n\t\t\t\t\ton: {\n\t\t\t\t\t\tALIVE: \"alive\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\talive: {\n\t\t\t\t\ton: {\n\t\t\t\t\t\tDEAD: \"dead\",\n\t\t\t\t\t\t// GH#1054 we must have a way to send a node to sleep even if\n\t\t\t\t\t\t// it was previously detected as a non-sleeping device\n\t\t\t\t\t\tASLEEP: {\n\t\t\t\t\t\t\ttarget: \"asleep\",\n\t\t\t\t\t\t\tcond: \"canSleep\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tAWAKE: {\n\t\t\t\t\t\t\ttarget: \"awake\",\n\t\t\t\t\t\t\tcond: \"canSleep\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tasleep: {\n\t\t\t\t\ton: {\n\t\t\t\t\t\tAWAKE: \"awake\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tawake: {\n\t\t\t\t\ton: {\n\t\t\t\t\t\tASLEEP: \"asleep\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tguards: {\n\t\t\t\tcanSleep: () => !!node.canSleep,\n\t\t\t\tcannotSleep: () => !node.canSleep,\n\t\t\t},\n\t\t},\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;AAAA,oBAAiE;AACjE,mBAA2B;AAe3B,MAAM,aAAa;EAClB,SAAS,wBAAW;EACpB,MAAM,wBAAW;EACjB,OAAO,wBAAW;EAClB,QAAQ,wBAAW;EACnB,OAAO,wBAAW;;AAEb,SAAU,mCACf,OAA4C;AAE5C,SAAO,WAAW,KAAK,KAAK,wBAAW;AACxC;AAmBM,SAAU,wBACf,MAAqB;AAErB,aAAO,uBACN;IACC,IAAI;IACJ,SAAS;IACT,QAAQ;MACP,SAAS;QACR,IAAI;UACH,MAAM;YACL,QAAQ;YACR,MAAM;;UAEP,OAAO;YACN,QAAQ;YACR,MAAM;;UAEP,QAAQ;YACP,QAAQ;YACR,MAAM;;UAEP,OAAO;YACN,QAAQ;YACR,MAAM;;;;MAIT,MAAM;QACL,IAAI;UACH,OAAO;;;MAGT,OAAO;QACN,IAAI;UACH,MAAM;;;UAGN,QAAQ;YACP,QAAQ;YACR,MAAM;;UAEP,OAAO;YACN,QAAQ;YACR,MAAM;;;;MAIT,QAAQ;QACP,IAAI;UACH,OAAO;;;MAGT,OAAO;QACN,IAAI;UACH,QAAQ;;;;KAKZ;IACC,QAAQ;MACP,UAAU,MAAM,CAAC,CAAC,KAAK;MACvB,aAAa,MAAM,CAAC,KAAK;;GAE1B;AAEH;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAAA,oBAAiE;AACjE,mBAA2B;AAe3B,MAAM,aAAa;EAClB,SAAS,wBAAW;EACpB,MAAM,wBAAW;EACjB,OAAO,wBAAW;EAClB,QAAQ,wBAAW;EACnB,OAAO,wBAAW;;AAEb,SAAU,mCACf,OAA4C;AAE5C,SAAO,WAAW,KAAK,KAAK,wBAAW;AACxC;AAJgB;AAuBV,SAAU,wBACf,MAAqB;AAErB,aAAO,uBACN;IACC,IAAI;IACJ,SAAS;IACT,QAAQ;MACP,SAAS;QACR,IAAI;UACH,MAAM;YACL,QAAQ;YACR,MAAM;;UAEP,OAAO;YACN,QAAQ;YACR,MAAM;;UAEP,QAAQ;YACP,QAAQ;YACR,MAAM;;UAEP,OAAO;YACN,QAAQ;YACR,MAAM;;;;MAIT,MAAM;QACL,IAAI;UACH,OAAO;;;MAGT,OAAO;QACN,IAAI;UACH,MAAM;;;UAGN,QAAQ;YACP,QAAQ;YACR,MAAM;;UAEP,OAAO;YACN,QAAQ;YACR,MAAM;;;;MAIT,QAAQ;QACP,IAAI;UACH,OAAO;;;MAGT,OAAO;QACN,IAAI;UACH,QAAQ;;;;KAKZ;IACC,QAAQ;MACP,UAAU,6BAAM,CAAC,CAAC,KAAK,UAAb;MACV,aAAa,6BAAM,CAAC,KAAK,UAAZ;;GAEd;AAEH;AAnEgB;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -28,6 +29,9 @@ var import_arrays = require("alcalzone-shared/arrays");
28
29
  var import_MultiCCAPIWrapper = require("./MultiCCAPIWrapper.js");
29
30
  var import_VirtualNode = require("./VirtualNode.js");
30
31
  class VirtualEndpoint {
32
+ static {
33
+ __name(this, "VirtualEndpoint");
34
+ }
31
35
  driver;
32
36
  index;
33
37
  constructor(node, driver, index) {
@@ -77,7 +81,7 @@ class VirtualEndpoint {
77
81
  * @param ccId The command class to create an API instance for
78
82
  */
79
83
  createAPI(ccId) {
80
- const createCCAPI = (endpoint, secClass) => {
84
+ const createCCAPI = /* @__PURE__ */ __name((endpoint, secClass) => {
81
85
  if ((0, import_safe.securityClassIsS2)(secClass) && endpoint.node.physicalNodes.length > 1) {
82
86
  const secMan = this.driver.getSecurityManager2(endpoint.node.physicalNodes[0].id);
83
87
  return import_cc.CCAPI.create(ccId, this.driver, endpoint).withOptions({
@@ -86,7 +90,7 @@ class VirtualEndpoint {
86
90
  } else {
87
91
  return import_cc.CCAPI.create(ccId, this.driver, endpoint);
88
92
  }
89
- };
93
+ }, "createCCAPI");
90
94
  if (this.node.hasMixedSecurityClasses) {
91
95
  const apiInstances = [
92
96
  ...this.node.nodesBySecurityClass.entries()
@@ -103,7 +107,7 @@ class VirtualEndpoint {
103
107
  }
104
108
  _commandClassAPIs = /* @__PURE__ */ new Map();
105
109
  _commandClassAPIsProxy = new Proxy(this._commandClassAPIs, {
106
- get: (target, ccNameOrId) => {
110
+ get: /* @__PURE__ */ __name((target, ccNameOrId) => {
107
111
  if (process.env.NODE_ENV === "test" && typeof ccNameOrId === "string" && (ccNameOrId === "$$typeof" || ccNameOrId === "constructor" || ccNameOrId.includes("@@__IMMUTABLE"))) {
108
112
  return void 0;
109
113
  }
@@ -125,7 +129,7 @@ class VirtualEndpoint {
125
129
  }
126
130
  return target.get(ccId);
127
131
  }
128
- }
132
+ }, "get")
129
133
  });
130
134
  /**
131
135
  * Used to iterate over the commandClasses API without throwing errors by accessing unsupported CCs
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/node/VirtualEndpoint.ts"],
4
4
  "sourcesContent": ["import {\n\ttype APIMethodsOf,\n\tCCAPI,\n\ttype CCAPIs,\n\ttype CCNameOrId,\n\tPhysicalCCAPI,\n\ttype VirtualCCAPIEndpoint,\n\tgetAPI,\n\tnormalizeCCNameOrId,\n} from \"@zwave-js/cc\";\nimport {\n\ttype CommandClasses,\n\ttype MulticastDestination,\n\ttype SecurityClass,\n\ttype SupportsCC,\n\ttype VirtualEndpointId,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tsecurityClassIsS2,\n} from \"@zwave-js/core/safe\";\nimport { staticExtends } from \"@zwave-js/shared/safe\";\nimport { distinct } from \"alcalzone-shared/arrays\";\nimport type { Driver } from \"../driver/Driver.js\";\nimport { createMultiCCAPIWrapper } from \"./MultiCCAPIWrapper.js\";\nimport { VirtualNode } from \"./VirtualNode.js\";\n\n/**\n * Represents an endpoint of a virtual (broadcast, multicast) Z-Wave node.\n * This can either be the root device itself (index 0) or a more specific endpoint like a single plug.\n *\n * The endpoint's capabilities are determined by the capabilities of the individual nodes' endpoints.\n */\nexport class VirtualEndpoint implements VirtualEndpointId, SupportsCC {\n\tpublic constructor(\n\t\t/** The virtual node this endpoint belongs to */\n\t\tnode: VirtualNode | undefined,\n\t\t/** The driver instance this endpoint belongs to */\n\t\tprotected readonly driver: Driver,\n\t\t/** The index of this endpoint. 0 for the root device, 1+ otherwise */\n\t\tpublic readonly index: number,\n\t) {\n\t\tif (node) this._node = node;\n\t}\n\n\t/** Required by {@link IZWaveEndpoint} */\n\tpublic readonly virtual = true;\n\n\t/** The virtual node this endpoint belongs to */\n\tprivate _node!: VirtualNode;\n\tpublic get node(): VirtualNode {\n\t\treturn this._node;\n\t}\n\tprotected setNode(node: VirtualNode): void {\n\t\tthis._node = node;\n\t}\n\n\tpublic get nodeId(): number | MulticastDestination {\n\t\t// Use the defined node ID if it exists\n\t\tif (this.node.id != undefined) return this.node.id;\n\t\t// Otherwise deduce it from the physical nodes\n\t\tconst ret = this.node.physicalNodes.map((n) => n.id);\n\t\tif (ret.length === 1) return ret[0];\n\t\treturn ret as MulticastDestination;\n\t}\n\n\t/** Tests if this endpoint supports the given CommandClass */\n\tpublic supportsCC(cc: CommandClasses): boolean {\n\t\t// A virtual endpoints supports a CC if any of the physical endpoints it targets supports the CC non-securely\n\t\treturn this.node.physicalNodes.some((n) => {\n\t\t\tconst endpoint = n.getEndpoint(this.index);\n\t\t\treturn endpoint?.supportsCC(cc);\n\t\t});\n\t}\n\n\t/**\n\t * Retrieves the minimum non-zero version of the given CommandClass the physical endpoints implement\n\t * Returns 0 if the CC is not supported at all.\n\t */\n\tpublic getCCVersion(cc: CommandClasses): number {\n\t\tconst nonZeroVersions = this.node.physicalNodes\n\t\t\t.map((n) => n.getEndpoint(this.index)?.getCCVersion(cc))\n\t\t\t.filter((v): v is number => v != undefined && v > 0);\n\t\tif (!nonZeroVersions.length) return 0;\n\t\treturn Math.min(...nonZeroVersions);\n\t}\n\n\t/**\n\t * @internal\n\t * Creates an API instance for a given command class. Throws if no API is defined.\n\t * @param ccId The command class to create an API instance for\n\t */\n\tpublic createAPI(ccId: CommandClasses): CCAPI {\n\t\tconst createCCAPI = (\n\t\t\tendpoint: VirtualCCAPIEndpoint,\n\t\t\tsecClass: SecurityClass,\n\t\t) => {\n\t\t\tif (\n\t\t\t\tsecurityClassIsS2(secClass)\n\t\t\t\t// No need to do multicast if there is only one node\n\t\t\t\t&& endpoint.node.physicalNodes.length > 1\n\t\t\t) {\n\t\t\t\t// The API for S2 needs to know the multicast group ID\n\t\t\t\tconst secMan = this.driver.getSecurityManager2(\n\t\t\t\t\tendpoint.node.physicalNodes[0].id,\n\t\t\t\t);\n\t\t\t\treturn CCAPI.create(ccId, this.driver, endpoint).withOptions({\n\t\t\t\t\ts2MulticastGroupId: secMan?.createMulticastGroup(\n\t\t\t\t\t\tendpoint.node.physicalNodes.map((n) => n.id),\n\t\t\t\t\t\tsecClass,\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn CCAPI.create(ccId, this.driver, endpoint);\n\t\t\t}\n\t\t};\n\t\t// For mixed security classes, we need to create a wrapper\n\t\t// that handles calling multiple API instances\n\t\tif (this.node.hasMixedSecurityClasses) {\n\t\t\tconst apiInstances = [\n\t\t\t\t...this.node.nodesBySecurityClass.entries(),\n\t\t\t].map(([secClass, nodes]) => {\n\t\t\t\t// We need a separate virtual endpoint for each security class, so the API instances\n\t\t\t\t// access the correct nodes.\n\t\t\t\tconst node = new VirtualNode(this.node.id, this.driver, nodes);\n\t\t\t\tconst endpoint = node.getEndpoint(this.index) ?? node;\n\t\t\t\treturn createCCAPI(endpoint, secClass);\n\t\t\t});\n\t\t\treturn createMultiCCAPIWrapper(apiInstances);\n\t\t} else {\n\t\t\t// The node has a single security class, just reuse it\n\t\t\tconst securityClass = [...this.node.nodesBySecurityClass.keys()][0];\n\t\t\treturn createCCAPI(this, securityClass);\n\t\t}\n\t}\n\n\tprivate _commandClassAPIs = new Map<CommandClasses, CCAPI>();\n\tprivate _commandClassAPIsProxy = new Proxy(this._commandClassAPIs, {\n\t\tget: (target, ccNameOrId: string | symbol) => {\n\t\t\t// Avoid ultra-weird error messages during testing\n\t\t\tif (\n\t\t\t\tprocess.env.NODE_ENV === \"test\"\n\t\t\t\t&& typeof ccNameOrId === \"string\"\n\t\t\t\t&& (ccNameOrId === \"$$typeof\"\n\t\t\t\t\t|| ccNameOrId === \"constructor\"\n\t\t\t\t\t|| ccNameOrId.includes(\"@@__IMMUTABLE\"))\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (typeof ccNameOrId === \"symbol\") {\n\t\t\t\t// Allow access to the iterator symbol\n\t\t\t\tif (ccNameOrId === Symbol.iterator) {\n\t\t\t\t\treturn this.commandClassesIterator;\n\t\t\t\t} else if (ccNameOrId === Symbol.toStringTag) {\n\t\t\t\t\treturn \"[object Object]\";\n\t\t\t\t}\n\t\t\t\t// ignore all other symbols\n\t\t\t\treturn undefined;\n\t\t\t} else {\n\t\t\t\t// The command classes are exposed to library users by their name or the ID\n\t\t\t\tconst ccId = normalizeCCNameOrId(ccNameOrId);\n\t\t\t\tif (ccId == undefined) {\n\t\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\t`Command Class ${ccNameOrId} is not implemented!`,\n\t\t\t\t\t\tZWaveErrorCodes.CC_NotImplemented,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// When accessing a CC API for the first time, we need to create it\n\t\t\t\tif (!target.has(ccId)) {\n\t\t\t\t\tconst api = this.createAPI(ccId);\n\t\t\t\t\ttarget.set(ccId, api);\n\t\t\t\t}\n\t\t\t\treturn target.get(ccId);\n\t\t\t}\n\t\t},\n\t});\n\n\t/**\n\t * Used to iterate over the commandClasses API without throwing errors by accessing unsupported CCs\n\t */\n\tprivate readonly commandClassesIterator: () => Iterator<CCAPI> = function*(\n\t\tthis: VirtualEndpoint,\n\t) {\n\t\tconst allCCs = distinct(\n\t\t\tthis._node.physicalNodes\n\t\t\t\t.map((n) => n.getEndpoint(this.index))\n\t\t\t\t.filter((e) => !!e)\n\t\t\t\t.flatMap((e) => [...e.implementedCommandClasses.keys()]),\n\t\t);\n\t\tfor (const cc of allCCs) {\n\t\t\tif (this.supportsCC(cc)) {\n\t\t\t\t// When a CC is supported, it can still happen that the CC API\n\t\t\t\t// cannot be created for virtual endpoints\n\t\t\t\tconst APIConstructor = getAPI(cc);\n\t\t\t\tif (staticExtends(APIConstructor, PhysicalCCAPI)) continue;\n\t\t\t\tyield (this.commandClasses as any)[cc];\n\t\t\t}\n\t\t}\n\t}.bind(this);\n\n\t/**\n\t * Provides access to simplified APIs that are tailored to specific CCs.\n\t * Make sure to check support of each API using `API.isSupported()` since\n\t * all other API calls will throw if the API is not supported\n\t */\n\tpublic get commandClasses(): CCAPIs {\n\t\treturn this._commandClassAPIsProxy as unknown as CCAPIs;\n\t}\n\n\t/** Allows checking whether a CC API is supported before calling it with {@link VirtualEndpoint.invokeCCAPI} */\n\tpublic supportsCCAPI(cc: CommandClasses): boolean {\n\t\t// No need to validate the `cc` parameter, the following line will throw for invalid CCs\n\t\treturn ((this.commandClasses as any)[cc] as CCAPI).isSupported();\n\t}\n\n\t/**\n\t * Allows dynamically calling any CC API method on this virtual endpoint by CC ID and method name.\n\t * Use {@link VirtualEndpoint.supportsCCAPI} to check support first.\n\t *\n\t * **Warning:** Get-type commands are not supported, even if auto-completion indicates that they are.\n\t */\n\tpublic invokeCCAPI<\n\t\tCC extends CCNameOrId,\n\t\tTMethod extends keyof TAPI,\n\t\tTAPI extends Record<\n\t\t\tstring,\n\t\t\t(...args: any[]) => any\n\t\t> = CommandClasses extends CC ? any\n\t\t\t: Omit<CCNameOrId, CommandClasses> extends CC ? any\n\t\t\t: APIMethodsOf<CC>,\n\t>(\n\t\tcc: CC,\n\t\tmethod: TMethod,\n\t\t...args: Parameters<TAPI[TMethod]>\n\t): ReturnType<TAPI[TMethod]> {\n\t\t// No need to validate the `cc` parameter, the following line will throw for invalid CCs\n\t\tconst CCAPI = (this.commandClasses as any)[cc];\n\t\tconst ccId = normalizeCCNameOrId(cc)!;\n\t\tconst ccName = getCCName(ccId);\n\t\tif (!CCAPI) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`The API for the ${ccName} CC does not exist or is not implemented!`,\n\t\t\t\tZWaveErrorCodes.CC_NoAPI,\n\t\t\t);\n\t\t}\n\n\t\tconst apiMethod = CCAPI[method];\n\t\tif (typeof apiMethod !== \"function\") {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Method \"${method as string}\" does not exist on the API for the ${ccName} CC!`,\n\t\t\t\tZWaveErrorCodes.CC_NotImplemented,\n\t\t\t);\n\t\t}\n\t\treturn apiMethod.apply(CCAPI, args);\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA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EAAE,YAAY,KAAK,KAAK,CAAC,EACpC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EACjB,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,0BAA0B,KAAI,CAAE,CAAC,CAAC;AAE1D,eAAW,MAAM,QAAQ;AACxB,UAAI,KAAK,WAAW,EAAE,GAAG;AAGxB,cAAM,qBAAiB,kBAAO,EAAE;AAChC,gBAAI,4BAAc,gBAAgB,uBAAa;AAAG;AAClD,cAAO,KAAK,eAAuB,EAAE;MACtC;IACD;EACD,EAAE,KAAK,IAAI;;;;;;EAOX,IAAW,iBAAc;AACxB,WAAO,KAAK;EACb;;EAGO,cAAc,IAAkB;AAEtC,WAAS,KAAK,eAAuB,EAAE,EAAY,YAAW;EAC/D;;;;;;;EAQO,YAUN,IACA,WACG,MAA+B;AAGlC,UAAMC,SAAS,KAAK,eAAuB,EAAE;AAC7C,UAAM,WAAO,+BAAoB,EAAE;AACnC,UAAM,aAAS,uBAAU,IAAI;AAC7B,QAAI,CAACA,QAAO;AACX,YAAM,IAAI,uBACT,mBAAmB,MAAM,6CACzB,4BAAgB,QAAQ;IAE1B;AAEA,UAAM,YAAYA,OAAM,MAAM;AAC9B,QAAI,OAAO,cAAc,YAAY;AACpC,YAAM,IAAI,uBACT,WAAW,MAAgB,uCAAuC,MAAM,QACxE,4BAAgB,iBAAiB;IAEnC;AACA,WAAO,UAAU,MAAMA,QAAO,IAAI;EACnC;;",
6
6
  "names": ["import_safe", "CCAPI"]
7
7
  }
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -40,7 +41,11 @@ function groupNodesBySecurityClass(nodes) {
40
41
  }
41
42
  return ret;
42
43
  }
44
+ __name(groupNodesBySecurityClass, "groupNodesBySecurityClass");
43
45
  class VirtualNode extends import_VirtualEndpoint.VirtualEndpoint {
46
+ static {
47
+ __name(this, "VirtualNode");
48
+ }
44
49
  id;
45
50
  constructor(id, driver, physicalNodes) {
46
51
  super(void 0, driver, 0);
@@ -88,7 +93,7 @@ class VirtualNode extends import_VirtualEndpoint.VirtualEndpoint {
88
93
  if (hooks?.supervisionDelayedUpdates) {
89
94
  api = api.withOptions({
90
95
  requestStatusUpdates: true,
91
- onUpdate: async (update) => {
96
+ onUpdate: /* @__PURE__ */ __name(async (update) => {
92
97
  try {
93
98
  if (update.status === import_core.SupervisionStatus.Success) {
94
99
  await hooks.supervisionOnSuccess();
@@ -97,7 +102,7 @@ class VirtualNode extends import_VirtualEndpoint.VirtualEndpoint {
97
102
  }
98
103
  } catch {
99
104
  }
100
- }
105
+ }, "onUpdate")
101
106
  });
102
107
  }
103
108
  if (typeof options?.onProgress === "function") {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/node/VirtualNode.ts"],
4
4
  "sourcesContent": ["import {\n\tBasicCCValues,\n\ttype CCAPI,\n\ttype SetValueAPIOptions,\n\ttype ValueIDProperties,\n} from \"@zwave-js/cc\";\nimport {\n\ttype SetValueResult,\n\tSetValueStatus,\n\tsupervisionResultToSetValueResult,\n} from \"@zwave-js/cc/safe\";\nimport {\n\tSecurityClass,\n\tSupervisionStatus,\n\ttype TranslatedValueID,\n\ttype ValueID,\n\ttype ValueMetadata,\n\ttype ValueMetadataNumeric,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tactuatorCCs,\n\tgetCCName,\n\tisSupervisionResult,\n\tisZWaveError,\n\tnormalizeValueID,\n\tsupervisedCommandSucceeded,\n\tvalueIdToString,\n} from \"@zwave-js/core\";\nimport { distinct } from \"alcalzone-shared/arrays\";\nimport type { Driver } from \"../driver/Driver.js\";\nimport type { ZWaveNode } from \"./Node.js\";\nimport { VirtualEndpoint } from \"./VirtualEndpoint.js\";\n\nexport interface VirtualValueID extends TranslatedValueID {\n\t/** The metadata that belongs to this virtual value ID */\n\tmetadata: ValueMetadata;\n\t/** The maximum supported CC version among all nodes targeted by this virtual value ID */\n\tccVersion: number;\n}\n\nfunction groupNodesBySecurityClass(\n\tnodes: Iterable<ZWaveNode>,\n): Map<SecurityClass, ZWaveNode[]> {\n\tconst ret = new Map<SecurityClass, ZWaveNode[]>();\n\n\tfor (const node of nodes) {\n\t\tconst secClass = node.getHighestSecurityClass();\n\t\tif (secClass === SecurityClass.Temporary || secClass == undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!ret.has(secClass)) {\n\t\t\tret.set(secClass, []);\n\t\t}\n\t\tret.get(secClass)!.push(node);\n\t}\n\n\treturn ret;\n}\n\nexport class VirtualNode extends VirtualEndpoint {\n\tpublic constructor(\n\t\tpublic readonly id: number | undefined,\n\t\tdriver: Driver,\n\t\t/** The references to the physical node this virtual node abstracts */\n\t\tphysicalNodes: Iterable<ZWaveNode>,\n\t) {\n\t\t// Define this node's intrinsic endpoint as the root device (0)\n\t\tsuper(undefined, driver, 0);\n\t\t// Set the reference to this and the physical nodes\n\t\tsuper.setNode(this);\n\t\tthis.physicalNodes = [...physicalNodes].filter(\n\t\t\t(n) =>\n\t\t\t\t// And avoid including the controller node in the support checks\n\t\t\t\tn.id !== driver.controller.ownNodeId\n\t\t\t\t// And omit nodes using Security S0 which does not support broadcast / multicast\n\t\t\t\t&& n.getHighestSecurityClass() !== SecurityClass.S0_Legacy,\n\t\t);\n\t\tthis.nodesBySecurityClass = groupNodesBySecurityClass(\n\t\t\tthis.physicalNodes,\n\t\t);\n\n\t\t// If broadcasting is attempted with mixed security classes, automatically fall back to multicast\n\t\tif (this.hasMixedSecurityClasses) this.id = undefined;\n\t}\n\n\tpublic readonly physicalNodes: readonly ZWaveNode[];\n\tpublic readonly nodesBySecurityClass: ReadonlyMap<\n\t\tSecurityClass,\n\t\treadonly ZWaveNode[]\n\t>;\n\n\tpublic get hasMixedSecurityClasses(): boolean {\n\t\treturn this.nodesBySecurityClass.size > 1;\n\t}\n\n\t/**\n\t * Updates a value for a given property of a given CommandClass.\n\t * This will communicate with the physical node(s) this virtual node represents!\n\t */\n\tpublic async setValue(\n\t\tvalueId: ValueID,\n\t\tvalue: unknown,\n\t\toptions?: SetValueAPIOptions,\n\t): Promise<SetValueResult> {\n\t\t// Ensure we're dealing with a valid value ID, with no extra properties\n\t\tvalueId = normalizeValueID(valueId);\n\n\t\t// Try to retrieve the corresponding CC API\n\t\ttry {\n\t\t\t// Access the CC API by name\n\t\t\tconst endpointInstance = this.getEndpoint(valueId.endpoint || 0);\n\t\t\tif (!endpointInstance) {\n\t\t\t\treturn {\n\t\t\t\t\tstatus: SetValueStatus.EndpointNotFound,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Endpoint ${valueId.endpoint} does not exist on virtual node ${\n\t\t\t\t\t\t\tthis.id ?? \"??\"\n\t\t\t\t\t\t}`,\n\t\t\t\t};\n\t\t\t}\n\t\t\tlet api = (endpointInstance.commandClasses as any)[\n\t\t\t\tvalueId.commandClass\n\t\t\t] as CCAPI;\n\t\t\t// Check if the setValue method is implemented\n\t\t\tif (!api.setValue) {\n\t\t\t\treturn {\n\t\t\t\t\tstatus: SetValueStatus.NotImplemented,\n\t\t\t\t\tmessage: `The ${\n\t\t\t\t\t\tgetCCName(\n\t\t\t\t\t\t\tvalueId.commandClass,\n\t\t\t\t\t\t)\n\t\t\t\t\t} CC does not support setting values`,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst valueIdProps: ValueIDProperties = {\n\t\t\t\tproperty: valueId.property,\n\t\t\t\tpropertyKey: valueId.propertyKey,\n\t\t\t};\n\n\t\t\tconst hooks = api.setValueHooks?.(valueIdProps, value, options);\n\n\t\t\tif (hooks?.supervisionDelayedUpdates) {\n\t\t\t\tapi = api.withOptions({\n\t\t\t\t\trequestStatusUpdates: true,\n\t\t\t\t\tonUpdate: async (update) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (update.status === SupervisionStatus.Success) {\n\t\t\t\t\t\t\t\tawait hooks.supervisionOnSuccess();\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tupdate.status === SupervisionStatus.Fail\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tawait hooks.supervisionOnFailure();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// TODO: Log error?\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// If the caller wants progress updates, they shall have them\n\t\t\tif (typeof options?.onProgress === \"function\") {\n\t\t\t\tapi = api.withOptions({\n\t\t\t\t\tonProgress: options.onProgress,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// And call it\n\t\t\tconst result = await api.setValue!.call(\n\t\t\t\tapi,\n\t\t\t\tvalueIdProps,\n\t\t\t\tvalue,\n\t\t\t\toptions,\n\t\t\t);\n\n\t\t\tif (api.isSetValueOptimistic(valueId)) {\n\t\t\t\t// If the call did not throw, assume that the call was successful and remember the new value\n\t\t\t\t// for each node that was affected by this command\n\t\t\t\tconst affectedNodes = this.physicalNodes\n\t\t\t\t\t.filter((node) =>\n\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t.getEndpoint(endpointInstance.index)\n\t\t\t\t\t\t\t?.supportsCC(valueId.commandClass)\n\t\t\t\t\t);\n\t\t\t\tfor (const node of affectedNodes) {\n\t\t\t\t\tnode.valueDB.setValue(valueId, value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Depending on the settings of the SET_VALUE implementation, we may have to\n\t\t\t// optimistically update a different value and/or verify the changes\n\t\t\tif (hooks) {\n\t\t\t\tconst supervisedAndSuccessful = isSupervisionResult(result)\n\t\t\t\t\t&& result.status === SupervisionStatus.Success;\n\n\t\t\t\tconst shouldUpdateOptimistically =\n\t\t\t\t\tapi.isSetValueOptimistic(valueId)\n\t\t\t\t\t// For successful supervised commands, we know that an optimistic update is ok\n\t\t\t\t\t&& (supervisedAndSuccessful\n\t\t\t\t\t\t// For unsupervised commands that did not fail, we let the applciation decide whether\n\t\t\t\t\t\t// to update related value optimistically\n\t\t\t\t\t\t|| (!this.driver.options.disableOptimisticValueUpdate\n\t\t\t\t\t\t\t&& result == undefined));\n\n\t\t\t\t// The actual API implementation handles additional optimistic updates\n\t\t\t\tif (shouldUpdateOptimistically) {\n\t\t\t\t\thooks.optimisticallyUpdateRelatedValues?.(\n\t\t\t\t\t\tsupervisedAndSuccessful,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Verify the current value after a delay, unless...\n\t\t\t\t// ...the command was supervised and successful\n\t\t\t\t// ...and the CC API decides not to verify anyways\n\t\t\t\tif (\n\t\t\t\t\t!supervisedCommandSucceeded(result)\n\t\t\t\t\t|| hooks.forceVerifyChanges?.()\n\t\t\t\t) {\n\t\t\t\t\t// Let the CC API implementation handle the verification.\n\t\t\t\t\t// It may still decide not to do it.\n\t\t\t\t\tawait hooks.verifyChanges?.();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn supervisionResultToSetValueResult(result);\n\t\t} catch (e) {\n\t\t\t// Define which errors during setValue are expected and won't throw an error\n\t\t\tif (isZWaveError(e)) {\n\t\t\t\tlet result: SetValueResult | undefined;\n\t\t\t\tswitch (e.code) {\n\t\t\t\t\t// This CC or API is not implemented\n\t\t\t\t\tcase ZWaveErrorCodes.CC_NotImplemented:\n\t\t\t\t\tcase ZWaveErrorCodes.CC_NoAPI:\n\t\t\t\t\t\tresult = {\n\t\t\t\t\t\t\tstatus: SetValueStatus.NotImplemented,\n\t\t\t\t\t\t\tmessage: e.message,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t// A user tried to set an invalid value\n\t\t\t\t\tcase ZWaveErrorCodes.Argument_Invalid:\n\t\t\t\t\t\tresult = {\n\t\t\t\t\t\t\tstatus: SetValueStatus.InvalidValue,\n\t\t\t\t\t\t\tmessage: e.message,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (result) return result;\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\t/**\n\t * Returns a list of all value IDs and their metadata that can be used to\n\t * control the physical node(s) this virtual node represents.\n\t */\n\tpublic getDefinedValueIDs(): VirtualValueID[] {\n\t\t// In order to compare value ids, we need them to be strings\n\t\tconst ret = new Map<string, VirtualValueID>();\n\n\t\tfor (const pNode of this.physicalNodes) {\n\t\t\t// // Nodes using Security S0 cannot be used for broadcast\n\t\t\t// if (pNode.getHighestSecurityClass() === SecurityClass.S0_Legacy) {\n\t\t\t// \tcontinue;\n\t\t\t// }\n\n\t\t\t// Take only the actuator values\n\t\t\tconst valueIDs: TranslatedValueID[] = pNode\n\t\t\t\t.getDefinedValueIDs()\n\t\t\t\t.filter((v) => actuatorCCs.includes(v.commandClass));\n\t\t\t// And add them to the returned array if they aren't included yet or if the version is higher\n\n\t\t\tfor (const valueId of valueIDs) {\n\t\t\t\tconst mapKey = valueIdToString(valueId);\n\t\t\t\tconst ccVersion = pNode.getCCVersion(valueId.commandClass);\n\t\t\t\tconst metadata = pNode.getValueMetadata(valueId);\n\t\t\t\t// Don't expose read-only values for virtual nodes, they won't ever have any value\n\t\t\t\tif (!metadata.writeable) continue;\n\n\t\t\t\tconst needsUpdate = !ret.has(mapKey)\n\t\t\t\t\t|| ret.get(mapKey)!.ccVersion < ccVersion;\n\t\t\t\tif (needsUpdate) {\n\t\t\t\t\tret.set(mapKey, {\n\t\t\t\t\t\t...valueId,\n\t\t\t\t\t\tccVersion,\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\t\t// Metadata of virtual nodes is only writable\n\t\t\t\t\t\t\treadable: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Basic CC is not exposed, but virtual nodes need it to control multiple different devices together\n\t\tconst exposedEndpoints = distinct(\n\t\t\t[...ret.values()]\n\t\t\t\t.map((v) => v.endpoint)\n\t\t\t\t.filter((e) => e !== undefined),\n\t\t);\n\t\tfor (const endpoint of exposedEndpoints) {\n\t\t\t// TODO: This should be defined in the Basic CC file\n\t\t\tconst valueId: TranslatedValueID = {\n\t\t\t\t...BasicCCValues.targetValue.endpoint(endpoint),\n\t\t\t\tcommandClassName: \"Basic\",\n\t\t\t\tpropertyName: \"Target value\",\n\t\t\t};\n\t\t\tconst ccVersion = 1;\n\t\t\tconst metadata: ValueMetadataNumeric = {\n\t\t\t\t...BasicCCValues.targetValue.meta,\n\t\t\t\treadable: false,\n\t\t\t};\n\t\t\tret.set(valueIdToString(valueId), {\n\t\t\t\t...valueId,\n\t\t\t\tccVersion,\n\t\t\t\tmetadata,\n\t\t\t});\n\t\t}\n\n\t\treturn [...ret.values()];\n\t}\n\n\t/** Cache for this node's endpoint instances */\n\tprivate _endpointInstances = new Map<number, VirtualEndpoint>();\n\t/**\n\t * Returns an endpoint of this node with the given index. 0 returns the node itself.\n\t */\n\tpublic getEndpoint(index: 0): VirtualEndpoint;\n\tpublic getEndpoint(index: number): VirtualEndpoint | undefined;\n\tpublic getEndpoint(index: number): VirtualEndpoint | undefined {\n\t\tif (index < 0) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The endpoint index must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\t// Zero is the root endpoint - i.e. this node\n\t\tif (index === 0) return this;\n\t\t// Check if the Multi Channel CC interviews for all nodes are completed,\n\t\t// because we don't have all the information before that\n\t\tif (!this.isMultiChannelInterviewComplete) {\n\t\t\tthis.driver.driverLog.print(\n\t\t\t\t`Virtual node ${\n\t\t\t\t\tthis.id ?? \"??\"\n\t\t\t\t}, Endpoint ${index}: Trying to access endpoint instance before the Multi Channel interview of all nodes was completed!`,\n\t\t\t\t\"error\",\n\t\t\t);\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Check if the requested endpoint exists on any physical node\n\t\tif (index > this.getEndpointCount()) return undefined;\n\t\t// Create an endpoint instance if it does not exist\n\t\tif (!this._endpointInstances.has(index)) {\n\t\t\tthis._endpointInstances.set(\n\t\t\t\tindex,\n\t\t\t\tnew VirtualEndpoint(this, this.driver, index),\n\t\t\t);\n\t\t}\n\t\treturn this._endpointInstances.get(index)!;\n\t}\n\n\tpublic getEndpointOrThrow(index: number): VirtualEndpoint {\n\t\tconst ret = this.getEndpoint(index);\n\t\tif (!ret) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Endpoint ${index} does not exist on virtual node ${\n\t\t\t\t\tthis.id ?? \"??\"\n\t\t\t\t}`,\n\t\t\t\tZWaveErrorCodes.Controller_EndpointNotFound,\n\t\t\t);\n\t\t}\n\t\treturn ret;\n\t}\n\n\t/** Returns the current endpoint count of this virtual node (the maximum in the list of physical nodes) */\n\tpublic getEndpointCount(): number {\n\t\tlet ret = 0;\n\t\tfor (const node of this.physicalNodes) {\n\t\t\tconst count = node.getEndpointCount();\n\t\t\tret = Math.max(ret, count);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tprivate get isMultiChannelInterviewComplete(): boolean {\n\t\tfor (const node of this.physicalNodes) {\n\t\t\tif (!node[\"isMultiChannelInterviewComplete\"]) return false;\n\t\t}\n\t\treturn true;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,gBAKO;AACP,kBAIO;AACP,kBAgBO;AACP,oBAAyB;AAGzB,6BAAgC;AAShC,SAAS,0BACR,OAA0B;AAE1B,QAAM,MAAM,oBAAI,IAAG;AAEnB,aAAW,QAAQ,OAAO;AACzB,UAAM,WAAW,KAAK,wBAAuB;AAC7C,QAAI,aAAa,0BAAc,aAAa,YAAY,QAAW;AAClE;IACD;AAEA,QAAI,CAAC,IAAI,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zC;EAEO,mBAAmB,OAAa;AACtC,UAAM,MAAM,KAAK,YAAY,KAAK;AAClC,QAAI,CAAC,KAAK;AACT,YAAM,IAAI,uBACT,YAAY,KAAK,mCAChB,KAAK,MAAM,IACZ,IACA,4BAAgB,2BAA2B;IAE7C;AACA,WAAO;EACR;;EAGO,mBAAgB;AACtB,QAAI,MAAM;AACV,eAAW,QAAQ,KAAK,eAAe;AACtC,YAAM,QAAQ,KAAK,iBAAgB;AACnC,YAAM,KAAK,IAAI,KAAK,KAAK;IAC1B;AACA,WAAO;EACR;EAEA,IAAY,kCAA+B;AAC1C,eAAW,QAAQ,KAAK,eAAe;AACtC,UAAI,CAAC,KAAK,iCAAiC;AAAG,eAAO;IACtD;AACA,WAAO;EACR;;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -23,6 +24,9 @@ __export(Base_exports, {
23
24
  module.exports = __toCommonJS(Base_exports);
24
25
  var import_Endpoint = require("../Endpoint.js");
25
26
  class ZWaveNodeBase extends import_Endpoint.Endpoint {
27
+ static {
28
+ __name(this, "ZWaveNodeBase");
29
+ }
26
30
  /**
27
31
  * Whether the node should be kept awake when there are no pending messages.
28
32
  */
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/node/mixins/00_Base.ts"],
4
4
  "sourcesContent": ["import { type NodeId } from \"@zwave-js/core/safe\";\nimport { Endpoint } from \"../Endpoint.js\";\n\nexport abstract class ZWaveNodeBase extends Endpoint implements NodeId {\n\t/**\n\t * Whether the node should be kept awake when there are no pending messages.\n\t */\n\tpublic keepAwake: boolean = false;\n\n\t/** The ID of this node */\n\tpublic get id(): number {\n\t\treturn this.nodeId;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AACA;;;;;AAAA,sBAAyB;AAEnB,MAAgB,sBAAsB,yBAAQ;;;;EAI5C,YAAqB;;EAG5B,IAAW,KAAE;AACZ,WAAO,KAAK;EACb;;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;AAAA,sBAAyB;AAEnB,MAAgB,sBAAsB,yBAAQ;EAFpD,OAEoD;;;;;;EAI5C,YAAqB;;EAG5B,IAAW,KAAE;AACZ,WAAO,KAAK;EACb;;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -25,6 +26,9 @@ var import_core = require("@zwave-js/core");
25
26
  var import_NetworkCache = require("../../driver/NetworkCache.js");
26
27
  var import_Base = require("./00_Base.js");
27
28
  class NetworkRoleMixin extends import_Base.ZWaveNodeBase {
29
+ static {
30
+ __name(this, "NetworkRoleMixin");
31
+ }
28
32
  get isListening() {
29
33
  return this.driver.cacheGet(import_NetworkCache.cacheKeys.node(this.id).isListening);
30
34
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/node/mixins/01_NetworkRole.ts"],
4
4
  "sourcesContent": ["import {\n\ttype DataRate,\n\ttype FLiRS,\n\ttype MaybeNotKnown,\n\tNOT_KNOWN,\n\ttype NodeType,\n\ttype ProtocolVersion,\n\tProtocols,\n\tisLongRangeNodeId,\n} from \"@zwave-js/core\";\nimport { cacheKeys } from \"../../driver/NetworkCache.js\";\nimport { ZWaveNodeBase } from \"./00_Base.js\";\n\nexport interface NodeNetworkRole {\n\t/** Whether this node is always listening or not */\n\treadonly isListening: MaybeNotKnown<boolean>;\n\n\t/** Indicates the wakeup interval if this node is a FLiRS node. `false` if it isn't. */\n\treadonly isFrequentListening: MaybeNotKnown<FLiRS>;\n\n\t/** Whether this node can sleep */\n\treadonly canSleep: MaybeNotKnown<boolean>;\n\n\t/** Whether the node supports routing/forwarding messages. */\n\treadonly isRouting: MaybeNotKnown<boolean>;\n\n\t/** All supported data rates of this node */\n\treadonly supportedDataRates: MaybeNotKnown<readonly DataRate[]>;\n\n\t/** The maximum data rate supported by this node */\n\treadonly maxDataRate: MaybeNotKnown<DataRate>;\n\n\t/** The Z-Wave protocol version this node implements */\n\treadonly protocolVersion: MaybeNotKnown<ProtocolVersion>;\n\n\t/** Whether this node is a controller (can calculate routes) or an end node (relies on route info) */\n\treadonly nodeType: MaybeNotKnown<NodeType>;\n\n\t/**\n\t * Whether this node supports security (S0 or S2).\n\t * **WARNING:** Nodes often report this incorrectly - do not blindly trust it.\n\t */\n\treadonly supportsSecurity: MaybeNotKnown<boolean>;\n\n\t/** Whether this node can issue wakeup beams to FLiRS nodes */\n\treadonly supportsBeaming: MaybeNotKnown<boolean>;\n\n\t/** Which protocol is used to communicate with this node */\n\treadonly protocol: Protocols;\n\n\t/** Returns whether this node is the controller */\n\treadonly isControllerNode: boolean;\n}\n\nexport abstract class NetworkRoleMixin extends ZWaveNodeBase\n\timplements NodeNetworkRole\n{\n\tpublic get isListening(): MaybeNotKnown<boolean> {\n\t\treturn this.driver.cacheGet(cacheKeys.node(this.id).isListening);\n\t}\n\tprotected set isListening(value: MaybeNotKnown<boolean>) {\n\t\tthis.driver.cacheSet(cacheKeys.node(this.id).isListening, value);\n\t}\n\n\tpublic get isFrequentListening(): MaybeNotKnown<FLiRS> {\n\t\treturn this.driver.cacheGet(\n\t\t\tcacheKeys.node(this.id).isFrequentListening,\n\t\t);\n\t}\n\tprotected set isFrequentListening(value: MaybeNotKnown<FLiRS>) {\n\t\tthis.driver.cacheSet(\n\t\t\tcacheKeys.node(this.id).isFrequentListening,\n\t\t\tvalue,\n\t\t);\n\t}\n\n\tpublic get canSleep(): MaybeNotKnown<boolean> {\n\t\t// The controller node can never sleep (apparently it can report otherwise though)\n\t\tif (this.isControllerNode) return false;\n\t\tif (this.isListening == NOT_KNOWN) return NOT_KNOWN;\n\t\tif (this.isFrequentListening == NOT_KNOWN) return NOT_KNOWN;\n\t\treturn !this.isListening && !this.isFrequentListening;\n\t}\n\n\tpublic get isRouting(): MaybeNotKnown<boolean> {\n\t\treturn this.driver.cacheGet(cacheKeys.node(this.id).isRouting);\n\t}\n\tprotected set isRouting(value: MaybeNotKnown<boolean>) {\n\t\tthis.driver.cacheSet(cacheKeys.node(this.id).isRouting, value);\n\t}\n\n\tpublic get supportedDataRates(): MaybeNotKnown<readonly DataRate[]> {\n\t\treturn this.driver.cacheGet(cacheKeys.node(this.id).supportedDataRates);\n\t}\n\tprotected set supportedDataRates(\n\t\tvalue: MaybeNotKnown<readonly DataRate[]>,\n\t) {\n\t\tthis.driver.cacheSet(cacheKeys.node(this.id).supportedDataRates, value);\n\t}\n\n\tpublic get maxDataRate(): MaybeNotKnown<DataRate> {\n\t\tif (this.supportedDataRates) {\n\t\t\treturn Math.max(...this.supportedDataRates) as DataRate;\n\t\t}\n\t}\n\n\tpublic get protocolVersion(): MaybeNotKnown<ProtocolVersion> {\n\t\treturn this.driver.cacheGet(cacheKeys.node(this.id).protocolVersion);\n\t}\n\tprotected set protocolVersion(value: MaybeNotKnown<ProtocolVersion>) {\n\t\tthis.driver.cacheSet(cacheKeys.node(this.id).protocolVersion, value);\n\t}\n\n\tpublic get nodeType(): MaybeNotKnown<NodeType> {\n\t\treturn this.driver.cacheGet(cacheKeys.node(this.id).nodeType);\n\t}\n\tprotected set nodeType(value: MaybeNotKnown<NodeType>) {\n\t\tthis.driver.cacheSet(cacheKeys.node(this.id).nodeType, value);\n\t}\n\n\tpublic get supportsSecurity(): MaybeNotKnown<boolean> {\n\t\treturn this.driver.cacheGet(cacheKeys.node(this.id).supportsSecurity);\n\t}\n\tprotected set supportsSecurity(value: MaybeNotKnown<boolean>) {\n\t\tthis.driver.cacheSet(cacheKeys.node(this.id).supportsSecurity, value);\n\t}\n\n\tpublic get supportsBeaming(): MaybeNotKnown<boolean> {\n\t\treturn this.driver.cacheGet(cacheKeys.node(this.id).supportsBeaming);\n\t}\n\tprotected set supportsBeaming(value: MaybeNotKnown<boolean>) {\n\t\tthis.driver.cacheSet(cacheKeys.node(this.id).supportsBeaming, value);\n\t}\n\n\tpublic get protocol(): Protocols {\n\t\treturn isLongRangeNodeId(this.id)\n\t\t\t? Protocols.ZWaveLongRange\n\t\t\t: Protocols.ZWave;\n\t}\n\n\tpublic get isControllerNode(): boolean {\n\t\treturn this.id === this.driver.controller.ownNodeId;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,kBASO;AACP,0BAA0B;AAC1B,kBAA8B;AA2CxB,MAAgB,yBAAyB,0BAAa;EAG3D,IAAW,cAAW;AACrB,WAAO,KAAK,OAAO,SAAS,8BAAU,KAAK,KAAK,EAAE,EAAE,WAAW;EAChE;EACA,IAAc,YAAY,OAA6B;AACtD,SAAK,OAAO,SAAS,8BAAU,KAAK,KAAK,EAAE,EAAE,aAAa,KAAK;EAChE;EAEA,IAAW,sBAAmB;AAC7B,WAAO,KAAK,OAAO,SAClB,8BAAU,KAAK,KAAK,EAAE,EAAE,mBAAmB;EAE7C;EACA,IAAc,oBAAoB,OAA2B;AAC5D,SAAK,OAAO,SACX,8BAAU,KAAK,KAAK,EAAE,EAAE,qBACxB,KAAK;EAEP;EAEA,IAAW,WAAQ;AAElB,QAAI,KAAK;AAAkB,aAAO;AAClC,QAAI,KAAK,eAAe;AAAW,aAAO;AAC1C,QAAI,KAAK,uBAAuB;AAAW,aAAO;AAClD,WAAO,CAAC,KAAK,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or;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,16 +27,19 @@ var import_shared = require("@zwave-js/shared");
26
27
  var import_NetworkCache = require("../../driver/NetworkCache.js");
27
28
  var import_NetworkRole = require("./01_NetworkRole.js");
28
29
  class NodeSecurityMixin extends import_NetworkRole.NetworkRoleMixin {
30
+ static {
31
+ __name(this, "NodeSecurityMixin");
32
+ }
29
33
  constructor(nodeId, driver, index, deviceClass, supportedCCs) {
30
34
  super(nodeId, driver, index, deviceClass, supportedCCs);
31
35
  this.securityClasses = new import_core.CacheBackedMap(this.driver.networkCache, {
32
36
  prefix: import_NetworkCache.cacheKeys.node(this.id)._securityClassBaseKey + ".",
33
- suffixSerializer: (value) => (0, import_shared.getEnumMemberName)(import_core.SecurityClass, value),
34
- suffixDeserializer: (key) => {
37
+ suffixSerializer: /* @__PURE__ */ __name((value) => (0, import_shared.getEnumMemberName)(import_core.SecurityClass, value), "suffixSerializer"),
38
+ suffixDeserializer: /* @__PURE__ */ __name((key) => {
35
39
  if (key in import_core.SecurityClass && typeof import_core.SecurityClass[key] === "number") {
36
40
  return import_core.SecurityClass[key];
37
41
  }
38
- }
42
+ }, "suffixDeserializer")
39
43
  });
40
44
  }
41
45
  /** @internal */
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/node/mixins/05_Security.ts"],
4
4
  "sourcesContent": ["import {\n\tCacheBackedMap,\n\ttype CommandClasses,\n\ttype MaybeNotKnown,\n\tNOT_KNOWN,\n\ttype QuerySecurityClasses,\n\tSecurityClass,\n\ttype SetSecurityClass,\n\tsecurityClassOrder,\n} from \"@zwave-js/core\";\nimport { getEnumMemberName } from \"@zwave-js/shared\";\nimport { type Driver } from \"../../driver/Driver.js\";\nimport { cacheKeys } from \"../../driver/NetworkCache.js\";\nimport { type DeviceClass } from \"../DeviceClass.js\";\nimport { NetworkRoleMixin } from \"./01_NetworkRole.js\";\n\nexport abstract class NodeSecurityMixin extends NetworkRoleMixin\n\timplements QuerySecurityClasses, SetSecurityClass\n{\n\tpublic constructor(\n\t\tnodeId: number,\n\t\tdriver: Driver,\n\t\tindex: number,\n\t\tdeviceClass?: DeviceClass,\n\t\tsupportedCCs?: CommandClasses[],\n\t) {\n\t\tsuper(nodeId, driver, index, deviceClass, supportedCCs);\n\n\t\tthis.securityClasses = new CacheBackedMap(this.driver.networkCache, {\n\t\t\tprefix: cacheKeys.node(this.id)._securityClassBaseKey + \".\",\n\t\t\tsuffixSerializer: (value: SecurityClass) =>\n\t\t\t\tgetEnumMemberName(SecurityClass, value),\n\t\t\tsuffixDeserializer: (key: string) => {\n\t\t\t\tif (\n\t\t\t\t\tkey in SecurityClass\n\t\t\t\t\t&& typeof (SecurityClass as any)[key] === \"number\"\n\t\t\t\t) {\n\t\t\t\t\treturn (SecurityClass as any)[key];\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/** @internal */\n\t// This a CacheBackedMap that's assigned in the constructor\n\tpublic readonly securityClasses: Map<SecurityClass, boolean>;\n\n\tpublic get isSecure(): MaybeNotKnown<boolean> {\n\t\tconst securityClass = this.getHighestSecurityClass();\n\t\tif (securityClass == undefined) return NOT_KNOWN;\n\t\tif (securityClass === SecurityClass.None) return false;\n\t\treturn true;\n\t}\n\n\tpublic hasSecurityClass(\n\t\tsecurityClass: SecurityClass,\n\t): MaybeNotKnown<boolean> {\n\t\treturn this.securityClasses.get(securityClass);\n\t}\n\n\tpublic setSecurityClass(\n\t\tsecurityClass: SecurityClass,\n\t\tgranted: boolean,\n\t): void {\n\t\tthis.securityClasses.set(securityClass, granted);\n\t}\n\n\tpublic getHighestSecurityClass(): MaybeNotKnown<SecurityClass> {\n\t\tif (this.securityClasses.size === 0) return undefined;\n\t\tlet missingSome = false;\n\t\tfor (const secClass of securityClassOrder) {\n\t\t\tif (this.securityClasses.get(secClass) === true) return secClass;\n\t\t\tif (!this.securityClasses.has(secClass)) {\n\t\t\t\tmissingSome = true;\n\t\t\t}\n\t\t}\n\t\t// If we don't have the info for every security class, we don't know the highest one yet\n\t\treturn missingSome ? NOT_KNOWN : SecurityClass.None;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,kBASO;AACP,oBAAkC;AAElC,0BAA0B;AAE1B,yBAAiC;AAE3B,MAAgB,0BAA0B,oCAAgB;EAG/D,YACC,QACA,QACA,OACA,aACA,cAA+B;AAE/B,UAAM,QAAQ,QAAQ,OAAO,aAAa,YAAY;AAEtD,SAAK,kBAAkB,IAAI,2BAAe,KAAK,OAAO,cAAc;MACnE,QAAQ,8BAAU,KAAK,KAAK,EAAE,EAAE,wBAAwB;MACxD,kBAAkB,CAAC,cAClB,iCAAkB,2BAAe,KAAK;MACvC,oBAAoB,CAAC,QAAe;AACnC,YACC,OAAO,6BACJ,OAAQ,0BAAsB,GAAG,MAAM,UACzC;AACD,iBAAQ,0BAAsB,GAAG;QAClC;MACD;KACA;EACF;;;EAIgB;EAEhB,IAAW,WAAQ;AAClB,UAAM,gBAAgB,KAAK,wBAAuB;AAClD,QAAI,iBAAiB;AAAW,aAAO;AACvC,QAAI,kBAAkB,0BAAc;AAAM,aAAO;AACjD,WAAO;EACR;EAEO,iBACN,eAA4B;AAE5B,WAAO,KAAK,gBAAgB,IAAI,aAAa;EAC9C;EAEO,iBACN,eACA,SAAgB;AAEhB,SAAK,gBAAgB,IAAI,eAAe,OAAO;EAChD;EAEO,0BAAuB;AAC7B,QAAI,KAAK,gBAAgB,SAAS;AAAG,aAAO;AAC5C,QAAI,cAAc;AAClB,eAAW,YAAY,gCAAoB;AAC1C,UAAI,KAAK,gBAAgB,IAAI,QAAQ,MAAM;AAAM,eAAO;AACxD,UAAI,CAAC,KAAK,gBAAgB,IA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 var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -23,6 +24,9 @@ __export(Events_exports, {
23
24
  module.exports = __toCommonJS(Events_exports);
24
25
  var import_Security = require("./05_Security.js");
25
26
  class NodeEventsMixin extends import_Security.NodeSecurityMixin {
27
+ static {
28
+ __name(this, "NodeEventsMixin");
29
+ }
26
30
  }
27
31
  // Annotate the CommonJS export names for ESM import in node:
28
32
  0 && (module.exports = {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/node/mixins/10_Events.ts"],
4
4
  "sourcesContent": ["import { type EventHandler } from \"@zwave-js/shared\";\nimport { type StatisticsEventCallbacksWithSelf } from \"../../driver/Statistics.js\";\nimport { type ZWaveNode } from \"../Node.js\";\nimport { type NodeStatistics } from \"../NodeStatistics.js\";\nimport { type ZWaveNodeEventCallbacks } from \"../_Types.js\";\nimport { NodeSecurityMixin } from \"./05_Security.js\";\n\n// This mixin is a slightly ugly workaround to allow other mixins to\n// interact with events which would normally take an instance of ZWaveNode\n\ntype ReplaceNodeWithThis<TThis, T extends any[]> = {\n\t[K in keyof T]: T[K] extends ZWaveNode ? TThis : T[K];\n};\n\nexport type EventsToAbstract<TThis, T extends Record<keyof T, EventHandler>> = {\n\t[K in keyof T]: (\n\t\t...args: ReplaceNodeWithThis<TThis, Parameters<T[K]>>\n\t) => void;\n};\n\ntype AbstractNodeEvents<TThis> = EventsToAbstract<\n\tTThis,\n\t& ZWaveNodeEventCallbacks\n\t& StatisticsEventCallbacksWithSelf<ZWaveNode, NodeStatistics>\n>;\n\nexport abstract class NodeEventsMixin extends NodeSecurityMixin {\n\tprotected abstract _emit<TEvent extends keyof AbstractNodeEvents<this>>(\n\t\tevent: TEvent,\n\t\t...args: Parameters<AbstractNodeEvents<this>[TEvent]>\n\t): boolean;\n\n\tprotected abstract _on<TEvent extends keyof AbstractNodeEvents<this>>(\n\t\tevent: TEvent,\n\t\tcallback: AbstractNodeEvents<this>[TEvent],\n\t): this;\n\tprotected abstract _once<TEvent extends keyof AbstractNodeEvents<this>>(\n\t\tevent: TEvent,\n\t\tcallback: AbstractNodeEvents<this>[TEvent],\n\t): this;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAKA;;;;;AAAA,sBAAkC;AAqB5B,MAAgB,wBAAwB,kCAAiB;;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAKA;;;;;AAAA,sBAAkC;AAqB5B,MAAgB,wBAAwB,kCAAiB;EArB/D,OAqB+D;;;;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -29,6 +30,9 @@ var import_NodeStatusMachine = require("../NodeStatusMachine.js");
29
30
  var import_Types = require("../_Types.js");
30
31
  var import_Events = require("./10_Events.js");
31
32
  class NodeStatusMixin extends import_Events.NodeEventsMixin {
33
+ static {
34
+ __name(this, "NodeStatusMixin");
35
+ }
32
36
  constructor(nodeId, driver, index, deviceClass, supportedCCs) {
33
37
  super(nodeId, driver, index, deviceClass, supportedCCs);
34
38
  this.statusMachine = (0, import_StateMachineShared.interpretEx)((0, import_NodeStatusMachine.createNodeStatusMachine)(this));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/node/mixins/20_Status.ts"],
4
4
  "sourcesContent": ["import { type CommandClasses, InterviewStage } from \"@zwave-js/core\";\nimport { type Driver } from \"../../driver/Driver.js\";\nimport { cacheKeys } from \"../../driver/NetworkCache.js\";\nimport { type Extended, interpretEx } from \"../../driver/StateMachineShared.js\";\nimport { type DeviceClass } from \"../DeviceClass.js\";\nimport {\n\ttype NodeReadyInterpreter,\n\tcreateNodeReadyMachine,\n} from \"../NodeReadyMachine.js\";\nimport {\n\ttype NodeStatusInterpreter,\n\tcreateNodeStatusMachine,\n\tnodeStatusMachineStateToNodeStatus,\n} from \"../NodeStatusMachine.js\";\nimport { NodeStatus } from \"../_Types.js\";\nimport { NodeEventsMixin } from \"./10_Events.js\";\n\nexport interface NodeWithStatus {\n\t/**\n\t * Which status the node is believed to be in\n\t */\n\tstatus: NodeStatus;\n\n\t/**\n\t * Whether the node is ready to be used\n\t */\n\tready: boolean;\n\n\t/**\n\t * @internal\n\t * Marks this node as dead (if applicable)\n\t */\n\tmarkAsDead(): void;\n\n\t/**\n\t * @internal\n\t * Marks this node as alive (if applicable)\n\t */\n\tmarkAsAlive(): void;\n\n\t/**\n\t * @internal\n\t * Marks this node as asleep (if applicable)\n\t */\n\tmarkAsAsleep(): void;\n\n\t/**\n\t * @internal\n\t * Marks this node as awake (if applicable)\n\t */\n\tmarkAsAwake(): void;\n\n\t/**\n\t * Which interview stage was last completed\n\t */\n\tinterviewStage: InterviewStage;\n}\n\nexport abstract class NodeStatusMixin extends NodeEventsMixin\n\timplements NodeWithStatus\n{\n\tpublic constructor(\n\t\tnodeId: number,\n\t\tdriver: Driver,\n\t\tindex: number,\n\t\tdeviceClass?: DeviceClass,\n\t\tsupportedCCs?: CommandClasses[],\n\t) {\n\t\tsuper(nodeId, driver, index, deviceClass, supportedCCs);\n\n\t\t// Create and hook up the status machine\n\t\tthis.statusMachine = interpretEx(\n\t\t\tcreateNodeStatusMachine(this),\n\t\t);\n\t\tthis.statusMachine.onTransition((state) => {\n\t\t\tif (state.changed) {\n\t\t\t\tthis.onStatusChange(\n\t\t\t\t\tnodeStatusMachineStateToNodeStatus(state.value as any),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t\tthis.statusMachine.start();\n\n\t\tthis.readyMachine = interpretEx(createNodeReadyMachine());\n\t\tthis.readyMachine.onTransition((state) => {\n\t\t\tif (state.changed) {\n\t\t\t\tthis.onReadyChange(state.value === \"ready\");\n\t\t\t}\n\t\t});\n\t\tthis.readyMachine.start();\n\t}\n\n\tprotected statusMachine: Extended<NodeStatusInterpreter>;\n\n\tprivate _status: NodeStatus = NodeStatus.Unknown;\n\n\t/**\n\t * Which status the node is believed to be in\n\t */\n\tpublic get status(): NodeStatus {\n\t\treturn this._status;\n\t}\n\n\tprivate onStatusChange(newStatus: NodeStatus) {\n\t\t// Ignore duplicate events\n\t\tif (newStatus === this._status) return;\n\n\t\tconst oldStatus = this._status;\n\t\tthis._status = newStatus;\n\t\tif (this._status === NodeStatus.Asleep) {\n\t\t\tthis._emit(\"sleep\", this, oldStatus);\n\t\t} else if (this._status === NodeStatus.Awake) {\n\t\t\tthis._emit(\"wake up\", this, oldStatus);\n\t\t} else if (this._status === NodeStatus.Dead) {\n\t\t\tthis._emit(\"dead\", this, oldStatus);\n\t\t} else if (this._status === NodeStatus.Alive) {\n\t\t\tthis._emit(\"alive\", this, oldStatus);\n\t\t}\n\n\t\t// To be marked ready, a node must be known to be not dead.\n\t\t// This means that listening nodes must have communicated with us and\n\t\t// sleeping nodes are assumed to be ready\n\t\tthis.readyMachine.send(\n\t\t\tthis._status !== NodeStatus.Unknown\n\t\t\t\t&& this._status !== NodeStatus.Dead\n\t\t\t\t? \"NOT_DEAD\"\n\t\t\t\t: \"MAYBE_DEAD\",\n\t\t);\n\t}\n\n\t/**\n\t * @internal\n\t * Marks this node as dead (if applicable)\n\t */\n\tpublic markAsDead(): void {\n\t\tthis.statusMachine.send(\"DEAD\");\n\t}\n\n\t/**\n\t * @internal\n\t * Marks this node as alive (if applicable)\n\t */\n\tpublic markAsAlive(): void {\n\t\tthis.statusMachine.send(\"ALIVE\");\n\t}\n\n\t/**\n\t * @internal\n\t * Marks this node as asleep (if applicable)\n\t */\n\tpublic markAsAsleep(): void {\n\t\tthis.statusMachine.send(\"ASLEEP\");\n\t}\n\n\t/**\n\t * @internal\n\t * Marks this node as awake (if applicable)\n\t */\n\tpublic markAsAwake(): void {\n\t\tthis.statusMachine.send(\"AWAKE\");\n\t}\n\n\t// The node is only ready when the interview has been completed\n\t// to a certain degree\n\n\tprotected readyMachine: Extended<NodeReadyInterpreter>;\n\tprivate _ready: boolean = false;\n\n\tprivate onReadyChange(ready: boolean) {\n\t\t// Ignore duplicate events\n\t\tif (ready === this._ready) return;\n\n\t\tthis._ready = ready;\n\t\tif (ready) this._emit(\"ready\", this);\n\t}\n\n\t/**\n\t * Whether the node is ready to be used\n\t */\n\tpublic get ready(): boolean {\n\t\treturn this._ready;\n\t}\n\tprotected set ready(ready: boolean) {\n\t\tthis._ready = ready;\n\t}\n\n\tpublic get interviewStage(): InterviewStage {\n\t\treturn (\n\t\t\tthis.driver.cacheGet(cacheKeys.node(this.id).interviewStage)\n\t\t\t\t?? InterviewStage.None\n\t\t);\n\t}\n\tpublic set interviewStage(value: InterviewStage) {\n\t\tthis.driver.cacheSet(cacheKeys.node(this.id).interviewStage, value);\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,kBAAoD;AAEpD,0BAA0B;AAC1B,gCAA2C;AAE3C,8BAGO;AACP,+BAIO;AACP,mBAA2B;AAC3B,oBAAgC;AA2C1B,MAAgB,wBAAwB,8BAAe;EAG5D,YACC,QACA,QACA,OACA,aACA,cAA+B;AAE/B,UAAM,QAAQ,QAAQ,OAAO,aAAa,YAAY;AAGtD,SAAK,oBAAgB,2CACpB,kDAAwB,IAAI,CAAC;AAE9B,SAAK,cAAc,aAAa,CAAC,UAAS;AACzC,UAAI,MAAM,SAAS;AAClB,aAAK,mBACJ,6DAAmC,MAAM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M;AAC5C,WAAK,MAAM,QAAQ,MAAM,SAAS;IACnC,WAAW,KAAK,YAAY,wBAAW,OAAO;AAC7C,WAAK,MAAM,SAAS,MAAM,SAAS;IACpC;AAKA,SAAK,aAAa,KACjB,KAAK,YAAY,wBAAW,WACxB,KAAK,YAAY,wBAAW,OAC7B,aACA,YAAY;EAEjB;;;;;EAMO,aAAU;AAChB,SAAK,cAAc,KAAK,MAAM;EAC/B;;;;;EAMO,cAAW;AACjB,SAAK,cAAc,KAAK,OAAO;EAChC;;;;;EAMO,eAAY;AAClB,SAAK,cAAc,KAAK,QAAQ;EACjC;;;;;EAMO,cAAW;AACjB,SAAK,cAAc,KAAK,OAAO;EAChC;;;EAKU;EACF,SAAkB;EAElB,cAAc,OAAc;AAEnC,QAAI,UAAU,KAAK;AAAQ;AAE3B,SAAK,SAAS;AACd,QAAI;AAAO,WAAK,MAAM,SAAS,IAAI;EACpC;;;;EAKA,IAAW,QAAK;AACf,WAAO,KAAK;EACb;EACA,IAAc,MAAM,OAAc;AACjC,SAAK,SAAS;EACf;EAEA,IAAW,iBAAc;AACxB,WACC,KAAK,OAAO,SAAS,8BAAU,KAAK,KAAK,EAAE,EAAE,cAAc,KACvD,2BAAe;EAErB;EACA,IAAW,eAAe,OAAqB;AAC9C,SAAK,OAAO,SAAS,8BAAU,KAAK,KAAK,EAAE,EAAE,gBAAgB,KAAK;EACnE;;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -24,6 +25,9 @@ module.exports = __toCommonJS(Wakeup_exports);
24
25
  var import_core = require("@zwave-js/core");
25
26
  var import_Status = require("./20_Status.js");
26
27
  class NodeWakeupMixin extends import_Status.NodeStatusMixin {
28
+ static {
29
+ __name(this, "NodeWakeupMixin");
30
+ }
27
31
  waitForWakeup() {
28
32
  if (!this.canSleep || !this.supportsCC(import_core.CommandClasses["Wake Up"])) {
29
33
  throw new import_core.ZWaveError(`Node ${this.id} does not support wakeup!`, import_core.ZWaveErrorCodes.CC_NotSupported);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/node/mixins/30_Wakeup.ts"],
4
4
  "sourcesContent": ["import {\n\tCommandClasses,\n\tInterviewStage,\n\tNodeStatus,\n\tZWaveError,\n\tZWaveErrorCodes,\n} from \"@zwave-js/core\";\nimport { NodeStatusMixin } from \"./20_Status.js\";\n\n/**\n * Interface for NodeWakeupMixin\n */\nexport interface NodeWakeup {\n\t/** Returns a promise that resolves when the node wakes up the next time or immediately if the node is already awake. */\n\twaitForWakeup(): Promise<void>;\n\n\t/**\n\t * Sends the node a WakeUpCCNoMoreInformation so it can go back to sleep\n\t * @internal\n\t */\n\tsendNoMoreInformation(): Promise<boolean>;\n}\n\nexport abstract class NodeWakeupMixin extends NodeStatusMixin\n\timplements NodeWakeup\n{\n\tpublic waitForWakeup(): Promise<void> {\n\t\tif (!this.canSleep || !this.supportsCC(CommandClasses[\"Wake Up\"])) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Node ${this.id} does not support wakeup!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t} else if (this.status === NodeStatus.Awake) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis._once(\"wake up\", () => resolve());\n\t\t});\n\t}\n\n\tprivate isSendingNoMoreInformation: boolean = false;\n\tpublic async sendNoMoreInformation(): Promise<boolean> {\n\t\t// Don't send the node back to sleep if it should be kept awake\n\t\tif (this.keepAwake) return false;\n\n\t\t// Avoid calling this method more than once\n\t\tif (this.isSendingNoMoreInformation) return false;\n\t\tthis.isSendingNoMoreInformation = true;\n\n\t\tlet msgSent = false;\n\t\tif (\n\t\t\tthis.status === NodeStatus.Awake\n\t\t\t&& this.interviewStage === InterviewStage.Complete\n\t\t) {\n\t\t\tthis.driver.controllerLog.logNode(this.id, {\n\t\t\t\tmessage: \"Sending node back to sleep...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\ttry {\n\t\t\t\t// it is important that we catch errors in this call\n\t\t\t\t// otherwise, this method will not work anymore because\n\t\t\t\t// isSendingNoMoreInformation is stuck on `true`\n\t\t\t\tawait this.commandClasses[\"Wake Up\"].sendNoMoreInformation();\n\t\t\t\tmsgSent = true;\n\t\t\t} catch {\n\t\t\t\t/* ignore */\n\t\t\t} finally {\n\t\t\t\tthis.markAsAsleep();\n\t\t\t}\n\t\t}\n\n\t\tthis.isSendingNoMoreInformation = false;\n\t\treturn msgSent;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,kBAMO;AACP,oBAAgC;AAgB1B,MAAgB,wBAAwB,8BAAe;EAGrD,gBAAa;AACnB,QAAI,CAAC,KAAK,YAAY,CAAC,KAAK,WAAW,2BAAe,SAAS,CAAC,GAAG;AAClE,YAAM,IAAI,uBACT,QAAQ,KAAK,EAAE,6BACf,4BAAgB,eAAe;IAEjC,WAAW,KAAK,WAAW,uBAAW,OAAO;AAC5C,aAAO,QAAQ,QAAO;IACvB;AAEA,WAAO,IAAI,QAAQ,CAAC,YAAW;AAC9B,WAAK,MAAM,WAAW,MAAM,QAAO,CAAE;IACtC,CAAC;EACF;EAEQ,6BAAsC;EACvC,MAAM,wBAAqB;AAEjC,QAAI,KAAK;AAAW,aAAO;AAG3B,QAAI,KAAK;AAA4B,aAAO;AAC5C,SAAK,6BAA6B;AAElC,QAAI,UAAU;AACd,QACC,KAAK,WAAW,uBAAW,SACxB,KAAK,mBAAmB,2BAAe,UACzC;AACD,WAAK,OAAO,cAAc,QAAQ,KAAK,IAAI;QAC1C,SAAS;QACT,WAAW;OACX;AACD,UAAI;AAIH,cAAM,KAAK,eAAe,SAAS,EAAE,sBAAqB;AAC1D,kBAAU;MACX,QAAQ;MAER;AACC,aAAK,aAAY;MAClB;IACD;AAEA,SAAK,6BAA6B;AAClC,WAAO;EACR;;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,kBAMO;AACP,oBAAgC;AAgB1B,MAAgB,wBAAwB,8BAAe;EAvB7D,OAuB6D;;;EAGrD,gBAAa;AACnB,QAAI,CAAC,KAAK,YAAY,CAAC,KAAK,WAAW,2BAAe,SAAS,CAAC,GAAG;AAClE,YAAM,IAAI,uBACT,QAAQ,KAAK,EAAE,6BACf,4BAAgB,eAAe;IAEjC,WAAW,KAAK,WAAW,uBAAW,OAAO;AAC5C,aAAO,QAAQ,QAAO;IACvB;AAEA,WAAO,IAAI,QAAQ,CAAC,YAAW;AAC9B,WAAK,MAAM,WAAW,MAAM,QAAO,CAAE;IACtC,CAAC;EACF;EAEQ,6BAAsC;EACvC,MAAM,wBAAqB;AAEjC,QAAI,KAAK;AAAW,aAAO;AAG3B,QAAI,KAAK;AAA4B,aAAO;AAC5C,SAAK,6BAA6B;AAElC,QAAI,UAAU;AACd,QACC,KAAK,WAAW,uBAAW,SACxB,KAAK,mBAAmB,2BAAe,UACzC;AACD,WAAK,OAAO,cAAc,QAAQ,KAAK,IAAI;QAC1C,SAAS;QACT,WAAW;OACX;AACD,UAAI;AAIH,cAAM,KAAK,eAAe,SAAS,EAAE,sBAAqB;AAC1D,kBAAU;MACX,QAAQ;MAER;AACC,aAAK,aAAY;MAClB;IACD;AAEA,SAAK,6BAA6B;AAClC,WAAO;EACR;;",
6
6
  "names": []
7
7
  }
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
9
  var __export = (target, all) => {
9
10
  for (var name in all)
10
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -37,6 +38,9 @@ var import_shared = require("@zwave-js/shared");
37
38
  var nodeUtils = __toESM(require("../utils.js"), 1);
38
39
  var import_Wakeup = require("./30_Wakeup.js");
39
40
  class NodeValuesMixin extends import_Wakeup.NodeWakeupMixin {
41
+ static {
42
+ __name(this, "NodeValuesMixin");
43
+ }
40
44
  constructor(nodeId, driver, endpointIndex, deviceClass, supportedCCs, valueDB) {
41
45
  super(nodeId, driver, endpointIndex, deviceClass, supportedCCs);
42
46
  this._valueDB = valueDB ?? new import_core.ValueDB(nodeId, driver.valueDB, driver.metadataDB);