zwave-js 8.6.1 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Utils.d.ts +2 -2
- package/build/Utils.d.ts.map +1 -1
- package/build/Utils.js +3 -1
- package/build/Utils.js.map +1 -1
- package/build/lib/commandclass/AssociationCC.d.ts.map +1 -1
- package/build/lib/commandclass/AssociationCC.js +2 -4
- package/build/lib/commandclass/AssociationCC.js.map +1 -1
- package/build/lib/commandclass/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/lib/commandclass/ManufacturerProprietaryCC.js +15 -8
- package/build/lib/commandclass/ManufacturerProprietaryCC.js.map +1 -1
- package/build/lib/commandclass/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/lib/commandclass/MultiChannelAssociationCC.js +2 -4
- package/build/lib/commandclass/MultiChannelAssociationCC.js.map +1 -1
- package/build/lib/controller/AddNodeToNetworkRequest.d.ts +36 -8
- package/build/lib/controller/AddNodeToNetworkRequest.d.ts.map +1 -1
- package/build/lib/controller/AddNodeToNetworkRequest.js +111 -41
- package/build/lib/controller/AddNodeToNetworkRequest.js.map +1 -1
- package/build/lib/controller/ApplicationUpdateRequest.d.ts +16 -4
- package/build/lib/controller/ApplicationUpdateRequest.d.ts.map +1 -1
- package/build/lib/controller/ApplicationUpdateRequest.js +56 -15
- package/build/lib/controller/ApplicationUpdateRequest.js.map +1 -1
- package/build/lib/controller/Controller.d.ts +62 -20
- package/build/lib/controller/Controller.d.ts.map +1 -1
- package/build/lib/controller/Controller.js +629 -264
- package/build/lib/controller/Controller.js.map +1 -1
- package/build/lib/controller/Inclusion.d.ts +31 -4
- package/build/lib/controller/Inclusion.d.ts.map +1 -1
- package/build/lib/controller/Inclusion.js +15 -3
- package/build/lib/controller/Inclusion.js.map +1 -1
- package/build/lib/controller/RemoveNodeFromNetworkRequest.d.ts +15 -9
- package/build/lib/controller/RemoveNodeFromNetworkRequest.d.ts.map +1 -1
- package/build/lib/controller/RemoveNodeFromNetworkRequest.js +70 -41
- package/build/lib/controller/RemoveNodeFromNetworkRequest.js.map +1 -1
- package/build/lib/driver/Driver.d.ts +1 -1
- package/build/lib/driver/Driver.d.ts.map +1 -1
- package/build/lib/driver/Driver.js +154 -33
- package/build/lib/driver/Driver.js.map +1 -1
- package/build/lib/node/Node.d.ts +6 -0
- package/build/lib/node/Node.d.ts.map +1 -1
- package/build/lib/node/Node.js +20 -0
- package/build/lib/node/Node.js.map +1 -1
- package/package.json +10 -10
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.RemoveNodeFromNetworkRequest = exports.RemoveNodeStatus = exports.RemoveNodeType = void 0;
|
|
9
|
+
exports.RemoveNodeFromNetworkRequestStatusReport = exports.RemoveNodeFromNetworkRequest = exports.RemoveNodeFromNetworkRequestBase = exports.RemoveNodeStatus = exports.RemoveNodeType = void 0;
|
|
10
10
|
const core_1 = require("@zwave-js/core");
|
|
11
11
|
const Constants_1 = require("../message/Constants");
|
|
12
12
|
const Message_1 = require("../message/Message");
|
|
@@ -31,47 +31,49 @@ var RemoveNodeFlags;
|
|
|
31
31
|
RemoveNodeFlags[RemoveNodeFlags["HighPower"] = 128] = "HighPower";
|
|
32
32
|
RemoveNodeFlags[RemoveNodeFlags["NetworkWide"] = 64] = "NetworkWide";
|
|
33
33
|
})(RemoveNodeFlags || (RemoveNodeFlags = {}));
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
let RemoveNodeFromNetworkRequestBase = class RemoveNodeFromNetworkRequestBase extends Message_1.Message {
|
|
35
|
+
constructor(driver, options) {
|
|
36
|
+
if ((0, Message_1.gotDeserializationOptions)(options) &&
|
|
37
|
+
new.target !== RemoveNodeFromNetworkRequestStatusReport) {
|
|
38
|
+
return new RemoveNodeFromNetworkRequestStatusReport(driver, options);
|
|
39
|
+
}
|
|
40
|
+
super(driver, options);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
RemoveNodeFromNetworkRequestBase = __decorate([
|
|
44
|
+
(0, Message_1.messageTypes)(Constants_1.MessageType.Request, Constants_1.FunctionType.RemoveNodeFromNetwork)
|
|
45
|
+
// no expected response, the controller will respond with multiple RemoveNodeFromNetworkRequests
|
|
46
|
+
,
|
|
47
|
+
(0, Message_1.priority)(Constants_1.MessagePriority.Controller)
|
|
48
|
+
], RemoveNodeFromNetworkRequestBase);
|
|
49
|
+
exports.RemoveNodeFromNetworkRequestBase = RemoveNodeFromNetworkRequestBase;
|
|
50
|
+
function testCallbackForRemoveNodeRequest(sent, received) {
|
|
51
|
+
if (!(received instanceof RemoveNodeFromNetworkRequestStatusReport)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
switch (sent.removeNodeType) {
|
|
55
|
+
case RemoveNodeType.Any:
|
|
56
|
+
case RemoveNodeType.Controller:
|
|
57
|
+
case RemoveNodeType.Slave:
|
|
58
|
+
return (received.status === RemoveNodeStatus.Ready ||
|
|
59
|
+
received.status === RemoveNodeStatus.Failed);
|
|
60
|
+
case RemoveNodeType.Stop:
|
|
61
|
+
return (received.status === RemoveNodeStatus.Done ||
|
|
62
|
+
received.status === RemoveNodeStatus.Failed);
|
|
63
|
+
default:
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let RemoveNodeFromNetworkRequest = class RemoveNodeFromNetworkRequest extends RemoveNodeFromNetworkRequestBase {
|
|
37
68
|
constructor(driver, options = {}) {
|
|
38
69
|
super(driver, options);
|
|
39
70
|
/** Whether to use high power */
|
|
40
71
|
this.highPower = false;
|
|
41
|
-
/** Whether to
|
|
72
|
+
/** Whether to exclude network wide */
|
|
42
73
|
this.networkWide = false;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
switch (this._status) {
|
|
47
|
-
case RemoveNodeStatus.Ready:
|
|
48
|
-
case RemoveNodeStatus.NodeFound:
|
|
49
|
-
case RemoveNodeStatus.Failed:
|
|
50
|
-
case RemoveNodeStatus.Done:
|
|
51
|
-
// no context for the status to parse
|
|
52
|
-
// TODO:
|
|
53
|
-
// An application MUST time out waiting for the REMOVE_NODE_STATUS_REMOVING_SLAVE status
|
|
54
|
-
// if it does not receive the indication within a 14 sec after receiving the
|
|
55
|
-
// REMOVE_NODE_STATUS_NODE_FOUND status.
|
|
56
|
-
break;
|
|
57
|
-
case RemoveNodeStatus.RemovingController:
|
|
58
|
-
case RemoveNodeStatus.RemovingSlave:
|
|
59
|
-
// the payload contains a node information frame
|
|
60
|
-
this._statusContext = (0, core_1.parseNodeUpdatePayload)(this.payload.slice(2));
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
this.removeNodeType = options.removeNodeType;
|
|
66
|
-
this.highPower = !!options.highPower;
|
|
67
|
-
this.networkWide = !!options.networkWide;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
get status() {
|
|
71
|
-
return this._status;
|
|
72
|
-
}
|
|
73
|
-
get statusContext() {
|
|
74
|
-
return this._statusContext;
|
|
74
|
+
this.removeNodeType = options.removeNodeType;
|
|
75
|
+
this.highPower = !!options.highPower;
|
|
76
|
+
this.networkWide = !!options.networkWide;
|
|
75
77
|
}
|
|
76
78
|
serialize() {
|
|
77
79
|
let data = this.removeNodeType || RemoveNodeType.Any;
|
|
@@ -84,10 +86,37 @@ let RemoveNodeFromNetworkRequest = class RemoveNodeFromNetworkRequest extends Me
|
|
|
84
86
|
}
|
|
85
87
|
};
|
|
86
88
|
RemoveNodeFromNetworkRequest = __decorate([
|
|
87
|
-
(0, Message_1.
|
|
88
|
-
// no expected response, the controller will respond with another RemoveNodeFromNetworkRequest
|
|
89
|
-
,
|
|
90
|
-
(0, Message_1.priority)(Constants_1.MessagePriority.Controller)
|
|
89
|
+
(0, Message_1.expectedCallback)(testCallbackForRemoveNodeRequest)
|
|
91
90
|
], RemoveNodeFromNetworkRequest);
|
|
92
91
|
exports.RemoveNodeFromNetworkRequest = RemoveNodeFromNetworkRequest;
|
|
92
|
+
class RemoveNodeFromNetworkRequestStatusReport extends RemoveNodeFromNetworkRequestBase {
|
|
93
|
+
constructor(driver, options) {
|
|
94
|
+
super(driver, options);
|
|
95
|
+
this.callbackId = this.payload[0];
|
|
96
|
+
this.status = this.payload[1];
|
|
97
|
+
switch (this.status) {
|
|
98
|
+
case RemoveNodeStatus.Ready:
|
|
99
|
+
case RemoveNodeStatus.NodeFound:
|
|
100
|
+
case RemoveNodeStatus.Failed:
|
|
101
|
+
case RemoveNodeStatus.Done:
|
|
102
|
+
// no context for the status to parse
|
|
103
|
+
// TODO:
|
|
104
|
+
// An application MUST time out waiting for the REMOVE_NODE_STATUS_REMOVING_SLAVE status
|
|
105
|
+
// if it does not receive the indication within a 14 sec after receiving the
|
|
106
|
+
// REMOVE_NODE_STATUS_NODE_FOUND status.
|
|
107
|
+
break;
|
|
108
|
+
case RemoveNodeStatus.RemovingController:
|
|
109
|
+
case RemoveNodeStatus.RemovingSlave:
|
|
110
|
+
// the payload contains a node information frame
|
|
111
|
+
this.statusContext = (0, core_1.parseNodeUpdatePayload)(this.payload.slice(2));
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
isOK() {
|
|
116
|
+
// Some of the status codes are for unsolicited callbacks, but
|
|
117
|
+
// Failed is the only NOK status.
|
|
118
|
+
return this.status !== RemoveNodeStatus.Failed;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.RemoveNodeFromNetworkRequestStatusReport = RemoveNodeFromNetworkRequestStatusReport;
|
|
93
122
|
//# sourceMappingURL=RemoveNodeFromNetworkRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoveNodeFromNetworkRequest.js","sourceRoot":"","sources":["../../../src/lib/controller/RemoveNodeFromNetworkRequest.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAAwE;AAExE,oDAI8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"RemoveNodeFromNetworkRequest.js","sourceRoot":"","sources":["../../../src/lib/controller/RemoveNodeFromNetworkRequest.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAAwE;AAExE,oDAI8B;AAC9B,gDAS4B;AAG5B,IAAY,cAKX;AALD,WAAY,cAAc;IACzB,iDAAO,CAAA;IACP,+DAAc,CAAA;IACd,qDAAS,CAAA;IACT,mDAAQ,CAAA;AACT,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB;AAED,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAC3B,yDAAS,CAAA;IACT,iEAAa,CAAA;IACb,yEAAiB,CAAA;IACjB,mFAAsB,CAAA;IACtB,uDAAQ,CAAA;IACR,2DAAU,CAAA;AACX,CAAC,EAPW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAO3B;AAED,IAAK,eAGJ;AAHD,WAAK,eAAe;IACnB,iEAAgB,CAAA;IAChB,oEAAkB,CAAA;AACnB,CAAC,EAHI,eAAe,KAAf,eAAe,QAGnB;AAWD,IAAa,gCAAgC,GAA7C,MAAa,gCAAiC,SAAQ,iBAAO;IAC5D,YAAmB,MAAc,EAAE,OAAuB;QACzD,IACC,IAAA,mCAAyB,EAAC,OAAO,CAAC;YACjC,GAAG,CAAC,MAAc,KAAK,wCAAwC,EAC/D;YACD,OAAO,IAAI,wCAAwC,CAClD,MAAM,EACN,OAAO,CACP,CAAC;SACF;QACD,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxB,CAAC;CACD,CAAA;AAbY,gCAAgC;IAH5C,IAAA,sBAAY,EAAC,uBAAW,CAAC,OAAO,EAAE,wBAAY,CAAC,qBAAqB,CAAC;IACtE,gGAAgG;;IAC/F,IAAA,kBAAQ,EAAC,2BAAe,CA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AAC;IAChD,CAAC;CAID;AAtCD,4FAsCC"}
|
|
@@ -64,6 +64,7 @@ export declare type DriverEvents = Extract<keyof DriverEventCallbacks, string>;
|
|
|
64
64
|
*/
|
|
65
65
|
export declare class Driver extends TypedEventEmitter<DriverEventCallbacks> {
|
|
66
66
|
private port;
|
|
67
|
+
constructor(port: string, options?: DeepPartial<ZWaveOptions>);
|
|
67
68
|
/** The serial port instance */
|
|
68
69
|
private serial;
|
|
69
70
|
/** An instance of the Send Thread state machine */
|
|
@@ -90,7 +91,6 @@ export declare class Driver extends TypedEventEmitter<DriverEventCallbacks> {
|
|
|
90
91
|
get controller(): ZWaveController;
|
|
91
92
|
private _securityManager;
|
|
92
93
|
private _securityManager2;
|
|
93
|
-
constructor(port: string, options?: DeepPartial<ZWaveOptions>);
|
|
94
94
|
/** Updates the logging configuration without having to restart the driver. */
|
|
95
95
|
updateLogConfig(config: DeepPartial<LogConfig>): void;
|
|
96
96
|
/** Returns the current logging configuration. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Driver.d.ts","sourceRoot":"","sources":["../../../src/lib/driver/Driver.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAqB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACN,cAAc,
|
|
1
|
+
{"version":3,"file":"Driver.d.ts","sourceRoot":"","sources":["../../../src/lib/driver/Driver.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAqB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACN,cAAc,EAGd,QAAQ,EAGR,SAAS,EAaT,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EACN,WAAW,EAOX,iBAAiB,EACjB,MAAM,kBAAkB,CAAC;AAa1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAQ7B,OAAO,EAEN,YAAY,EAGZ,MAAM,8BAA8B,CAAC;AAiBtC,OAAO,EAIN,iBAAiB,EACjB,iBAAiB,EACjB,MAAM,+BAA+B,C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ACxE,+BAA+B,IACnC,OAAO,wBAAwB,GAC/B,OAAO,8BAA8B;IASjC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM;IAItC;;;OAGG;IACU,qBAAqB,CACjC,MAAM,GAAE,OAAe,GACrB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAwB9B;;;;;OAKG;IACU,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;CA6CpD"}
|
|
@@ -44,7 +44,6 @@ const CommandClass_1 = require("../commandclass/CommandClass");
|
|
|
44
44
|
const DeviceResetLocallyCC_1 = require("../commandclass/DeviceResetLocallyCC");
|
|
45
45
|
const EncapsulatingCommandClass_1 = require("../commandclass/EncapsulatingCommandClass");
|
|
46
46
|
const ICommandClassContainer_1 = require("../commandclass/ICommandClassContainer");
|
|
47
|
-
const ManufacturerSpecificCC_1 = require("../commandclass/ManufacturerSpecificCC");
|
|
48
47
|
const MultiChannelCC_1 = require("../commandclass/MultiChannelCC");
|
|
49
48
|
const NoOperationCC_1 = require("../commandclass/NoOperationCC");
|
|
50
49
|
const shared_2 = require("../commandclass/Security2/shared");
|
|
@@ -57,6 +56,7 @@ const ApplicationUpdateRequest_1 = require("../controller/ApplicationUpdateReque
|
|
|
57
56
|
const BridgeApplicationCommandRequest_1 = require("../controller/BridgeApplicationCommandRequest");
|
|
58
57
|
const Controller_1 = require("../controller/Controller");
|
|
59
58
|
const GetControllerVersionMessages_1 = require("../controller/GetControllerVersionMessages");
|
|
59
|
+
const Inclusion_1 = require("../controller/Inclusion");
|
|
60
60
|
const SendDataBridgeMessages_1 = require("../controller/SendDataBridgeMessages");
|
|
61
61
|
const SendDataMessages_1 = require("../controller/SendDataMessages");
|
|
62
62
|
const SendDataShared_1 = require("../controller/SendDataShared");
|
|
@@ -233,6 +233,7 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
233
233
|
this._controllerLog = new Controller_2.ControllerLogger(this._logContainer);
|
|
234
234
|
// Initialize the cache
|
|
235
235
|
this.cacheDir = this.options.storage.cacheDir;
|
|
236
|
+
// TODO: Load provisioning list
|
|
236
237
|
// Initialize config manager
|
|
237
238
|
this.configManager = new config_1.ConfigManager({
|
|
238
239
|
logContainer: this._logContainer,
|
|
@@ -581,13 +582,9 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
581
582
|
// some 500-series sticks in virtualized environments don't respond after a soft reset
|
|
582
583
|
// No need to initialize databases if skipInterview is true, because it is only used in some
|
|
583
584
|
// Driver unit tests that don't need access to them
|
|
585
|
+
// Identify the controller and determine if it supports soft reset
|
|
584
586
|
await this.controller.identify();
|
|
585
|
-
|
|
586
|
-
await this.initValueDBs(this.controller.homeId);
|
|
587
|
-
// Create the controller node so we can use its value DB
|
|
588
|
-
this.controller.initializeControllerNode();
|
|
589
|
-
// and check if we may do a soft reset
|
|
590
|
-
if (this.options.enableSoftReset && !this.maySoftReset()) {
|
|
587
|
+
if (this.options.enableSoftReset && !(await this.maySoftReset())) {
|
|
591
588
|
this.driverLog.print(`Soft reset is enabled through config, but this stick does not support it.`, "warn");
|
|
592
589
|
this.options.enableSoftReset = false;
|
|
593
590
|
}
|
|
@@ -599,12 +596,27 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
599
596
|
if ((0, core_1.isZWaveError)(e) &&
|
|
600
597
|
e.code === core_1.ZWaveErrorCodes.Driver_Failed) {
|
|
601
598
|
// Remember that soft reset is not supported by this stick
|
|
602
|
-
this.rememberNoSoftReset();
|
|
599
|
+
await this.rememberNoSoftReset();
|
|
603
600
|
// Then fail the driver
|
|
604
601
|
await this.destroy();
|
|
602
|
+
return;
|
|
605
603
|
}
|
|
606
604
|
}
|
|
607
605
|
}
|
|
606
|
+
// There are situations where a controller claims it has the ID 0,
|
|
607
|
+
// which isn't valid. In this case try again after having soft-reset the stick
|
|
608
|
+
if (this.controller.ownNodeId === 0 &&
|
|
609
|
+
this.options.enableSoftReset) {
|
|
610
|
+
this.driverLog.print(`Controller identification returned invalid node ID 0 - trying again...`, "warn");
|
|
611
|
+
await this.controller.identify();
|
|
612
|
+
}
|
|
613
|
+
if (this.controller.ownNodeId === 0) {
|
|
614
|
+
this.driverLog.print(`Controller identification returned invalid node ID 0`, "error");
|
|
615
|
+
await this.destroy();
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
// now that we know the home ID, we can open the databases
|
|
619
|
+
await this.initValueDBs(this.controller.homeId);
|
|
608
620
|
// Interview the controller.
|
|
609
621
|
await this._controller.interview(async () => {
|
|
610
622
|
// Try to restore the network information from the cache
|
|
@@ -612,6 +624,8 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
612
624
|
await this.restoreNetworkStructureFromCache();
|
|
613
625
|
}
|
|
614
626
|
});
|
|
627
|
+
// Auto-enable smart start inclusion
|
|
628
|
+
this._controller.autoProvisionSmartStart();
|
|
615
629
|
}
|
|
616
630
|
// Set up the S0 security manager. We can only do that after the controller
|
|
617
631
|
// interview because we need to know the controller node id.
|
|
@@ -1088,17 +1102,31 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
1088
1102
|
throw new core_1.ZWaveError("Cannot retrieve the version of a CC that is not implemented", core_1.ZWaveErrorCodes.CC_NotSupported);
|
|
1089
1103
|
}
|
|
1090
1104
|
}
|
|
1091
|
-
maySoftReset() {
|
|
1092
|
-
|
|
1093
|
-
const valueDB = controllerNode.valueDB;
|
|
1105
|
+
async maySoftReset() {
|
|
1106
|
+
var _a;
|
|
1094
1107
|
// If we've previously determined a stick not to support soft reset, don't bother trying again
|
|
1095
|
-
|
|
1096
|
-
if (
|
|
1108
|
+
let supportsSoftReset;
|
|
1109
|
+
if (this._controllerInterviewed) {
|
|
1110
|
+
supportsSoftReset = this.controller.supportsSoftReset;
|
|
1111
|
+
}
|
|
1112
|
+
else {
|
|
1113
|
+
// The controller wasn't interviewed yet, read the json file manually
|
|
1114
|
+
const fs = this.options.storage.driver;
|
|
1115
|
+
const cacheFile = path_1.default.join(this.cacheDir, this.controller.homeId.toString(16) + ".json");
|
|
1116
|
+
// Read it if it exists
|
|
1117
|
+
let json;
|
|
1118
|
+
if (await fs.pathExists(cacheFile)) {
|
|
1119
|
+
try {
|
|
1120
|
+
json = JSON.parse(await fs.readFile(cacheFile, "utf8"));
|
|
1121
|
+
}
|
|
1122
|
+
catch { }
|
|
1123
|
+
}
|
|
1124
|
+
supportsSoftReset = (_a = json === null || json === void 0 ? void 0 : json.controller) === null || _a === void 0 ? void 0 : _a.supportsSoftReset;
|
|
1125
|
+
}
|
|
1126
|
+
if (supportsSoftReset === false)
|
|
1097
1127
|
return false;
|
|
1098
1128
|
// Blacklist some sticks that are known to not support soft reset
|
|
1099
|
-
const manufacturerId =
|
|
1100
|
-
const productType = valueDB.getValue((0, ManufacturerSpecificCC_1.getProductTypeValueId)());
|
|
1101
|
-
const productId = valueDB.getValue((0, ManufacturerSpecificCC_1.getProductIdValueId)());
|
|
1129
|
+
const { manufacturerId, productType, productId } = this.controller;
|
|
1102
1130
|
// Z-Wave.me UZB1
|
|
1103
1131
|
if (manufacturerId === 0x0115 &&
|
|
1104
1132
|
productType === 0x0000 &&
|
|
@@ -1113,12 +1141,36 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
1113
1141
|
}
|
|
1114
1142
|
return true;
|
|
1115
1143
|
}
|
|
1116
|
-
rememberNoSoftReset() {
|
|
1144
|
+
async rememberNoSoftReset() {
|
|
1145
|
+
var _a;
|
|
1117
1146
|
this.driverLog.print("Soft reset seems not to be supported by this stick, disabling it.", "warn");
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1147
|
+
this.controller.supportsSoftReset = false;
|
|
1148
|
+
if (this._controllerInterviewed) {
|
|
1149
|
+
// We can use the normal method for this
|
|
1150
|
+
await this.saveNetworkToCacheInternal();
|
|
1151
|
+
}
|
|
1152
|
+
else {
|
|
1153
|
+
// saveNetworkToCache won't write anything, just edit the file "manually"
|
|
1154
|
+
// TODO: This is ugly, rework this when changing how the network data is saved
|
|
1155
|
+
const fs = this.options.storage.driver;
|
|
1156
|
+
await fs.ensureDir(this.cacheDir);
|
|
1157
|
+
const cacheFile = path_1.default.join(this.cacheDir, this.controller.homeId.toString(16) + ".json");
|
|
1158
|
+
// Read it if it exists
|
|
1159
|
+
let json;
|
|
1160
|
+
if (await fs.pathExists(cacheFile)) {
|
|
1161
|
+
try {
|
|
1162
|
+
json = JSON.parse(await fs.readFile(cacheFile, "utf8"));
|
|
1163
|
+
}
|
|
1164
|
+
catch { }
|
|
1165
|
+
}
|
|
1166
|
+
// Change the supportsSoftReset flag
|
|
1167
|
+
json !== null && json !== void 0 ? json : (json = {});
|
|
1168
|
+
(_a = json.controller) !== null && _a !== void 0 ? _a : (json.controller = {});
|
|
1169
|
+
json.controller.supportsSoftReset = false;
|
|
1170
|
+
// And save it again
|
|
1171
|
+
const jsonString = (0, shared_1.stringify)(json);
|
|
1172
|
+
await this.options.storage.driver.writeFile(cacheFile, jsonString, "utf8");
|
|
1173
|
+
}
|
|
1122
1174
|
}
|
|
1123
1175
|
/**
|
|
1124
1176
|
* Soft-resets the controller if the feature is enabled
|
|
@@ -1272,12 +1324,27 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
1272
1324
|
* Must be called under any circumstances.
|
|
1273
1325
|
*/
|
|
1274
1326
|
async destroy() {
|
|
1275
|
-
var _a, _b, _c;
|
|
1327
|
+
var _a, _b, _c, _d;
|
|
1276
1328
|
// Ensure this is only called once and all subsequent calls block
|
|
1277
1329
|
if (this._destroyPromise)
|
|
1278
1330
|
return this._destroyPromise;
|
|
1279
1331
|
this._destroyPromise = (0, deferred_promise_1.createDeferredPromise)();
|
|
1280
1332
|
this.driverLog.print("destroying driver instance...");
|
|
1333
|
+
// Disable inclusion before shutting down
|
|
1334
|
+
try {
|
|
1335
|
+
switch ((_a = this._controller) === null || _a === void 0 ? void 0 : _a.inclusionState) {
|
|
1336
|
+
case Inclusion_1.InclusionState.SmartStart:
|
|
1337
|
+
case Inclusion_1.InclusionState.Including:
|
|
1338
|
+
await this._controller.stopInclusionNoCallback();
|
|
1339
|
+
break;
|
|
1340
|
+
case Inclusion_1.InclusionState.Excluding:
|
|
1341
|
+
await this._controller.stopExclusionNoCallback();
|
|
1342
|
+
break;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
catch {
|
|
1346
|
+
// ignore
|
|
1347
|
+
}
|
|
1281
1348
|
// First stop the send thread machine and close the serial port, so nothing happens anymore
|
|
1282
1349
|
if (this.sendThread.initialized)
|
|
1283
1350
|
this.sendThread.stop();
|
|
@@ -1297,8 +1364,8 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
1297
1364
|
}
|
|
1298
1365
|
try {
|
|
1299
1366
|
// Attempt to close the value DBs
|
|
1300
|
-
await ((
|
|
1301
|
-
await ((
|
|
1367
|
+
await ((_b = this._valueDB) === null || _b === void 0 ? void 0 : _b.close());
|
|
1368
|
+
await ((_c = this._metadataDB) === null || _c === void 0 ? void 0 : _c.close());
|
|
1302
1369
|
}
|
|
1303
1370
|
catch (e) {
|
|
1304
1371
|
this.driverLog.print(`Closing the value DBs failed: ${(0, shared_1.getErrorMessage)(e)}`, "error");
|
|
@@ -1314,7 +1381,7 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
1314
1381
|
clearTimeout(timeout);
|
|
1315
1382
|
}
|
|
1316
1383
|
// Destroy all nodes
|
|
1317
|
-
(
|
|
1384
|
+
(_d = this._controller) === null || _d === void 0 ? void 0 : _d.nodes.forEach((n) => n.destroy());
|
|
1318
1385
|
process.removeListener("exit", this._cleanupHandler);
|
|
1319
1386
|
process.removeListener("SIGINT", this._cleanupHandler);
|
|
1320
1387
|
process.removeListener("uncaughtException", this._cleanupHandler);
|
|
@@ -1527,7 +1594,7 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
1527
1594
|
throw e;
|
|
1528
1595
|
}
|
|
1529
1596
|
async handleSecurityS2DecodeError(e, msg) {
|
|
1530
|
-
var _a;
|
|
1597
|
+
var _a, _b;
|
|
1531
1598
|
if (!(0, core_1.isZWaveError)(e))
|
|
1532
1599
|
return false;
|
|
1533
1600
|
if ((e.code === core_1.ZWaveErrorCodes.Security2CC_NoSPAN ||
|
|
@@ -1559,13 +1626,42 @@ class Driver extends shared_1.TypedEventEmitter {
|
|
|
1559
1626
|
? "Message authentication failed"
|
|
1560
1627
|
: "No SPAN is established yet";
|
|
1561
1628
|
if (this.controller.bootstrappingS2NodeId === nodeId) {
|
|
1562
|
-
// The node is currently being bootstrapped.
|
|
1563
|
-
this.
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1629
|
+
// The node is currently being bootstrapped.
|
|
1630
|
+
if ((_b = this.securityManager2) === null || _b === void 0 ? void 0 : _b.tempKeys.has(nodeId)) {
|
|
1631
|
+
// The DSK has been verified, so we should be able to decode this command.
|
|
1632
|
+
// If this is the first attempt, we need to request a nonce first
|
|
1633
|
+
if (this.securityManager2.getSPANState(nodeId).type ===
|
|
1634
|
+
core_1.SPANState.None) {
|
|
1635
|
+
this.controllerLog.logNode(nodeId, {
|
|
1636
|
+
message: `${message}, cannot decode command. Requesting a nonce...`,
|
|
1637
|
+
level: "verbose",
|
|
1638
|
+
direction: "outbound",
|
|
1639
|
+
});
|
|
1640
|
+
// Send the node our nonce
|
|
1641
|
+
node.commandClasses["Security 2"]
|
|
1642
|
+
.sendNonce()
|
|
1643
|
+
.catch(() => {
|
|
1644
|
+
// Ignore errors
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
else {
|
|
1648
|
+
// Us repeatedly not being able to decode the command means we need to abort the bootstrapping process
|
|
1649
|
+
// because the PIN is wrong
|
|
1650
|
+
this.controllerLog.logNode(nodeId, {
|
|
1651
|
+
message: `${message}, cannot decode command. Aborting the S2 bootstrapping process...`,
|
|
1652
|
+
level: "error",
|
|
1653
|
+
direction: "inbound",
|
|
1654
|
+
});
|
|
1655
|
+
this.controller.cancelSecureBootstrapS2(shared_2.KEXFailType.BootstrappingCanceled);
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
else {
|
|
1659
|
+
this.controllerLog.logNode(nodeId, {
|
|
1660
|
+
message: `Ignoring KEXSet because the DSK has not been verified yet`,
|
|
1661
|
+
level: "verbose",
|
|
1662
|
+
direction: "inbound",
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1569
1665
|
}
|
|
1570
1666
|
else if (!this.hasPendingTransactions(isS2NonceReport)) {
|
|
1571
1667
|
this.controllerLog.logNode(nodeId, {
|
|
@@ -2065,6 +2161,31 @@ ${handlers.length} left`);
|
|
|
2065
2161
|
return;
|
|
2066
2162
|
}
|
|
2067
2163
|
}
|
|
2164
|
+
else if (msg instanceof ApplicationUpdateRequest_1.ApplicationUpdateRequestSmartStartHomeIDReceived) {
|
|
2165
|
+
// the controller is in Smart Start learn mode and a node requests inclusion via Smart Start
|
|
2166
|
+
this.controllerLog.print("Received Smart Start inclusion request");
|
|
2167
|
+
if (this.controller.inclusionState !== Inclusion_1.InclusionState.Idle &&
|
|
2168
|
+
this.controller.inclusionState !== Inclusion_1.InclusionState.SmartStart) {
|
|
2169
|
+
this.controllerLog.print("Controller is busy and cannot handle this inclusion request right now...");
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
2172
|
+
// Check if the node is on the provisioning list
|
|
2173
|
+
const provisioningEntry = this.controller.provisioningList.find((entry) => (0, core_1.nwiHomeIdFromDSK)((0, core_1.dskFromString)(entry.dsk)).equals(msg.nwiHomeId));
|
|
2174
|
+
if (!provisioningEntry) {
|
|
2175
|
+
this.controllerLog.print("NWI Home ID not found in provisioning list, ignoring request...");
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
this.controllerLog.print("NWI Home ID found in provisioning list, including node...");
|
|
2179
|
+
try {
|
|
2180
|
+
const result = await this.controller.beginInclusionSmartStart(provisioningEntry);
|
|
2181
|
+
if (!result) {
|
|
2182
|
+
this.controllerLog.print("Smart Start inclusion could not be started", "error");
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
catch (e) {
|
|
2186
|
+
this.controllerLog.print(`Smart Start inclusion could not be started: ${(0, shared_1.getErrorMessage)(e)}`, "error");
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2068
2189
|
}
|
|
2069
2190
|
else {
|
|
2070
2191
|
// Check if we have a dynamic handler waiting for this message
|