zwave-js 15.25.1 → 15.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/lib/_version.d.ts +1 -1
- package/build/cjs/lib/_version.js +1 -1
- package/build/cjs/lib/_version.js.map +1 -1
- package/build/cjs/lib/controller/Controller.d.ts +3 -0
- package/build/cjs/lib/controller/Controller.js +258 -170
- package/build/cjs/lib/controller/Controller.js.map +2 -2
- package/build/cjs/lib/controller/FirmwareUpdateService.js +24 -17
- package/build/cjs/lib/controller/FirmwareUpdateService.js.map +2 -2
- package/build/cjs/lib/controller/ZWaveSDKVersions.js +1 -1
- package/build/cjs/lib/controller/ZWaveSDKVersions.js.map +2 -2
- package/build/cjs/lib/driver/Driver.d.ts +16 -5
- package/build/cjs/lib/driver/Driver.js +96 -116
- package/build/cjs/lib/driver/Driver.js.map +2 -2
- package/build/cjs/lib/driver/MessageGenerators.js +20 -1
- package/build/cjs/lib/driver/MessageGenerators.js.map +2 -2
- package/build/cjs/lib/driver/Task.d.ts +13 -0
- package/build/cjs/lib/driver/Task.js.map +2 -2
- package/build/cjs/lib/log/Driver.d.ts +2 -2
- package/build/cjs/lib/log/Driver.js +17 -26
- package/build/cjs/lib/log/Driver.js.map +2 -2
- package/build/cjs/lib/log/Zniffer.d.ts +2 -2
- package/build/cjs/lib/log/Zniffer.js +21 -29
- package/build/cjs/lib/log/Zniffer.js.map +2 -2
- package/build/cjs/lib/node/MockNodeBehaviors.js +0 -3
- package/build/cjs/lib/node/MockNodeBehaviors.js.map +2 -2
- package/build/cjs/lib/node/Node.d.ts +3 -1
- package/build/cjs/lib/node/Node.js +319 -165
- package/build/cjs/lib/node/Node.js.map +2 -2
- package/build/cjs/lib/node/feature-apis/AccessControl.js +82 -21
- package/build/cjs/lib/node/feature-apis/AccessControl.js.map +2 -2
- package/build/cjs/lib/node/mixins/40_Values.d.ts +1 -1
- package/build/cjs/lib/node/mixins/40_Values.js.map +2 -2
- package/build/cjs/lib/test/assertCC.d.ts +2 -2
- package/build/cjs/lib/test/assertCC.js.map +2 -2
- package/build/cjs/lib/test/integrationTestSuite.d.ts +8 -1
- package/build/cjs/lib/test/integrationTestSuite.js +20 -6
- package/build/cjs/lib/test/integrationTestSuite.js.map +2 -2
- package/build/cjs/lib/test/integrationTestSuiteMulti.d.ts +9 -3
- package/build/cjs/lib/test/integrationTestSuiteMulti.js +19 -5
- package/build/cjs/lib/test/integrationTestSuiteMulti.js.map +2 -2
- package/build/cjs/lib/zniffer/MPDU.js +17 -30
- package/build/cjs/lib/zniffer/MPDU.js.map +2 -2
- package/build/esm/lib/_version.d.ts +1 -1
- package/build/esm/lib/_version.js +1 -1
- package/build/esm/lib/controller/Controller.d.ts +3 -0
- package/build/esm/lib/controller/Controller.d.ts.map +1 -1
- package/build/esm/lib/controller/Controller.js +331 -230
- package/build/esm/lib/controller/Controller.js.map +1 -1
- package/build/esm/lib/controller/FirmwareUpdateService.d.ts.map +1 -1
- package/build/esm/lib/controller/FirmwareUpdateService.js +32 -22
- package/build/esm/lib/controller/FirmwareUpdateService.js.map +1 -1
- package/build/esm/lib/controller/ZWaveSDKVersions.js +1 -1
- package/build/esm/lib/controller/ZWaveSDKVersions.js.map +1 -1
- package/build/esm/lib/driver/Driver.d.ts +16 -5
- package/build/esm/lib/driver/Driver.d.ts.map +1 -1
- package/build/esm/lib/driver/Driver.js +136 -156
- package/build/esm/lib/driver/Driver.js.map +1 -1
- package/build/esm/lib/driver/MessageGenerators.d.ts.map +1 -1
- package/build/esm/lib/driver/MessageGenerators.js +28 -4
- package/build/esm/lib/driver/MessageGenerators.js.map +1 -1
- package/build/esm/lib/driver/Task.d.ts +13 -0
- package/build/esm/lib/driver/Task.d.ts.map +1 -1
- package/build/esm/lib/driver/Task.js.map +1 -1
- package/build/esm/lib/log/Driver.d.ts +2 -2
- package/build/esm/lib/log/Driver.d.ts.map +1 -1
- package/build/esm/lib/log/Driver.js +22 -33
- package/build/esm/lib/log/Driver.js.map +1 -1
- package/build/esm/lib/log/Zniffer.d.ts +2 -2
- package/build/esm/lib/log/Zniffer.d.ts.map +1 -1
- package/build/esm/lib/log/Zniffer.js +26 -35
- package/build/esm/lib/log/Zniffer.js.map +1 -1
- package/build/esm/lib/node/MockNodeBehaviors.d.ts.map +1 -1
- package/build/esm/lib/node/MockNodeBehaviors.js +0 -4
- package/build/esm/lib/node/MockNodeBehaviors.js.map +1 -1
- package/build/esm/lib/node/Node.d.ts +3 -1
- package/build/esm/lib/node/Node.d.ts.map +1 -1
- package/build/esm/lib/node/Node.js +413 -212
- package/build/esm/lib/node/Node.js.map +1 -1
- package/build/esm/lib/node/feature-apis/AccessControl.d.ts.map +1 -1
- package/build/esm/lib/node/feature-apis/AccessControl.js +129 -30
- package/build/esm/lib/node/feature-apis/AccessControl.js.map +1 -1
- package/build/esm/lib/node/mixins/40_Values.d.ts +1 -1
- package/build/esm/lib/node/mixins/40_Values.d.ts.map +1 -1
- package/build/esm/lib/node/mixins/40_Values.js.map +1 -1
- package/build/esm/lib/test/assertCC.d.ts +2 -2
- package/build/esm/lib/test/assertCC.d.ts.map +1 -1
- package/build/esm/lib/test/assertCC.js.map +1 -1
- package/build/esm/lib/test/integrationTestSuite.d.ts +8 -1
- package/build/esm/lib/test/integrationTestSuite.d.ts.map +1 -1
- package/build/esm/lib/test/integrationTestSuite.js +26 -10
- package/build/esm/lib/test/integrationTestSuite.js.map +1 -1
- package/build/esm/lib/test/integrationTestSuiteMulti.d.ts +9 -3
- package/build/esm/lib/test/integrationTestSuiteMulti.d.ts.map +1 -1
- package/build/esm/lib/test/integrationTestSuiteMulti.js +25 -9
- package/build/esm/lib/test/integrationTestSuiteMulti.js.map +1 -1
- package/build/esm/lib/zniffer/MPDU.d.ts.map +1 -1
- package/build/esm/lib/zniffer/MPDU.js +17 -30
- package/build/esm/lib/zniffer/MPDU.js.map +1 -1
- package/package.json +10 -10
|
@@ -22,7 +22,7 @@ __export(version_exports, {
|
|
|
22
22
|
PACKAGE_VERSION: () => PACKAGE_VERSION
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(version_exports);
|
|
25
|
-
const PACKAGE_VERSION = "15.25.
|
|
25
|
+
const PACKAGE_VERSION = "15.25.3";
|
|
26
26
|
const PACKAGE_NAME = "zwave-js";
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/_version.ts"],
|
|
4
|
-
"sourcesContent": ["// This file is auto-generated by the codegen maintenance script\nexport const PACKAGE_VERSION = \"15.25.
|
|
4
|
+
"sourcesContent": ["// This file is auto-generated by the codegen maintenance script\nexport const PACKAGE_VERSION = \"15.25.3\";\nexport const PACKAGE_NAME = \"zwave-js\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;AACO,MAAM,kBAAkB;AACxB,MAAM,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -735,6 +735,7 @@ export declare class ZWaveController extends TypedEventTarget<ControllerEventCal
|
|
|
735
735
|
* @returns The raw NVM buffer
|
|
736
736
|
*/
|
|
737
737
|
backupNVMRaw(onProgress?: (bytesRead: number, total: number) => void): Promise<BytesView>;
|
|
738
|
+
private getBackupNVMRawTask;
|
|
738
739
|
private backupNVMRaw500;
|
|
739
740
|
private backupNVMRaw700;
|
|
740
741
|
/**
|
|
@@ -751,6 +752,7 @@ export declare class ZWaveController extends TypedEventTarget<ControllerEventCal
|
|
|
751
752
|
* @param migrateOptions Influence which data should be preserved during a migration
|
|
752
753
|
*/
|
|
753
754
|
restoreNVM(nvmData: BytesView, convertProgress?: (bytesRead: number, total: number) => void, restoreProgress?: (bytesWritten: number, total: number) => void, migrateOptions?: MigrateNVMOptions): Promise<void>;
|
|
755
|
+
private getRestoreNVMTask;
|
|
754
756
|
/**
|
|
755
757
|
* Restores an NVM backup that was created with `backupNVMRaw`. The Z-Wave radio is turned off/on automatically.
|
|
756
758
|
*
|
|
@@ -761,6 +763,7 @@ export declare class ZWaveController extends TypedEventTarget<ControllerEventCal
|
|
|
761
763
|
* @param onProgress Can be used to monitor the progress of the operation, which may take several seconds up to a few minutes depending on the NVM size
|
|
762
764
|
*/
|
|
763
765
|
restoreNVMRaw(nvmData: BytesView, onProgress?: (bytesWritten: number, total: number) => void): Promise<void>;
|
|
766
|
+
private getRestoreNVMRawTask;
|
|
764
767
|
private restoreNVMRaw500;
|
|
765
768
|
private restoreNVMRaw700;
|
|
766
769
|
/**
|
|
@@ -567,13 +567,15 @@ let ZWaveController = (() => {
|
|
|
567
567
|
this._productType = apiCaps.productType;
|
|
568
568
|
this._productId = apiCaps.productId;
|
|
569
569
|
this._supportedFunctionTypes = apiCaps.supportedFunctionTypes;
|
|
570
|
-
this.driver.controllerLog.print(
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
570
|
+
this.driver.controllerLog.print((0, import_core.logText)("received API capabilities:", {
|
|
571
|
+
nested: (0, import_core.logDict)({
|
|
572
|
+
"firmware version": this._firmwareVersion,
|
|
573
|
+
"manufacturer ID": (0, import_shared.num2hex)(this._manufacturerId),
|
|
574
|
+
"product type": (0, import_shared.num2hex)(this._productType),
|
|
575
|
+
"product ID": (0, import_shared.num2hex)(this._productId),
|
|
576
|
+
"supported functions": (0, import_core.logList)(this._supportedFunctionTypes.map((fn) => `${import_serial.FunctionType[fn]} (${(0, import_shared.num2hex)(fn)})`))
|
|
577
|
+
})
|
|
578
|
+
}));
|
|
577
579
|
const initData = await this.getSerialApiInitData();
|
|
578
580
|
this.driver.controllerLog.print(`querying version info...`);
|
|
579
581
|
const version = await this.driver.sendMessage(new import_serialapi.GetControllerVersionRequest(), {
|
|
@@ -581,25 +583,24 @@ let ZWaveController = (() => {
|
|
|
581
583
|
});
|
|
582
584
|
this._protocolVersion = version.libraryVersion;
|
|
583
585
|
this._type = version.controllerType;
|
|
584
|
-
this.driver.controllerLog.print(
|
|
585
|
-
|
|
586
|
-
|
|
586
|
+
this.driver.controllerLog.print((0, import_core.logText)("received version info:", {
|
|
587
|
+
nested: (0, import_core.logDict)({
|
|
588
|
+
"controller type": (0, import_shared.getEnumMemberName)(import_core.ZWaveLibraryTypes, this._type),
|
|
589
|
+
"library version": this._protocolVersion
|
|
590
|
+
})
|
|
591
|
+
}));
|
|
587
592
|
if (this.isFunctionSupported(import_serial.FunctionType.GetProtocolVersion)) {
|
|
588
593
|
this.driver.controllerLog.print(`querying protocol version info...`);
|
|
589
594
|
const protocol = await this.driver.sendMessage(new import_serialapi.GetProtocolVersionRequest());
|
|
590
595
|
this._protocolVersion = protocol.protocolVersion;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
message += `
|
|
600
|
-
git commit hash: ${protocol.gitCommitHash}`;
|
|
601
|
-
}
|
|
602
|
-
this.driver.controllerLog.print(message);
|
|
596
|
+
this.driver.controllerLog.print((0, import_core.logText)("received protocol version info:", {
|
|
597
|
+
nested: (0, import_core.logDict)({
|
|
598
|
+
"protocol type": (0, import_shared.getEnumMemberName)(import_core.ProtocolType, protocol.protocolType),
|
|
599
|
+
"protocol version": protocol.protocolVersion,
|
|
600
|
+
"appl. framework build no.": protocol.applicationFrameworkBuildNumber || void 0,
|
|
601
|
+
"git commit hash": protocol.gitCommitHash || void 0
|
|
602
|
+
})
|
|
603
|
+
}));
|
|
603
604
|
}
|
|
604
605
|
this._sdkVersion = (0, import_ZWaveSDKVersions.protocolVersionToSDKVersion)(this._protocolVersion);
|
|
605
606
|
await this.getControllerCapabilities();
|
|
@@ -607,8 +608,9 @@ let ZWaveController = (() => {
|
|
|
607
608
|
this.driver.controllerLog.print(`querying serial API setup capabilities...`);
|
|
608
609
|
const setupCaps = await this.driver.sendMessage(new import_serialapi.SerialAPISetup_GetSupportedCommandsRequest());
|
|
609
610
|
this._supportedSerialAPISetupCommands = setupCaps.supportedCommands;
|
|
610
|
-
this.driver.controllerLog.print(
|
|
611
|
-
|
|
611
|
+
this.driver.controllerLog.print((0, import_core.logText)("supported serial API setup commands:", {
|
|
612
|
+
nested: (0, import_core.logList)(this._supportedSerialAPISetupCommands.map((cmd) => (0, import_shared.getEnumMemberName)(import_serialapi.SerialAPISetupCommand, cmd)))
|
|
613
|
+
}));
|
|
612
614
|
} else {
|
|
613
615
|
this._supportedSerialAPISetupCommands = [];
|
|
614
616
|
}
|
|
@@ -621,8 +623,9 @@ let ZWaveController = (() => {
|
|
|
621
623
|
this._supportsLongRange = false;
|
|
622
624
|
this._supportsLongRangeAutoChannelSelection = false;
|
|
623
625
|
}
|
|
624
|
-
this.driver.controllerLog.print(
|
|
625
|
-
|
|
626
|
+
this.driver.controllerLog.print((0, import_core.logText)("supported Z-Wave features:", {
|
|
627
|
+
nested: (0, import_core.logList)(Object.keys(import_Features.ZWaveFeature).filter((k) => /^\d+$/.test(k)).map((k) => parseInt(k)).filter((feat) => this.supportsFeature(feat)).map((feat) => (0, import_shared.getEnumMemberName)(import_Features.ZWaveFeature, feat)))
|
|
628
|
+
}));
|
|
626
629
|
return {
|
|
627
630
|
nodeIds: initData.nodeIds
|
|
628
631
|
};
|
|
@@ -638,9 +641,12 @@ let ZWaveController = (() => {
|
|
|
638
641
|
if (this.isSerialAPISetupCommandSupported(import_serialapi.SerialAPISetupCommand.GetLongRangeMaximumPayloadSize)) {
|
|
639
642
|
this._maxPayloadSizeLR = await this.getMaxPayloadSizeLongRange();
|
|
640
643
|
}
|
|
641
|
-
this.driver.controllerLog.print(
|
|
642
|
-
|
|
643
|
-
|
|
644
|
+
this.driver.controllerLog.print((0, import_core.logText)("received Z-Wave Long Range capabilities:", {
|
|
645
|
+
nested: (0, import_core.logDict)({
|
|
646
|
+
"max. payload size": `${this._maxPayloadSizeLR} bytes`,
|
|
647
|
+
nodes: lrNodeIds.join(", ")
|
|
648
|
+
})
|
|
649
|
+
}));
|
|
644
650
|
return {
|
|
645
651
|
lrNodeIds
|
|
646
652
|
};
|
|
@@ -694,20 +700,21 @@ let ZWaveController = (() => {
|
|
|
694
700
|
continue;
|
|
695
701
|
}
|
|
696
702
|
}
|
|
697
|
-
this.driver.controllerLog.print(
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}
|
|
703
|
-
if (info.supportsLongRange) {
|
|
704
|
-
ret += " \xB7 ZWLR";
|
|
705
|
-
if (!info.supportsZWave) {
|
|
706
|
-
ret += " only";
|
|
703
|
+
this.driver.controllerLog.print((0, import_core.logText)("supported regions:", {
|
|
704
|
+
nested: (0, import_core.logList)([...this._supportedRegions.values()].map((info) => {
|
|
705
|
+
let ret = (0, import_shared.getEnumMemberName)(import_core.RFRegion, info.region);
|
|
706
|
+
if (info.includesRegion != void 0) {
|
|
707
|
+
ret += ` \xB7 superset of ${(0, import_shared.getEnumMemberName)(import_core.RFRegion, info.includesRegion)}`;
|
|
707
708
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
709
|
+
if (info.supportsLongRange) {
|
|
710
|
+
ret += " \xB7 ZWLR";
|
|
711
|
+
if (!info.supportsZWave) {
|
|
712
|
+
ret += " only";
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
return ret;
|
|
716
|
+
}))
|
|
717
|
+
}));
|
|
711
718
|
}
|
|
712
719
|
if (this.isSerialAPISetupCommandSupported(import_serialapi.SerialAPISetupCommand.GetRFRegion)) {
|
|
713
720
|
this.driver.controllerLog.print(`Querying configured RF region...`);
|
|
@@ -794,10 +801,12 @@ let ZWaveController = (() => {
|
|
|
794
801
|
this.driver.controllerLog.print(`Querying configured Long Range channel information...`);
|
|
795
802
|
const resp = await this.getLongRangeChannel().catch(() => void 0);
|
|
796
803
|
if (resp != void 0) {
|
|
797
|
-
this.driver.controllerLog.print(
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
804
|
+
this.driver.controllerLog.print((0, import_core.logText)("received Z-Wave Long Range channel information:", {
|
|
805
|
+
nested: (0, import_core.logDict)({
|
|
806
|
+
channel: resp.channel != void 0 ? (0, import_shared.getEnumMemberName)(import_core.LongRangeChannel, resp.channel) : "(unknown)",
|
|
807
|
+
"supports auto channel selection": resp.supportsAutoChannelSelection
|
|
808
|
+
})
|
|
809
|
+
}));
|
|
801
810
|
} else {
|
|
802
811
|
this.driver.controllerLog.print(`Querying the Long Range channel information failed!`, "warn");
|
|
803
812
|
}
|
|
@@ -828,9 +837,12 @@ let ZWaveController = (() => {
|
|
|
828
837
|
const ids = await this.driver.sendMessage(new import_serialapi.GetControllerIdRequest(), { supportCheck: false });
|
|
829
838
|
this._homeId = ids.homeId;
|
|
830
839
|
this._ownNodeId = ids.ownNodeId;
|
|
831
|
-
this.driver.controllerLog.print(
|
|
832
|
-
|
|
833
|
-
|
|
840
|
+
this.driver.controllerLog.print((0, import_core.logText)("received controller IDs:", {
|
|
841
|
+
nested: (0, import_core.logDict)({
|
|
842
|
+
"home ID": (0, import_shared.num2hex)(this._homeId),
|
|
843
|
+
"own node ID": this._ownNodeId
|
|
844
|
+
})
|
|
845
|
+
}));
|
|
834
846
|
}
|
|
835
847
|
/**
|
|
836
848
|
* @internal
|
|
@@ -1303,14 +1315,15 @@ let ZWaveController = (() => {
|
|
|
1303
1315
|
supportedCCs,
|
|
1304
1316
|
controlledCCs
|
|
1305
1317
|
});
|
|
1306
|
-
this.driver.controllerLog.print(`finished adding node ${newNode.id}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1318
|
+
this.driver.controllerLog.print((0, import_core.logText)(`finished adding node ${newNode.id}:`, {
|
|
1319
|
+
nested: (0, import_core.logDict)({
|
|
1320
|
+
"basic device class": newNode.deviceClass ? (0, import_shared.getEnumMemberName)(import_core.BasicDeviceClass, newNode.deviceClass.basic) : void 0,
|
|
1321
|
+
"generic device class": newNode.deviceClass?.generic.label,
|
|
1322
|
+
"specific device class": newNode.deviceClass?.specific.label,
|
|
1323
|
+
"supported CCs": (0, import_core.logList)(supportedCCs.map((cc) => `${import_core.CommandClasses[cc]} (${(0, import_shared.num2hex)(cc)})`)),
|
|
1324
|
+
"controlled CCs": (0, import_core.logList)(controlledCCs.map((cc) => `${import_core.CommandClasses[cc]} (${(0, import_shared.num2hex)(cc)})`))
|
|
1325
|
+
})
|
|
1326
|
+
}));
|
|
1314
1327
|
this._nodes.set(newNode.id, newNode);
|
|
1315
1328
|
newNode.markAsAlive();
|
|
1316
1329
|
if (newNode.protocol == import_core.Protocols.ZWave) {
|
|
@@ -1952,8 +1965,9 @@ let ZWaveController = (() => {
|
|
|
1952
1965
|
const securityManager = isLongRange ? this.driver.securityManagerLR : this.driver.securityManager2;
|
|
1953
1966
|
const missingKeys = provisioningEntry.securityClasses.filter((sc) => !securityManager?.hasKeysForSecurityClass(sc));
|
|
1954
1967
|
if (missingKeys.length > 0) {
|
|
1955
|
-
this.driver.controllerLog.print(
|
|
1956
|
-
|
|
1968
|
+
this.driver.controllerLog.print((0, import_core.logText)("Ignoring inclusion request because the following security classes were granted but have no key configured:", {
|
|
1969
|
+
nested: (0, import_core.logList)(missingKeys.map((sc) => `${(0, import_shared.getEnumMemberName)(import_core.SecurityClass, sc)}${isLongRange ? " (Long Range)" : ""}`))
|
|
1970
|
+
}), "error");
|
|
1957
1971
|
return;
|
|
1958
1972
|
}
|
|
1959
1973
|
this.driver.controllerLog.print("NWI Home ID found in provisioning list, including node...");
|
|
@@ -1998,12 +2012,14 @@ let ZWaveController = (() => {
|
|
|
1998
2012
|
deviceClass,
|
|
1999
2013
|
supportedCCs: nodeInfo.supportedCCs
|
|
2000
2014
|
});
|
|
2001
|
-
this.driver.controllerLog.print(`Node ${newNode.id} was included by another controller
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2015
|
+
this.driver.controllerLog.print((0, import_core.logText)(`Node ${newNode.id} was included by another controller:`, {
|
|
2016
|
+
nested: (0, import_core.logDict)({
|
|
2017
|
+
"basic device class": newNode.deviceClass ? (0, import_shared.getEnumMemberName)(import_core.BasicDeviceClass, newNode.deviceClass.basic) : void 0,
|
|
2018
|
+
"generic device class": newNode.deviceClass?.generic.label,
|
|
2019
|
+
"specific device class": newNode.deviceClass?.specific.label,
|
|
2020
|
+
"supported CCs": (0, import_core.logList)(nodeInfo.supportedCCs.map((cc) => `${import_core.CommandClasses[cc]} (${(0, import_shared.num2hex)(cc)})`))
|
|
2021
|
+
})
|
|
2022
|
+
}));
|
|
2007
2023
|
await this.updateProxyInclusionMachine({
|
|
2008
2024
|
value: "NIF",
|
|
2009
2025
|
nodeInfo,
|
|
@@ -2550,10 +2566,9 @@ let ZWaveController = (() => {
|
|
|
2550
2566
|
}
|
|
2551
2567
|
node.dsk = nodePublicKey.subarray(0, 16);
|
|
2552
2568
|
this.driver.controllerLog.logNode(node.id, {
|
|
2553
|
-
message:
|
|
2554
|
-
...node.securityClasses.entries()
|
|
2555
|
-
|
|
2556
|
-
\xB7 ${(0, import_shared.getEnumMemberName)(import_core.SecurityClass, k)}`).join("")}`
|
|
2569
|
+
message: (0, import_core.logText)("Security S2 bootstrapping successful with these security classes:", {
|
|
2570
|
+
nested: (0, import_core.logList)([...node.securityClasses.entries()].filter(([, v]) => v).map(([k]) => (0, import_shared.getEnumMemberName)(import_core.SecurityClass, k)))
|
|
2571
|
+
})
|
|
2557
2572
|
});
|
|
2558
2573
|
} catch (e) {
|
|
2559
2574
|
let errorMessage = `Security S2 bootstrapping failed, the node was not granted any S2 security class`;
|
|
@@ -4223,14 +4238,17 @@ let ZWaveController = (() => {
|
|
|
4223
4238
|
async getSerialApiInitData() {
|
|
4224
4239
|
this.driver.controllerLog.print(`querying additional controller information...`);
|
|
4225
4240
|
const initData = await this.driver.sendMessage(new import_serialapi.GetSerialApiInitDataRequest());
|
|
4226
|
-
this.driver.controllerLog.print(
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4241
|
+
this.driver.controllerLog.print((0, import_core.logText)("received additional controller information:", {
|
|
4242
|
+
nested: (0, import_core.logDict)({
|
|
4243
|
+
"Z-Wave API version": `${initData.zwaveApiVersion.version} (${initData.zwaveApiVersion.kind})`,
|
|
4244
|
+
"Z-Wave chip type": initData.zwaveChipType ? typeof initData.zwaveChipType === "string" ? initData.zwaveChipType : `unknown (type: ${(0, import_shared.num2hex)(initData.zwaveChipType.type)}, version: ${(0, import_shared.num2hex)(initData.zwaveChipType.version)})` : void 0,
|
|
4245
|
+
"node type": (0, import_shared.getEnumMemberName)(import_core.NodeType, initData.nodeType),
|
|
4246
|
+
"controller role": initData.isPrimary ? "primary" : "secondary",
|
|
4247
|
+
"controller is the SIS": initData.isSIS,
|
|
4248
|
+
"controller supports timers": initData.supportsTimers,
|
|
4249
|
+
"Z-Wave Classic nodes": initData.nodeIds.join(", ")
|
|
4250
|
+
})
|
|
4251
|
+
}));
|
|
4234
4252
|
const ret = {
|
|
4235
4253
|
...(0, import_shared.pick)(initData, [
|
|
4236
4254
|
"zwaveApiVersion",
|
|
@@ -4269,12 +4287,15 @@ let ZWaveController = (() => {
|
|
|
4269
4287
|
this._wasRealPrimary = ret.wasRealPrimary;
|
|
4270
4288
|
this._isSUC = ret.isSUC;
|
|
4271
4289
|
this._noNodesIncluded = ret.noNodesIncluded;
|
|
4272
|
-
this.driver.controllerLog.print(
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4290
|
+
this.driver.controllerLog.print((0, import_core.logText)("received controller capabilities:", {
|
|
4291
|
+
nested: (0, import_core.logDict)({
|
|
4292
|
+
"controller role": (0, import_shared.getEnumMemberName)(import_core.ControllerRole, this.role),
|
|
4293
|
+
"is the SUC": ret.isSUC,
|
|
4294
|
+
"started this network": !ret.isUsingHomeIdFromOtherNetwork,
|
|
4295
|
+
"SIS is present": ret.isSISPresent,
|
|
4296
|
+
"was real primary": ret.wasRealPrimary
|
|
4297
|
+
})
|
|
4298
|
+
}));
|
|
4278
4299
|
return ret;
|
|
4279
4300
|
}
|
|
4280
4301
|
/**
|
|
@@ -4620,25 +4641,45 @@ let ZWaveController = (() => {
|
|
|
4620
4641
|
* @param onProgress Can be used to monitor the progress of the operation, which may take several seconds up to a few minutes depending on the NVM size
|
|
4621
4642
|
* @returns The raw NVM buffer
|
|
4622
4643
|
*/
|
|
4623
|
-
|
|
4624
|
-
this.driver.
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4644
|
+
backupNVMRaw(onProgress) {
|
|
4645
|
+
return this.driver.scheduler.queueTask(this.getBackupNVMRawTask(onProgress));
|
|
4646
|
+
}
|
|
4647
|
+
getBackupNVMRawTask(onProgress) {
|
|
4648
|
+
const self = this;
|
|
4649
|
+
let rfRestored = false;
|
|
4650
|
+
return {
|
|
4651
|
+
priority: import_Task.TaskPriority.Normal,
|
|
4652
|
+
tag: { id: "nvm-backup" },
|
|
4653
|
+
group: { id: "controller-exclusive" },
|
|
4654
|
+
// The radio is off during the backup, so other tasks cannot communicate anyways
|
|
4655
|
+
interrupt: import_Task.TaskInterruptBehavior.Forbidden,
|
|
4656
|
+
task: /* @__PURE__ */ __name(async function* backupNVMRawTask() {
|
|
4657
|
+
self.driver.controllerLog.print("Backing up NVM...");
|
|
4658
|
+
if (!(yield* (0, import_waddle.waitFor)(self.toggleRF(false)))) {
|
|
4659
|
+
throw new import_core.ZWaveError("Could not turn off the Z-Wave radio before creating NVM backup!", import_core.ZWaveErrorCodes.Controller_ResponseNOK);
|
|
4660
|
+
}
|
|
4661
|
+
yield* (0, import_waddle.waitFor)(self.stopWatchdog());
|
|
4662
|
+
let ret;
|
|
4663
|
+
try {
|
|
4664
|
+
if (self.sdkVersionGte("7.0")) {
|
|
4665
|
+
ret = yield* (0, import_waddle.waitFor)(self.backupNVMRaw700(onProgress));
|
|
4666
|
+
yield* (0, import_waddle.waitFor)(self.driver.trySoftReset());
|
|
4667
|
+
} else {
|
|
4668
|
+
ret = yield* (0, import_waddle.waitFor)(self.backupNVMRaw500(onProgress));
|
|
4669
|
+
}
|
|
4670
|
+
self.driver.controllerLog.print("NVM backup completed");
|
|
4671
|
+
} finally {
|
|
4672
|
+
yield* (0, import_waddle.waitFor)(self.toggleRF(true));
|
|
4673
|
+
rfRestored = true;
|
|
4674
|
+
}
|
|
4675
|
+
return ret;
|
|
4676
|
+
}, "backupNVMRawTask"),
|
|
4677
|
+
cleanup: /* @__PURE__ */ __name(async () => {
|
|
4678
|
+
if (!rfRestored) {
|
|
4679
|
+
await self.toggleRF(true);
|
|
4680
|
+
}
|
|
4681
|
+
}, "cleanup")
|
|
4682
|
+
};
|
|
4642
4683
|
}
|
|
4643
4684
|
async backupNVMRaw500(onProgress) {
|
|
4644
4685
|
const size = (0, import_serialapi.nvmSizeToBufferSize)((await this.getNVMId()).memorySize);
|
|
@@ -4718,45 +4759,67 @@ let ZWaveController = (() => {
|
|
|
4718
4759
|
* @param restoreProgress Can be used to monitor the progress of the restore operation, which may take several seconds up to a few minutes depending on the NVM size
|
|
4719
4760
|
* @param migrateOptions Influence which data should be preserved during a migration
|
|
4720
4761
|
*/
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4762
|
+
restoreNVM(nvmData, convertProgress, restoreProgress, migrateOptions) {
|
|
4763
|
+
return this.driver.scheduler.queueTask(this.getRestoreNVMTask(nvmData, convertProgress, restoreProgress, migrateOptions));
|
|
4764
|
+
}
|
|
4765
|
+
getRestoreNVMTask(nvmData, convertProgress, restoreProgress, migrateOptions) {
|
|
4766
|
+
const self = this;
|
|
4767
|
+
let rfRestored = false;
|
|
4768
|
+
return {
|
|
4769
|
+
priority: import_Task.TaskPriority.Normal,
|
|
4770
|
+
tag: { id: "nvm-restore" },
|
|
4771
|
+
group: { id: "controller-exclusive" },
|
|
4772
|
+
// The radio is off during the restore, so other tasks cannot communicate anyways
|
|
4773
|
+
interrupt: import_Task.TaskInterruptBehavior.Forbidden,
|
|
4774
|
+
task: /* @__PURE__ */ __name(async function* restoreNVMTask() {
|
|
4775
|
+
if (!(yield* (0, import_waddle.waitFor)(self.toggleRF(false)))) {
|
|
4776
|
+
throw new import_core.ZWaveError("Could not turn off the Z-Wave radio before restoring NVM backup!", import_core.ZWaveErrorCodes.Controller_ResponseNOK);
|
|
4777
|
+
}
|
|
4778
|
+
yield* (0, import_waddle.waitFor)(self.stopWatchdog());
|
|
4779
|
+
self.driver.controllerLog.print("Converting NVM to target format...");
|
|
4780
|
+
let targetNVM;
|
|
4781
|
+
let convertedNVM;
|
|
4782
|
+
try {
|
|
4783
|
+
if (self.sdkVersionGte("7.0")) {
|
|
4784
|
+
targetNVM = yield* (0, import_waddle.waitFor)(self.backupNVMRaw700(convertProgress));
|
|
4785
|
+
} else {
|
|
4786
|
+
targetNVM = yield* (0, import_waddle.waitFor)(self.backupNVMRaw500(convertProgress));
|
|
4787
|
+
}
|
|
4788
|
+
convertedNVM = yield* (0, import_waddle.waitFor)((0, import_nvmedit.migrateNVM)(nvmData, targetNVM, migrateOptions));
|
|
4789
|
+
} catch (e) {
|
|
4790
|
+
yield* (0, import_waddle.waitFor)(self.toggleRF(true));
|
|
4791
|
+
rfRestored = true;
|
|
4792
|
+
const message = "Failed to convert NVM to target format: " + e.message;
|
|
4793
|
+
self.driver.controllerLog.print(message, "error");
|
|
4794
|
+
e.message = message;
|
|
4795
|
+
throw e;
|
|
4796
|
+
}
|
|
4797
|
+
try {
|
|
4798
|
+
self.driver.controllerLog.print("Restoring NVM backup...");
|
|
4799
|
+
if (self.sdkVersionGte("7.0")) {
|
|
4800
|
+
yield* (0, import_waddle.waitFor)(self.restoreNVMRaw700(convertedNVM, restoreProgress));
|
|
4801
|
+
} else {
|
|
4802
|
+
yield* (0, import_waddle.waitFor)(self.restoreNVMRaw500(convertedNVM, restoreProgress));
|
|
4803
|
+
}
|
|
4804
|
+
self.driver.controllerLog.print("NVM backup restored. Restarting to activate the restored backup...");
|
|
4805
|
+
} catch (e) {
|
|
4806
|
+
yield* (0, import_waddle.waitFor)(self.toggleRF(true));
|
|
4807
|
+
rfRestored = true;
|
|
4808
|
+
const message = "Failed to restore NVM backup: " + e.message;
|
|
4809
|
+
self.driver.controllerLog.print(message, "error");
|
|
4810
|
+
e.message = message;
|
|
4811
|
+
throw e;
|
|
4812
|
+
}
|
|
4813
|
+
rfRestored = true;
|
|
4814
|
+
self._nodes.clear();
|
|
4815
|
+
yield* (0, import_waddle.waitFor)(self.driver.softResetAndRestart());
|
|
4816
|
+
}, "restoreNVMTask"),
|
|
4817
|
+
cleanup: /* @__PURE__ */ __name(async () => {
|
|
4818
|
+
if (!rfRestored) {
|
|
4819
|
+
await self.toggleRF(true);
|
|
4820
|
+
}
|
|
4821
|
+
}, "cleanup")
|
|
4822
|
+
};
|
|
4760
4823
|
}
|
|
4761
4824
|
/**
|
|
4762
4825
|
* Restores an NVM backup that was created with `backupNVMRaw`. The Z-Wave radio is turned off/on automatically.
|
|
@@ -4768,24 +4831,44 @@ let ZWaveController = (() => {
|
|
|
4768
4831
|
* @param onProgress Can be used to monitor the progress of the operation, which may take several seconds up to a few minutes depending on the NVM size
|
|
4769
4832
|
*/
|
|
4770
4833
|
async restoreNVMRaw(nvmData, onProgress) {
|
|
4771
|
-
this.driver.
|
|
4772
|
-
if (!await this.toggleRF(false)) {
|
|
4773
|
-
throw new import_core.ZWaveError("Could not turn off the Z-Wave radio before restoring NVM backup!", import_core.ZWaveErrorCodes.Controller_ResponseNOK);
|
|
4774
|
-
}
|
|
4775
|
-
try {
|
|
4776
|
-
if (this.sdkVersionGte("7.0")) {
|
|
4777
|
-
await this.restoreNVMRaw700(nvmData, onProgress);
|
|
4778
|
-
} else {
|
|
4779
|
-
await this.restoreNVMRaw500(nvmData, onProgress);
|
|
4780
|
-
}
|
|
4781
|
-
this.driver.controllerLog.print("NVM backup restored");
|
|
4782
|
-
} finally {
|
|
4783
|
-
await this.toggleRF(true);
|
|
4784
|
-
}
|
|
4834
|
+
await this.driver.scheduler.queueTask(this.getRestoreNVMRawTask(nvmData, onProgress));
|
|
4785
4835
|
this.driver.controllerLog.print("Restarting driver to activate restored NVM backup...");
|
|
4786
4836
|
this.driver.emit("error", new import_core.ZWaveError("Activating the NVM backup requires a driver restart!", import_core.ZWaveErrorCodes.Driver_Failed));
|
|
4787
4837
|
await this.driver.destroy();
|
|
4788
4838
|
}
|
|
4839
|
+
getRestoreNVMRawTask(nvmData, onProgress) {
|
|
4840
|
+
const self = this;
|
|
4841
|
+
let rfRestored = false;
|
|
4842
|
+
return {
|
|
4843
|
+
priority: import_Task.TaskPriority.Normal,
|
|
4844
|
+
tag: { id: "nvm-restore" },
|
|
4845
|
+
group: { id: "controller-exclusive" },
|
|
4846
|
+
// The radio is off during the restore, so other tasks cannot communicate anyways
|
|
4847
|
+
interrupt: import_Task.TaskInterruptBehavior.Forbidden,
|
|
4848
|
+
task: /* @__PURE__ */ __name(async function* restoreNVMRawTask() {
|
|
4849
|
+
self.driver.controllerLog.print("Restoring NVM...");
|
|
4850
|
+
if (!(yield* (0, import_waddle.waitFor)(self.toggleRF(false)))) {
|
|
4851
|
+
throw new import_core.ZWaveError("Could not turn off the Z-Wave radio before restoring NVM backup!", import_core.ZWaveErrorCodes.Controller_ResponseNOK);
|
|
4852
|
+
}
|
|
4853
|
+
try {
|
|
4854
|
+
if (self.sdkVersionGte("7.0")) {
|
|
4855
|
+
yield* (0, import_waddle.waitFor)(self.restoreNVMRaw700(nvmData, onProgress));
|
|
4856
|
+
} else {
|
|
4857
|
+
yield* (0, import_waddle.waitFor)(self.restoreNVMRaw500(nvmData, onProgress));
|
|
4858
|
+
}
|
|
4859
|
+
self.driver.controllerLog.print("NVM backup restored");
|
|
4860
|
+
} finally {
|
|
4861
|
+
yield* (0, import_waddle.waitFor)(self.toggleRF(true));
|
|
4862
|
+
rfRestored = true;
|
|
4863
|
+
}
|
|
4864
|
+
}, "restoreNVMRawTask"),
|
|
4865
|
+
cleanup: /* @__PURE__ */ __name(async () => {
|
|
4866
|
+
if (!rfRestored) {
|
|
4867
|
+
await self.toggleRF(true);
|
|
4868
|
+
}
|
|
4869
|
+
}, "cleanup")
|
|
4870
|
+
};
|
|
4871
|
+
}
|
|
4789
4872
|
async restoreNVMRaw500(nvmData, onProgress) {
|
|
4790
4873
|
const size = (0, import_serialapi.nvmSizeToBufferSize)((await this.getNVMId()).memorySize);
|
|
4791
4874
|
if (!size) {
|
|
@@ -5056,13 +5139,15 @@ let ZWaveController = (() => {
|
|
|
5056
5139
|
const firmwares = [];
|
|
5057
5140
|
for (let i = 0; i < files.length; i++) {
|
|
5058
5141
|
const update = files[i];
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
logMessage
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5142
|
+
const logMessage = `Downloading firmware update ${i} of ${files.length}...`;
|
|
5143
|
+
this.driver.controllerLog.logNode(nodeId, {
|
|
5144
|
+
message: loglevel === "silly" ? (0, import_core.logText)(logMessage, {
|
|
5145
|
+
nested: (0, import_core.logDict)({
|
|
5146
|
+
URL: update.url,
|
|
5147
|
+
integrity: update.integrity
|
|
5148
|
+
})
|
|
5149
|
+
}) : logMessage
|
|
5150
|
+
});
|
|
5066
5151
|
try {
|
|
5067
5152
|
const firmware = await (0, import_FirmwareUpdateService.downloadFirmwareUpdate)(update);
|
|
5068
5153
|
firmwares.push(firmware);
|
|
@@ -5578,10 +5663,9 @@ let ZWaveController = (() => {
|
|
|
5578
5663
|
for (const [secClass, key] of receivedKeys) {
|
|
5579
5664
|
this.driver.cacheSet(import_NetworkCache.cacheKeys.controller.securityKeys(secClass), key);
|
|
5580
5665
|
}
|
|
5581
|
-
this.driver.driverLog.print(
|
|
5582
|
-
...bootstrappingNode.securityClasses.entries()
|
|
5583
|
-
|
|
5584
|
-
\xB7 ${(0, import_shared.getEnumMemberName)(import_core.SecurityClass, k)}`).join("")}`);
|
|
5666
|
+
this.driver.driverLog.print((0, import_core.logText)("Security S2 bootstrapping successful with these security classes:", {
|
|
5667
|
+
nested: (0, import_core.logList)([...bootstrappingNode.securityClasses.entries()].filter(([, v]) => v).map(([k]) => (0, import_shared.getEnumMemberName)(import_core.SecurityClass, k)))
|
|
5668
|
+
}));
|
|
5585
5669
|
} catch (e) {
|
|
5586
5670
|
let errorMessage = `Security S2 bootstrapping failed, no S2 security classes were granted`;
|
|
5587
5671
|
let result = import_Inclusion.SecurityBootstrapFailure.Unknown;
|
|
@@ -5690,10 +5774,14 @@ let ZWaveController = (() => {
|
|
|
5690
5774
|
}
|
|
5691
5775
|
if (grant) {
|
|
5692
5776
|
this.driver.controllerLog.logNode(nodeId, {
|
|
5693
|
-
message:
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5777
|
+
message: (0, import_core.logText)("Received S2 bootstrap initiation, requesting keys:", {
|
|
5778
|
+
nested: [
|
|
5779
|
+
(0, import_core.logList)(grant.securityClasses.map((sc) => (0, import_shared.getEnumMemberName)(import_core.SecurityClass, sc))),
|
|
5780
|
+
(0, import_core.logDict)({
|
|
5781
|
+
"client-side auth": grant.clientSideAuth
|
|
5782
|
+
})
|
|
5783
|
+
]
|
|
5784
|
+
})
|
|
5697
5785
|
});
|
|
5698
5786
|
const bootstrapResult = await this.expectSecurityBootstrapS2(bootstrappingNode, grant, this._joinNetworkOptions?.userCallbacks);
|
|
5699
5787
|
if (bootstrapResult !== void 0) {
|