zwave-js 9.0.3 → 9.0.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.
- package/build/CommandClass.d.ts +1 -1
- package/build/CommandClass.d.ts.map +1 -1
- package/build/CommandClass.js +1 -1
- package/build/CommandClass.js.map +1 -1
- package/build/CommandClass_safe.d.ts +3 -0
- package/build/CommandClass_safe.d.ts.map +1 -0
- package/build/CommandClass_safe.js +19 -0
- package/build/CommandClass_safe.js.map +1 -0
- package/build/Controller.d.ts +2 -2
- package/build/Controller.d.ts.map +1 -1
- package/build/Controller.js +5 -5
- package/build/Controller.js.map +1 -1
- package/build/Error.d.ts +1 -1
- package/build/Error.d.ts.map +1 -1
- package/build/Error.js +3 -3
- package/build/Error.js.map +1 -1
- package/build/Node.d.ts +2 -2
- package/build/Node.d.ts.map +1 -1
- package/build/Node.js +10 -10
- package/build/Node.js.map +1 -1
- package/build/Node_safe.d.ts +6 -0
- package/build/Node_safe.d.ts.map +1 -0
- package/build/Node_safe.js +15 -0
- package/build/Node_safe.js.map +1 -0
- package/build/Utils.d.ts +3 -3
- package/build/Utils.d.ts.map +1 -1
- package/build/Utils.js +7 -7
- package/build/Utils.js.map +1 -1
- package/build/Utils_safe.d.ts +5 -0
- package/build/Utils_safe.d.ts.map +1 -0
- package/build/Utils_safe.js +17 -0
- package/build/Utils_safe.js.map +1 -0
- package/build/Values.d.ts +3 -3
- package/build/Values.d.ts.map +1 -1
- package/build/Values.js +2 -2
- package/build/Values.js.map +1 -1
- package/build/index_safe.d.ts +6 -0
- package/build/index_safe.d.ts.map +1 -0
- package/build/index_safe.js +25 -0
- package/build/index_safe.js.map +1 -0
- package/build/lib/commandclass/API.d.ts +1 -1
- package/build/lib/commandclass/API.d.ts.map +1 -1
- package/build/lib/commandclass/BasicCC.d.ts +1 -1
- package/build/lib/commandclass/ColorSwitchCC.d.ts +1 -1
- package/build/lib/commandclass/CommandClass.d.ts.map +1 -1
- package/build/lib/commandclass/CommandClass.js +2 -2
- package/build/lib/commandclass/CommandClass.js.map +1 -1
- package/build/lib/commandclass/DoorLockCC.d.ts.map +1 -1
- package/build/lib/commandclass/DoorLockCC.js +10 -14
- package/build/lib/commandclass/DoorLockCC.js.map +1 -1
- package/build/lib/commandclass/EntryControlCC.d.ts +1 -53
- package/build/lib/commandclass/EntryControlCC.d.ts.map +1 -1
- package/build/lib/commandclass/EntryControlCC.js +12 -47
- package/build/lib/commandclass/EntryControlCC.js.map +1 -1
- package/build/lib/commandclass/FirmwareUpdateMetaDataCC.d.ts +1 -1
- package/build/lib/commandclass/MultilevelSwitchCC.d.ts +3 -31
- package/build/lib/commandclass/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/lib/commandclass/MultilevelSwitchCC.js +19 -28
- package/build/lib/commandclass/MultilevelSwitchCC.js.map +1 -1
- package/build/lib/commandclass/NotificationCC.d.ts +1 -26
- package/build/lib/commandclass/NotificationCC.d.ts.map +1 -1
- package/build/lib/commandclass/NotificationCC.js.map +1 -1
- package/build/lib/commandclass/PowerlevelCC.d.ts +2 -39
- package/build/lib/commandclass/PowerlevelCC.d.ts.map +1 -1
- package/build/lib/commandclass/PowerlevelCC.js +11 -31
- package/build/lib/commandclass/PowerlevelCC.js.map +1 -1
- package/build/lib/commandclass/Security2CC.js +3 -3
- package/build/lib/commandclass/Security2CC.js.map +1 -1
- package/build/lib/commandclass/SecurityCC.js +2 -2
- package/build/lib/commandclass/SecurityCC.js.map +1 -1
- package/build/lib/commandclass/SoundSwitchCC.d.ts +1 -1
- package/build/lib/commandclass/VersionCC.d.ts +1 -1
- package/build/lib/commandclass/WakeUpCC.js +6 -6
- package/build/lib/commandclass/WakeUpCC.js.map +1 -1
- package/build/lib/commandclass/_Types.d.ts +144 -0
- package/build/lib/commandclass/_Types.d.ts.map +1 -0
- package/build/lib/commandclass/_Types.js +74 -0
- package/build/lib/commandclass/_Types.js.map +1 -0
- package/build/lib/commandclass/index.d.ts +5 -5
- package/build/lib/commandclass/index.d.ts.map +1 -1
- package/build/lib/commandclass/index.js +11 -7
- package/build/lib/commandclass/index.js.map +1 -1
- package/build/lib/controller/AssignReturnRouteMessages.d.ts +1 -1
- package/build/lib/controller/AssignReturnRouteMessages.d.ts.map +1 -1
- package/build/lib/controller/AssignReturnRouteMessages.js +3 -3
- package/build/lib/controller/AssignReturnRouteMessages.js.map +1 -1
- package/build/lib/controller/AssignSUCReturnRouteMessages.d.ts +1 -1
- package/build/lib/controller/AssignSUCReturnRouteMessages.d.ts.map +1 -1
- package/build/lib/controller/AssignSUCReturnRouteMessages.js +3 -3
- package/build/lib/controller/AssignSUCReturnRouteMessages.js.map +1 -1
- package/build/lib/controller/BridgeApplicationCommandRequest.d.ts +1 -1
- package/build/lib/controller/BridgeApplicationCommandRequest.d.ts.map +1 -1
- package/build/lib/controller/BridgeApplicationCommandRequest.js +4 -3
- package/build/lib/controller/BridgeApplicationCommandRequest.js.map +1 -1
- package/build/lib/controller/Controller.d.ts +2 -2
- package/build/lib/controller/Controller.d.ts.map +1 -1
- package/build/lib/controller/Controller.js +7 -7
- package/build/lib/controller/Controller.js.map +1 -1
- package/build/lib/controller/DeleteReturnRouteMessages.d.ts +1 -1
- package/build/lib/controller/DeleteReturnRouteMessages.d.ts.map +1 -1
- package/build/lib/controller/DeleteReturnRouteMessages.js +3 -3
- package/build/lib/controller/DeleteReturnRouteMessages.js.map +1 -1
- package/build/lib/controller/DeleteSUCReturnRouteMessages.d.ts +1 -1
- package/build/lib/controller/DeleteSUCReturnRouteMessages.d.ts.map +1 -1
- package/build/lib/controller/DeleteSUCReturnRouteMessages.js +3 -3
- package/build/lib/controller/DeleteSUCReturnRouteMessages.js.map +1 -1
- package/build/lib/controller/SendDataBridgeMessages.d.ts +1 -1
- package/build/lib/controller/SendDataBridgeMessages.d.ts.map +1 -1
- package/build/lib/controller/SendDataBridgeMessages.js +10 -9
- package/build/lib/controller/SendDataBridgeMessages.js.map +1 -1
- package/build/lib/controller/SendDataMessages.d.ts +1 -1
- package/build/lib/controller/SendDataMessages.d.ts.map +1 -1
- package/build/lib/controller/SendDataMessages.js +10 -9
- package/build/lib/controller/SendDataMessages.js.map +1 -1
- package/build/lib/controller/SendDataShared.d.ts +2 -70
- package/build/lib/controller/SendDataShared.d.ts.map +1 -1
- package/build/lib/controller/SendDataShared.js +15 -72
- package/build/lib/controller/SendDataShared.js.map +1 -1
- package/build/lib/controller/SetSUCNodeIDMessages.d.ts +1 -1
- package/build/lib/controller/SetSUCNodeIDMessages.d.ts.map +1 -1
- package/build/lib/controller/SetSUCNodeIDMessages.js +2 -2
- package/build/lib/controller/SetSUCNodeIDMessages.js.map +1 -1
- package/build/lib/controller/_Types.d.ts +70 -0
- package/build/lib/controller/_Types.d.ts.map +1 -0
- package/build/lib/controller/_Types.js +48 -0
- package/build/lib/controller/_Types.js.map +1 -0
- package/build/lib/driver/Driver.d.ts +2 -1
- package/build/lib/driver/Driver.d.ts.map +1 -1
- package/build/lib/driver/Driver.js +20 -19
- package/build/lib/driver/Driver.js.map +1 -1
- package/build/lib/driver/NetworkCache.js +4 -4
- package/build/lib/driver/NetworkCache.js.map +1 -1
- package/build/lib/driver/SendThreadMachine.js +3 -3
- package/build/lib/driver/SendThreadMachine.js.map +1 -1
- package/build/lib/driver/StateMachineShared.d.ts.map +1 -1
- package/build/lib/driver/StateMachineShared.js +3 -2
- package/build/lib/driver/StateMachineShared.js.map +1 -1
- package/build/lib/driver/Transaction.js +3 -3
- package/build/lib/driver/Transaction.js.map +1 -1
- package/build/lib/log/Controller.js +4 -4
- package/build/lib/log/Controller.js.map +1 -1
- package/build/lib/log/Driver.js +2 -2
- package/build/lib/log/Driver.js.map +1 -1
- package/build/lib/message/Message.d.ts +1 -1
- package/build/lib/message/Message.d.ts.map +1 -1
- package/build/lib/message/Message.js +6 -6
- package/build/lib/message/Message.js.map +1 -1
- package/build/lib/node/DeviceClass.d.ts +1 -1
- package/build/lib/node/DeviceClass.d.ts.map +1 -1
- package/build/lib/node/DeviceClass.js +3 -3
- package/build/lib/node/DeviceClass.js.map +1 -1
- package/build/lib/node/HealthCheck.d.ts +1 -1
- package/build/lib/node/HealthCheck.d.ts.map +1 -1
- package/build/lib/node/HealthCheck.js +5 -5
- package/build/lib/node/HealthCheck.js.map +1 -1
- package/build/lib/node/Node.d.ts +3 -3
- package/build/lib/node/Node.d.ts.map +1 -1
- package/build/lib/node/Node.js +65 -62
- package/build/lib/node/Node.js.map +1 -1
- package/build/lib/node/NodeStatistics.d.ts +1 -1
- package/build/lib/node/NodeStatistics.d.ts.map +1 -1
- package/build/lib/node/NodeStatusMachine.d.ts +1 -1
- package/build/lib/node/NodeStatusMachine.d.ts.map +1 -1
- package/build/lib/node/NodeStatusMachine.js +7 -7
- package/build/lib/node/NodeStatusMachine.js.map +1 -1
- package/build/lib/node/VirtualEndpoint.d.ts +1 -1
- package/build/lib/node/VirtualEndpoint.d.ts.map +1 -1
- package/build/lib/node/VirtualEndpoint.js +9 -9
- package/build/lib/node/VirtualEndpoint.js.map +1 -1
- package/build/lib/node/{Types.d.ts → _Types.d.ts} +3 -6
- package/build/lib/node/_Types.d.ts.map +1 -0
- package/build/lib/node/{Types.js → _Types.js} +1 -1
- package/build/lib/node/_Types.js.map +1 -0
- package/build/lib/serialapi/misc/GetBackgroundRSSIMessages.d.ts +1 -1
- package/build/lib/serialapi/misc/GetBackgroundRSSIMessages.d.ts.map +1 -1
- package/build/lib/serialapi/misc/GetBackgroundRSSIMessages.js +4 -3
- package/build/lib/serialapi/misc/GetBackgroundRSSIMessages.js.map +1 -1
- package/package.json +39 -14
- package/build/lib/node/Types.d.ts.map +0 -1
- package/build/lib/node/Types.js.map +0 -1
package/build/lib/node/Node.js
CHANGED
|
@@ -31,16 +31,16 @@ const MultiChannelCC_1 = require("../commandclass/MultiChannelCC");
|
|
|
31
31
|
const MultilevelSwitchCC_1 = require("../commandclass/MultilevelSwitchCC");
|
|
32
32
|
const NodeNamingCC_1 = require("../commandclass/NodeNamingCC");
|
|
33
33
|
const NotificationCC_1 = require("../commandclass/NotificationCC");
|
|
34
|
-
const PowerlevelCC_1 = require("../commandclass/PowerlevelCC");
|
|
35
34
|
const SceneActivationCC_1 = require("../commandclass/SceneActivationCC");
|
|
36
35
|
const Security2CC_1 = require("../commandclass/Security2CC");
|
|
37
36
|
const SecurityCC_1 = require("../commandclass/SecurityCC");
|
|
38
37
|
const VersionCC_1 = require("../commandclass/VersionCC");
|
|
39
38
|
const WakeUpCC_1 = require("../commandclass/WakeUpCC");
|
|
40
39
|
const ZWavePlusCC_1 = require("../commandclass/ZWavePlusCC");
|
|
40
|
+
const _Types_1 = require("../commandclass/_Types");
|
|
41
41
|
const ApplicationUpdateRequest_1 = require("../controller/ApplicationUpdateRequest");
|
|
42
42
|
const GetNodeProtocolInfoMessages_1 = require("../controller/GetNodeProtocolInfoMessages");
|
|
43
|
-
const
|
|
43
|
+
const _Types_2 = require("../controller/_Types");
|
|
44
44
|
const NetworkCache_1 = require("../driver/NetworkCache");
|
|
45
45
|
const StateMachineShared_1 = require("../driver/StateMachineShared");
|
|
46
46
|
const Constants_1 = require("../message/Constants");
|
|
@@ -51,7 +51,7 @@ const NodeReadyMachine_1 = require("./NodeReadyMachine");
|
|
|
51
51
|
const NodeStatistics_1 = require("./NodeStatistics");
|
|
52
52
|
const NodeStatusMachine_1 = require("./NodeStatusMachine");
|
|
53
53
|
const RequestNodeInfoMessages_1 = require("./RequestNodeInfoMessages");
|
|
54
|
-
const
|
|
54
|
+
const _Types_3 = require("./_Types");
|
|
55
55
|
/**
|
|
56
56
|
* A ZWaveNode represents a node in a Z-Wave network. It is also an instance
|
|
57
57
|
* of its root endpoint (index 0)
|
|
@@ -61,7 +61,7 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
61
61
|
// Define this node's intrinsic endpoint as the root device (0)
|
|
62
62
|
super(id, driver, 0, deviceClass, supportedCCs);
|
|
63
63
|
this.id = id;
|
|
64
|
-
this._status =
|
|
64
|
+
this._status = _Types_3.NodeStatus.Unknown;
|
|
65
65
|
this._ready = false;
|
|
66
66
|
/**
|
|
67
67
|
* @internal
|
|
@@ -250,23 +250,23 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
250
250
|
return;
|
|
251
251
|
const oldStatus = this._status;
|
|
252
252
|
this._status = newStatus;
|
|
253
|
-
if (this._status ===
|
|
253
|
+
if (this._status === _Types_3.NodeStatus.Asleep) {
|
|
254
254
|
this.emit("sleep", this, oldStatus);
|
|
255
255
|
}
|
|
256
|
-
else if (this._status ===
|
|
256
|
+
else if (this._status === _Types_3.NodeStatus.Awake) {
|
|
257
257
|
this.emit("wake up", this, oldStatus);
|
|
258
258
|
}
|
|
259
|
-
else if (this._status ===
|
|
259
|
+
else if (this._status === _Types_3.NodeStatus.Dead) {
|
|
260
260
|
this.emit("dead", this, oldStatus);
|
|
261
261
|
}
|
|
262
|
-
else if (this._status ===
|
|
262
|
+
else if (this._status === _Types_3.NodeStatus.Alive) {
|
|
263
263
|
this.emit("alive", this, oldStatus);
|
|
264
264
|
}
|
|
265
265
|
// To be marked ready, a node must be known to be not dead.
|
|
266
266
|
// This means that listening nodes must have communicated with us and
|
|
267
267
|
// sleeping nodes are assumed to be ready
|
|
268
|
-
this.readyMachine.send(this._status !==
|
|
269
|
-
this._status !==
|
|
268
|
+
this.readyMachine.send(this._status !== _Types_3.NodeStatus.Unknown &&
|
|
269
|
+
this._status !== _Types_3.NodeStatus.Dead
|
|
270
270
|
? "NOT_DEAD"
|
|
271
271
|
: "MAYBE_DEAD");
|
|
272
272
|
}
|
|
@@ -309,7 +309,7 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
309
309
|
if (!this.canSleep || !this.supportsCC(core_1.CommandClasses["Wake Up"])) {
|
|
310
310
|
throw new core_1.ZWaveError(`Node ${this.id} does not support wakeup!`, core_1.ZWaveErrorCodes.CC_NotSupported);
|
|
311
311
|
}
|
|
312
|
-
else if (this._status ===
|
|
312
|
+
else if (this._status === _Types_3.NodeStatus.Awake) {
|
|
313
313
|
return Promise.resolve();
|
|
314
314
|
}
|
|
315
315
|
return new Promise((resolve) => {
|
|
@@ -471,7 +471,7 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
471
471
|
}
|
|
472
472
|
get shouldRequestWakeUpOnDemand() {
|
|
473
473
|
return (!!this.supportsWakeUpOnDemand &&
|
|
474
|
-
this.status ===
|
|
474
|
+
this.status === _Types_3.NodeStatus.Asleep &&
|
|
475
475
|
this.driver.hasPendingTransactions((t) => t.requestWakeUpOnDemand &&
|
|
476
476
|
t.message.getNodeId() === this.id));
|
|
477
477
|
}
|
|
@@ -890,7 +890,7 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
890
890
|
*/
|
|
891
891
|
get interviewStage() {
|
|
892
892
|
var _a;
|
|
893
|
-
return ((_a = this.driver.cacheGet(NetworkCache_1.cacheKeys.node(this.id).interviewStage)) !== null && _a !== void 0 ? _a :
|
|
893
|
+
return ((_a = this.driver.cacheGet(NetworkCache_1.cacheKeys.node(this.id).interviewStage)) !== null && _a !== void 0 ? _a : _Types_3.InterviewStage.None);
|
|
894
894
|
}
|
|
895
895
|
set interviewStage(value) {
|
|
896
896
|
this.driver.cacheSet(NetworkCache_1.cacheKeys.node(this.id).interviewStage, value);
|
|
@@ -930,7 +930,7 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
930
930
|
if (resetSecurityClasses)
|
|
931
931
|
this.securityClasses.clear();
|
|
932
932
|
this._interviewAttempts = 0;
|
|
933
|
-
this.interviewStage =
|
|
933
|
+
this.interviewStage = _Types_3.InterviewStage.None;
|
|
934
934
|
this._ready = false;
|
|
935
935
|
this.deviceClass = undefined;
|
|
936
936
|
this.isListening = undefined;
|
|
@@ -971,7 +971,7 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
971
971
|
* for a specific node, use `node.refreshInfo()` instead
|
|
972
972
|
*/
|
|
973
973
|
async interview() {
|
|
974
|
-
if (this.interviewStage ===
|
|
974
|
+
if (this.interviewStage === _Types_3.InterviewStage.Complete) {
|
|
975
975
|
this.driver.controllerLog.logNode(this.id, `skipping interview because it is already completed`);
|
|
976
976
|
return true;
|
|
977
977
|
}
|
|
@@ -997,7 +997,7 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
997
997
|
// The interview is done in several stages. At each point, the interview process might be aborted
|
|
998
998
|
// due to a stage failing. The reached stage is saved, so we can continue it later without
|
|
999
999
|
// repeating stages unnecessarily
|
|
1000
|
-
if (this.interviewStage ===
|
|
1000
|
+
if (this.interviewStage === _Types_3.InterviewStage.None) {
|
|
1001
1001
|
// do a full interview starting with the protocol info
|
|
1002
1002
|
this.driver.controllerLog.logNode(this.id, `new node, doing a full interview...`);
|
|
1003
1003
|
this.emit("interview started", this);
|
|
@@ -1005,21 +1005,21 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
if (!this.isControllerNode) {
|
|
1007
1007
|
if ((this.isListening || this.isFrequentListening) &&
|
|
1008
|
-
this.status !==
|
|
1008
|
+
this.status !== _Types_3.NodeStatus.Alive) {
|
|
1009
1009
|
// Ping non-sleeping nodes to determine their status
|
|
1010
1010
|
await this.ping();
|
|
1011
1011
|
}
|
|
1012
|
-
if (this.interviewStage ===
|
|
1012
|
+
if (this.interviewStage === _Types_3.InterviewStage.ProtocolInfo) {
|
|
1013
1013
|
if (!(await tryInterviewStage(() => this.queryNodeInfo()))) {
|
|
1014
1014
|
return false;
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
1017
|
// At this point the basic interview of new nodes is done. Start here when re-interviewing known nodes
|
|
1018
1018
|
// to get updated information about command classes
|
|
1019
|
-
if (this.interviewStage ===
|
|
1019
|
+
if (this.interviewStage === _Types_3.InterviewStage.NodeInfo) {
|
|
1020
1020
|
// Only advance the interview if it was completed, otherwise abort
|
|
1021
1021
|
if (await this.interviewCCs()) {
|
|
1022
|
-
this.setInterviewStage(
|
|
1022
|
+
this.setInterviewStage(_Types_3.InterviewStage.CommandClasses);
|
|
1023
1023
|
}
|
|
1024
1024
|
else {
|
|
1025
1025
|
return false;
|
|
@@ -1027,13 +1027,13 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
1029
|
if ((this.isControllerNode &&
|
|
1030
|
-
this.interviewStage ===
|
|
1030
|
+
this.interviewStage === _Types_3.InterviewStage.ProtocolInfo) ||
|
|
1031
1031
|
(!this.isControllerNode &&
|
|
1032
|
-
this.interviewStage ===
|
|
1032
|
+
this.interviewStage === _Types_3.InterviewStage.CommandClasses)) {
|
|
1033
1033
|
// Load a config file for this node if it exists and overwrite the previously reported information
|
|
1034
1034
|
await this.overwriteConfig();
|
|
1035
1035
|
}
|
|
1036
|
-
this.setInterviewStage(
|
|
1036
|
+
this.setInterviewStage(_Types_3.InterviewStage.Complete);
|
|
1037
1037
|
this.readyMachine.send("INTERVIEW_DONE");
|
|
1038
1038
|
// Tell listeners that the interview is completed
|
|
1039
1039
|
// The driver will then send this node to sleep
|
|
@@ -1043,7 +1043,7 @@ let ZWaveNode = class ZWaveNode extends Endpoint_1.Endpoint {
|
|
|
1043
1043
|
/** Updates this node's interview stage and saves to cache when appropriate */
|
|
1044
1044
|
setInterviewStage(completedStage) {
|
|
1045
1045
|
this.interviewStage = completedStage;
|
|
1046
|
-
this.emit("interview stage completed", this, (0, shared_1.getEnumMemberName)(
|
|
1046
|
+
this.emit("interview stage completed", this, (0, shared_1.getEnumMemberName)(_Types_3.InterviewStage, completedStage));
|
|
1047
1047
|
this.driver.controllerLog.interviewStage(this);
|
|
1048
1048
|
}
|
|
1049
1049
|
/** Step #1 of the node interview */
|
|
@@ -1082,7 +1082,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
1082
1082
|
});
|
|
1083
1083
|
// Assume that sleeping nodes start asleep
|
|
1084
1084
|
if (this.canSleep) {
|
|
1085
|
-
if (this.status ===
|
|
1085
|
+
if (this.status === _Types_3.NodeStatus.Alive) {
|
|
1086
1086
|
// unless it was just inluded and is currently communicating with us
|
|
1087
1087
|
// In that case we need to switch from alive/dead to awake/asleep
|
|
1088
1088
|
this.markAsAwake();
|
|
@@ -1091,7 +1091,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
1091
1091
|
this.markAsAsleep();
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
|
-
this.setInterviewStage(
|
|
1094
|
+
this.setInterviewStage(_Types_3.InterviewStage.ProtocolInfo);
|
|
1095
1095
|
}
|
|
1096
1096
|
/** Node interview: pings the node to see if it responds */
|
|
1097
1097
|
async ping() {
|
|
@@ -1157,7 +1157,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
1157
1157
|
});
|
|
1158
1158
|
this.updateNodeInfo(resp.nodeInformation);
|
|
1159
1159
|
}
|
|
1160
|
-
this.setInterviewStage(
|
|
1160
|
+
this.setInterviewStage(_Types_3.InterviewStage.NodeInfo);
|
|
1161
1161
|
}
|
|
1162
1162
|
/**
|
|
1163
1163
|
* Loads the device configuration for this node from a config file
|
|
@@ -1432,7 +1432,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
1432
1432
|
*/
|
|
1433
1433
|
updateNodeInfo(nodeInfo) {
|
|
1434
1434
|
var _a, _b;
|
|
1435
|
-
if (this.interviewStage <
|
|
1435
|
+
if (this.interviewStage < _Types_3.InterviewStage.NodeInfo) {
|
|
1436
1436
|
for (const cc of nodeInfo.supportedCCs)
|
|
1437
1437
|
this.addCC(cc, { isSupported: true });
|
|
1438
1438
|
for (const cc of nodeInfo.controlledCCs)
|
|
@@ -1457,7 +1457,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
1457
1457
|
requiresManualValueRefresh() {
|
|
1458
1458
|
// If there was no lifeline configured, we assume that the controller
|
|
1459
1459
|
// does not receive unsolicited updates from the node
|
|
1460
|
-
return (this.interviewStage ===
|
|
1460
|
+
return (this.interviewStage === _Types_3.InterviewStage.Complete &&
|
|
1461
1461
|
!this.supportsCC(core_1.CommandClasses["Z-Wave Plus Info"]) &&
|
|
1462
1462
|
!this.valueDB.getValue((0, AssociationCC_1.getHasLifelineValueId)()));
|
|
1463
1463
|
}
|
|
@@ -1647,7 +1647,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
1649
|
}
|
|
1650
|
-
this.setInterviewStage(
|
|
1650
|
+
this.setInterviewStage(_Types_3.InterviewStage.OverwriteConfig);
|
|
1651
1651
|
}
|
|
1652
1652
|
/**
|
|
1653
1653
|
* @internal
|
|
@@ -2199,7 +2199,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2199
2199
|
message: "treating MultilevelSwitchCC::StartLevelChange as a notification",
|
|
2200
2200
|
});
|
|
2201
2201
|
this.emit("notification", this, core_1.CommandClasses["Multilevel Switch"], {
|
|
2202
|
-
eventType:
|
|
2202
|
+
eventType: _Types_1.MultilevelSwitchCommand.StartLevelChange,
|
|
2203
2203
|
direction: command.direction,
|
|
2204
2204
|
});
|
|
2205
2205
|
}
|
|
@@ -2208,7 +2208,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2208
2208
|
endpoint: command.endpointIndex,
|
|
2209
2209
|
message: "treating MultilevelSwitchCC::StopLevelChange as a notification",
|
|
2210
2210
|
});
|
|
2211
|
-
this.emit("notification", this, core_1.CommandClasses["Multilevel Switch"], { eventType:
|
|
2211
|
+
this.emit("notification", this, core_1.CommandClasses["Multilevel Switch"], { eventType: _Types_1.MultilevelSwitchCommand.StopLevelChange });
|
|
2212
2212
|
}
|
|
2213
2213
|
}
|
|
2214
2214
|
/** Schedules a notification value to be reset */
|
|
@@ -2797,7 +2797,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2797
2797
|
}
|
|
2798
2798
|
}
|
|
2799
2799
|
// Mark already-interviewed nodes as potentially ready
|
|
2800
|
-
if (this.interviewStage ===
|
|
2800
|
+
if (this.interviewStage === _Types_3.InterviewStage.Complete) {
|
|
2801
2801
|
this.readyMachine.send("RESTART_FROM_CACHE");
|
|
2802
2802
|
}
|
|
2803
2803
|
}
|
|
@@ -2814,8 +2814,8 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2814
2814
|
return false;
|
|
2815
2815
|
this.isSendingNoMoreInformation = true;
|
|
2816
2816
|
let msgSent = false;
|
|
2817
|
-
if (this.status ===
|
|
2818
|
-
this.interviewStage ===
|
|
2817
|
+
if (this.status === _Types_3.NodeStatus.Awake &&
|
|
2818
|
+
this.interviewStage === _Types_3.InterviewStage.Complete) {
|
|
2819
2819
|
this.driver.controllerLog.logNode(this.id, {
|
|
2820
2820
|
message: "Sending node back to sleep...",
|
|
2821
2821
|
direction: "outbound",
|
|
@@ -2881,7 +2881,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2881
2881
|
// Safeguard against infinite loop:
|
|
2882
2882
|
// If we didn't get a result, or there was no progress, try again next iteration
|
|
2883
2883
|
if (!status ||
|
|
2884
|
-
(status.status ===
|
|
2884
|
+
(status.status === commandclass_1.PowerlevelTestStatus["In Progress"] &&
|
|
2885
2885
|
status.acknowledgedFrames === previousProgress)) {
|
|
2886
2886
|
if (continuousErrors > 5)
|
|
2887
2887
|
return result(0);
|
|
@@ -2892,10 +2892,10 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2892
2892
|
previousProgress = status.acknowledgedFrames;
|
|
2893
2893
|
continuousErrors = 0;
|
|
2894
2894
|
}
|
|
2895
|
-
if (status.status ===
|
|
2895
|
+
if (status.status === commandclass_1.PowerlevelTestStatus.Failed) {
|
|
2896
2896
|
return result(0);
|
|
2897
2897
|
}
|
|
2898
|
-
else if (status.status ===
|
|
2898
|
+
else if (status.status === commandclass_1.PowerlevelTestStatus.Success) {
|
|
2899
2899
|
return result(status.acknowledgedFrames);
|
|
2900
2900
|
}
|
|
2901
2901
|
else if (onProgress) {
|
|
@@ -2918,7 +2918,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2918
2918
|
var _a, _b, _c;
|
|
2919
2919
|
const failedPings = Math.max((_a = result.failedPingsController) !== null && _a !== void 0 ? _a : 0, result.failedPingsNode);
|
|
2920
2920
|
const numNeighbors = result.numNeighbors;
|
|
2921
|
-
const minPowerlevel = (_b = result.minPowerlevel) !== null && _b !== void 0 ? _b :
|
|
2921
|
+
const minPowerlevel = (_b = result.minPowerlevel) !== null && _b !== void 0 ? _b : commandclass_1.Powerlevel["-6 dBm"];
|
|
2922
2922
|
const snrMargin = (_c = result.snrMargin) !== null && _c !== void 0 ? _c : 17;
|
|
2923
2923
|
const latency = result.latency;
|
|
2924
2924
|
if (failedPings === 10)
|
|
@@ -2933,7 +2933,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2933
2933
|
return 4;
|
|
2934
2934
|
if (latency > 100)
|
|
2935
2935
|
return 5;
|
|
2936
|
-
if (minPowerlevel <
|
|
2936
|
+
if (minPowerlevel < commandclass_1.Powerlevel["-6 dBm"] || snrMargin < 17) {
|
|
2937
2937
|
// Lower powerlevel reductions (= higher power) have lower numeric values
|
|
2938
2938
|
return numNeighbors > 2 ? 7 : 6;
|
|
2939
2939
|
}
|
|
@@ -2944,7 +2944,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2944
2944
|
return 10;
|
|
2945
2945
|
};
|
|
2946
2946
|
this.driver.controllerLog.logNode(this.id, `Starting lifeline health check (${rounds} round${rounds !== 1 ? "s" : ""})...`);
|
|
2947
|
-
if (this.canSleep && this.status !==
|
|
2947
|
+
if (this.canSleep && this.status !== _Types_3.NodeStatus.Awake) {
|
|
2948
2948
|
// Wait for node to wake up to avoid incorrectly long delays in the first health check round
|
|
2949
2949
|
this.driver.controllerLog.logNode(this.id, `waiting for node to wake up...`);
|
|
2950
2950
|
await this.waitForWakeup();
|
|
@@ -2985,7 +2985,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
2985
2985
|
}
|
|
2986
2986
|
// If possible, compute the SNR margin from the test results
|
|
2987
2987
|
if (rssi != undefined &&
|
|
2988
|
-
rssi <
|
|
2988
|
+
rssi < _Types_2.RssiError.NoSignalDetected &&
|
|
2989
2989
|
channel != undefined) {
|
|
2990
2990
|
const backgroundRSSI = await this.driver.controller.getBackgroundRSSI();
|
|
2991
2991
|
if (`rssiChannel${channel}` in backgroundRSSI) {
|
|
@@ -3006,19 +3006,19 @@ protocol version: ${this.protocolVersion}`;
|
|
|
3006
3006
|
// Do a binary search and find the highest reduction in powerlevel for which there are no errors
|
|
3007
3007
|
let failedPingsController = 0;
|
|
3008
3008
|
const executor = async (powerlevel) => {
|
|
3009
|
-
this.driver.controllerLog.logNode(this.id, `Sending ${HealthCheck_1.healthCheckTestFrameCount} pings to controller at ${(0, shared_1.getEnumMemberName)(
|
|
3009
|
+
this.driver.controllerLog.logNode(this.id, `Sending ${HealthCheck_1.healthCheckTestFrameCount} pings to controller at ${(0, shared_1.getEnumMemberName)(commandclass_1.Powerlevel, powerlevel)}...`);
|
|
3010
3010
|
const result = await this.testPowerlevel(this.driver.controller.ownNodeId, powerlevel, HealthCheck_1.healthCheckTestFrameCount);
|
|
3011
3011
|
failedPingsController = HealthCheck_1.healthCheckTestFrameCount - result;
|
|
3012
|
-
this.driver.controllerLog.logNode(this.id, `At ${(0, shared_1.getEnumMemberName)(
|
|
3012
|
+
this.driver.controllerLog.logNode(this.id, `At ${(0, shared_1.getEnumMemberName)(commandclass_1.Powerlevel, powerlevel)}, ${result}/${HealthCheck_1.healthCheckTestFrameCount} pings were acknowledged...`);
|
|
3013
3013
|
return failedPingsController === 0;
|
|
3014
3014
|
};
|
|
3015
3015
|
try {
|
|
3016
|
-
const powerlevel = await (0, shared_1.
|
|
3017
|
-
|
|
3016
|
+
const powerlevel = await (0, shared_1.discreteLinearSearch)(commandclass_1.Powerlevel["Normal Power"], // minimum reduction
|
|
3017
|
+
commandclass_1.Powerlevel["-9 dBm"], // maximum reduction
|
|
3018
3018
|
executor);
|
|
3019
3019
|
if (powerlevel == undefined) {
|
|
3020
3020
|
// There were still failures at normal power, report it
|
|
3021
|
-
ret.minPowerlevel =
|
|
3021
|
+
ret.minPowerlevel = commandclass_1.Powerlevel["Normal Power"];
|
|
3022
3022
|
ret.failedPingsController = failedPingsController;
|
|
3023
3023
|
}
|
|
3024
3024
|
else {
|
|
@@ -3029,7 +3029,7 @@ protocol version: ${this.protocolVersion}`;
|
|
|
3029
3029
|
if ((0, core_1.isZWaveError)(e) &&
|
|
3030
3030
|
e.code === core_1.ZWaveErrorCodes.Controller_CallbackNOK) {
|
|
3031
3031
|
// The node is dead, treat this as a failure
|
|
3032
|
-
ret.minPowerlevel =
|
|
3032
|
+
ret.minPowerlevel = commandclass_1.Powerlevel["Normal Power"];
|
|
3033
3033
|
ret.failedPingsController = HealthCheck_1.healthCheckTestFrameCount;
|
|
3034
3034
|
}
|
|
3035
3035
|
else {
|
|
@@ -3075,7 +3075,7 @@ ${(0, HealthCheck_1.formatLifelineHealthCheckSummary)(summary)}`);
|
|
|
3075
3075
|
var _a, _b, _c, _d;
|
|
3076
3076
|
const failedPings = Math.max((_a = result.failedPingsToSource) !== null && _a !== void 0 ? _a : 0, (_b = result.failedPingsToTarget) !== null && _b !== void 0 ? _b : 0);
|
|
3077
3077
|
const numNeighbors = result.numNeighbors;
|
|
3078
|
-
const minPowerlevel = Math.max((_c = result.minPowerlevelSource) !== null && _c !== void 0 ? _c :
|
|
3078
|
+
const minPowerlevel = Math.max((_c = result.minPowerlevelSource) !== null && _c !== void 0 ? _c : commandclass_1.Powerlevel["-6 dBm"], (_d = result.minPowerlevelTarget) !== null && _d !== void 0 ? _d : commandclass_1.Powerlevel["-6 dBm"]);
|
|
3079
3079
|
if (failedPings === 10)
|
|
3080
3080
|
return 0;
|
|
3081
3081
|
if (failedPings > 2)
|
|
@@ -3084,7 +3084,7 @@ ${(0, HealthCheck_1.formatLifelineHealthCheckSummary)(summary)}`);
|
|
|
3084
3084
|
return 2;
|
|
3085
3085
|
if (failedPings === 1)
|
|
3086
3086
|
return 3;
|
|
3087
|
-
if (minPowerlevel <
|
|
3087
|
+
if (minPowerlevel < commandclass_1.Powerlevel["-6 dBm"]) {
|
|
3088
3088
|
// Lower powerlevel reductions (= higher power) have lower numeric values
|
|
3089
3089
|
return numNeighbors > 2 ? 7 : 6;
|
|
3090
3090
|
}
|
|
@@ -3104,21 +3104,24 @@ ${(0, HealthCheck_1.formatLifelineHealthCheckSummary)(summary)}`);
|
|
|
3104
3104
|
let failedPingsToTarget;
|
|
3105
3105
|
let minPowerlevelTarget;
|
|
3106
3106
|
const executor = (node, otherNode) => async (powerlevel) => {
|
|
3107
|
-
this.driver.controllerLog.logNode(node.id, `Sending ${healthCheckTestFrameCount} pings to node ${otherNode.id} at ${(0, shared_1.getEnumMemberName)(
|
|
3107
|
+
this.driver.controllerLog.logNode(node.id, `Sending ${healthCheckTestFrameCount} pings to node ${otherNode.id} at ${(0, shared_1.getEnumMemberName)(commandclass_1.Powerlevel, powerlevel)}...`);
|
|
3108
3108
|
const result = await node.testPowerlevel(otherNode.id, powerlevel, healthCheckTestFrameCount);
|
|
3109
3109
|
failedPings = healthCheckTestFrameCount - result;
|
|
3110
|
-
this.driver.controllerLog.logNode(node.id, `At ${(0, shared_1.getEnumMemberName)(
|
|
3110
|
+
this.driver.controllerLog.logNode(node.id, `At ${(0, shared_1.getEnumMemberName)(commandclass_1.Powerlevel, powerlevel)}, ${result}/${healthCheckTestFrameCount} pings were acknowledged by node ${otherNode.id}...`);
|
|
3111
3111
|
return failedPings === 0;
|
|
3112
3112
|
};
|
|
3113
3113
|
// Now instruct this node to ping the other one, figuring out the minimum powerlevel
|
|
3114
3114
|
if (this.supportsCC(core_1.CommandClasses.Powerlevel)) {
|
|
3115
3115
|
try {
|
|
3116
|
-
|
|
3117
|
-
|
|
3116
|
+
// We have to start with the maximum powerlevel and work our way down
|
|
3117
|
+
// Otherwise some nodes get stuck trying to complete the check at a bad powerlevel
|
|
3118
|
+
// causing the following measurements to fail.
|
|
3119
|
+
const powerlevel = await (0, shared_1.discreteLinearSearch)(commandclass_1.Powerlevel["Normal Power"], // minimum reduction
|
|
3120
|
+
commandclass_1.Powerlevel["-9 dBm"], // maximum reduction
|
|
3118
3121
|
executor(this, otherNode));
|
|
3119
3122
|
if (powerlevel == undefined) {
|
|
3120
3123
|
// There were still failures at normal power, report it
|
|
3121
|
-
minPowerlevelSource =
|
|
3124
|
+
minPowerlevelSource = commandclass_1.Powerlevel["Normal Power"];
|
|
3122
3125
|
failedPingsToTarget = failedPings;
|
|
3123
3126
|
}
|
|
3124
3127
|
else {
|
|
@@ -3130,7 +3133,7 @@ ${(0, HealthCheck_1.formatLifelineHealthCheckSummary)(summary)}`);
|
|
|
3130
3133
|
if ((0, core_1.isZWaveError)(e) &&
|
|
3131
3134
|
e.code === core_1.ZWaveErrorCodes.Controller_CallbackNOK) {
|
|
3132
3135
|
// The node is dead, treat this as a failure
|
|
3133
|
-
minPowerlevelSource =
|
|
3136
|
+
minPowerlevelSource = commandclass_1.Powerlevel["Normal Power"];
|
|
3134
3137
|
failedPingsToTarget = healthCheckTestFrameCount;
|
|
3135
3138
|
}
|
|
3136
3139
|
else {
|
|
@@ -3142,12 +3145,12 @@ ${(0, HealthCheck_1.formatLifelineHealthCheckSummary)(summary)}`);
|
|
|
3142
3145
|
if (!this.canSleep &&
|
|
3143
3146
|
otherNode.supportsCC(core_1.CommandClasses.Powerlevel)) {
|
|
3144
3147
|
try {
|
|
3145
|
-
const powerlevel = await (0, shared_1.
|
|
3146
|
-
|
|
3148
|
+
const powerlevel = await (0, shared_1.discreteLinearSearch)(commandclass_1.Powerlevel["Normal Power"], // minimum reduction
|
|
3149
|
+
commandclass_1.Powerlevel["-9 dBm"], // maximum reduction
|
|
3147
3150
|
executor(otherNode, this));
|
|
3148
3151
|
if (powerlevel == undefined) {
|
|
3149
3152
|
// There were still failures at normal power, report it
|
|
3150
|
-
minPowerlevelTarget =
|
|
3153
|
+
minPowerlevelTarget = commandclass_1.Powerlevel["Normal Power"];
|
|
3151
3154
|
failedPingsToSource = failedPings;
|
|
3152
3155
|
}
|
|
3153
3156
|
else {
|
|
@@ -3159,7 +3162,7 @@ ${(0, HealthCheck_1.formatLifelineHealthCheckSummary)(summary)}`);
|
|
|
3159
3162
|
if ((0, core_1.isZWaveError)(e) &&
|
|
3160
3163
|
e.code === core_1.ZWaveErrorCodes.Controller_CallbackNOK) {
|
|
3161
3164
|
// The node is dead, treat this as a failure
|
|
3162
|
-
minPowerlevelTarget =
|
|
3165
|
+
minPowerlevelTarget = commandclass_1.Powerlevel["Normal Power"];
|
|
3163
3166
|
failedPingsToSource = healthCheckTestFrameCount;
|
|
3164
3167
|
}
|
|
3165
3168
|
else {
|
|
@@ -3212,7 +3215,7 @@ ${(0, HealthCheck_1.formatRouteHealthCheckSummary)(this.id, otherNode.id, summar
|
|
|
3212
3215
|
// Update ACK RSSI
|
|
3213
3216
|
if (txReport.ackRSSI != undefined) {
|
|
3214
3217
|
ret.rssi =
|
|
3215
|
-
ret.rssi == undefined || (0,
|
|
3218
|
+
ret.rssi == undefined || (0, _Types_2.isRssiError)(txReport.ackRSSI)
|
|
3216
3219
|
? txReport.ackRSSI
|
|
3217
3220
|
: Math.round(ret.rssi * 0.75 + txReport.ackRSSI * 0.25);
|
|
3218
3221
|
}
|
|
@@ -3220,7 +3223,7 @@ ${(0, HealthCheck_1.formatRouteHealthCheckSummary)(this.id, otherNode.id, summar
|
|
|
3220
3223
|
const newStats = {
|
|
3221
3224
|
protocolDataRate: txReport.routeSpeed,
|
|
3222
3225
|
repeaters: ((_a = txReport.repeaterNodeIds) !== null && _a !== void 0 ? _a : []),
|
|
3223
|
-
rssi: (_d = (_b = txReport.ackRSSI) !== null && _b !== void 0 ? _b : (_c = ret.lwr) === null || _c === void 0 ? void 0 : _c.rssi) !== null && _d !== void 0 ? _d :
|
|
3226
|
+
rssi: (_d = (_b = txReport.ackRSSI) !== null && _b !== void 0 ? _b : (_c = ret.lwr) === null || _c === void 0 ? void 0 : _c.rssi) !== null && _d !== void 0 ? _d : _Types_2.RssiError.NotAvailable,
|
|
3224
3227
|
};
|
|
3225
3228
|
if (txReport.ackRepeaterRSSI != undefined) {
|
|
3226
3229
|
newStats.repeaterRSSI = txReport.ackRepeaterRSSI;
|