@zwave-js/host 14.3.10 → 15.0.0-beta.1
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/index.d.ts +0 -2
- package/build/cjs/index.js +0 -4
- package/build/cjs/index.js.map +2 -2
- package/build/cjs/mocks.d.ts +2 -2
- package/build/cjs/mocks.js +0 -48
- package/build/cjs/mocks.js.map +2 -2
- package/build/esm/index.d.ts +0 -2
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +0 -3
- package/build/esm/index.js.map +1 -1
- package/build/esm/mocks.d.ts +2 -2
- package/build/esm/mocks.d.ts.map +1 -1
- package/build/esm/mocks.js +0 -51
- package/build/esm/mocks.js.map +1 -1
- package/package.json +10 -15
- package/build/cjs/ZWaveHost.d.ts +0 -97
- package/build/cjs/ZWaveHost.js +0 -17
- package/build/cjs/ZWaveHost.js.map +0 -7
- package/build/cjs/ZWaveHostOptions.d.ts +0 -71
- package/build/cjs/ZWaveHostOptions.js +0 -17
- package/build/cjs/ZWaveHostOptions.js.map +0 -7
- package/build/cjs/index_safe.d.ts +0 -3
- package/build/cjs/index_safe.js +0 -25
- package/build/cjs/index_safe.js.map +0 -7
- package/build/esm/ZWaveHost.d.ts +0 -97
- package/build/esm/ZWaveHost.d.ts.map +0 -1
- package/build/esm/ZWaveHost.js +0 -2
- package/build/esm/ZWaveHost.js.map +0 -1
- package/build/esm/ZWaveHostOptions.d.ts +0 -71
- package/build/esm/ZWaveHostOptions.d.ts.map +0 -1
- package/build/esm/ZWaveHostOptions.js +0 -2
- package/build/esm/ZWaveHostOptions.js.map +0 -1
- package/build/esm/index_safe.d.ts +0 -3
- package/build/esm/index_safe.d.ts.map +0 -1
- package/build/esm/index_safe.js +0 -5
- package/build/esm/index_safe.js.map +0 -1
package/build/cjs/index.d.ts
CHANGED
package/build/cjs/index.js
CHANGED
|
@@ -15,13 +15,9 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var esm_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(esm_exports);
|
|
18
|
-
__reExport(esm_exports, require("./ZWaveHost.js"), module.exports);
|
|
19
|
-
__reExport(esm_exports, require("./ZWaveHostOptions.js"), module.exports);
|
|
20
18
|
__reExport(esm_exports, require("./mocks.js"), module.exports);
|
|
21
19
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22
20
|
0 && (module.exports = {
|
|
23
|
-
...require("./ZWaveHost.js"),
|
|
24
|
-
...require("./ZWaveHostOptions.js"),
|
|
25
21
|
...require("./mocks.js")
|
|
26
22
|
});
|
|
27
23
|
//# sourceMappingURL=index.js.map
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;;
|
|
4
|
+
"sourcesContent": ["export * from \"./mocks.js\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;AAAA,wBAAc,uBAAd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/cjs/mocks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type
|
|
1
|
+
import { type GetDeviceConfig } from "@zwave-js/config";
|
|
2
|
+
import { type ControlsCC, type EndpointId, type GetAllNodes, type GetEndpoint, type GetNode, type GetSupportedCCVersion, type GetValueDB, type HostIDs, type IsCCSecure, type ListenBehavior, type LogNode, type NodeId, type QuerySecurityClasses, type SetSecurityClass, type SupportsCC } from "@zwave-js/core";
|
|
3
3
|
export interface CreateTestingHostOptions extends HostIDs, GetDeviceConfig {
|
|
4
4
|
}
|
|
5
5
|
export type BaseTestEndpoint = EndpointId & SupportsCC & ControlsCC & IsCCSecure;
|
package/build/cjs/mocks.js
CHANGED
|
@@ -35,37 +35,8 @@ function createTestingHost(options = {}) {
|
|
|
35
35
|
homeId: options.homeId ?? 2119630849,
|
|
36
36
|
ownNodeId: options.ownNodeId ?? 1,
|
|
37
37
|
getDeviceConfig: options.getDeviceConfig ?? (() => void 0),
|
|
38
|
-
// securityManager: undefined,
|
|
39
|
-
// securityManager2: undefined,
|
|
40
|
-
// securityManagerLR: undefined,
|
|
41
|
-
// getDeviceConfig: () => undefined,
|
|
42
|
-
// lookupManufacturer: () => undefined,
|
|
43
38
|
logNode: /* @__PURE__ */ __name(() => {
|
|
44
39
|
}, "logNode"),
|
|
45
|
-
// options: {
|
|
46
|
-
// attempts: {
|
|
47
|
-
// nodeInterview: 1,
|
|
48
|
-
// // openSerialPort: 1,
|
|
49
|
-
// sendData: 3,
|
|
50
|
-
// controller: 3,
|
|
51
|
-
// },
|
|
52
|
-
// timeouts: {
|
|
53
|
-
// refreshValue: 5000,
|
|
54
|
-
// refreshValueAfterTransition: 1000,
|
|
55
|
-
// },
|
|
56
|
-
// },
|
|
57
|
-
// getInterviewOptions() {
|
|
58
|
-
// return {};
|
|
59
|
-
// },
|
|
60
|
-
// getUserPreferences() {
|
|
61
|
-
// return undefined;
|
|
62
|
-
// },
|
|
63
|
-
// getCommunicationTimeouts() {
|
|
64
|
-
// return {
|
|
65
|
-
// refreshValue: 5000,
|
|
66
|
-
// refreshValueAfterTransition: 1000,
|
|
67
|
-
// };
|
|
68
|
-
// },
|
|
69
40
|
getNode(nodeId) {
|
|
70
41
|
return nodes.get(nodeId);
|
|
71
42
|
},
|
|
@@ -78,7 +49,6 @@ function createTestingHost(options = {}) {
|
|
|
78
49
|
setNode(nodeId, node) {
|
|
79
50
|
nodes.set(nodeId, node);
|
|
80
51
|
},
|
|
81
|
-
// getSafeCCVersion: options.getSafeCCVersion ?? (() => 100),
|
|
82
52
|
getSupportedCCVersion: /* @__PURE__ */ __name((cc, nodeId, endpoint) => {
|
|
83
53
|
return nodes.get(nodeId)?.getEndpoint(endpoint ?? 0)?.getCCVersion(cc) ?? 0;
|
|
84
54
|
}, "getSupportedCCVersion"),
|
|
@@ -91,24 +61,6 @@ function createTestingHost(options = {}) {
|
|
|
91
61
|
tryGetValueDB: /* @__PURE__ */ __name((nodeId) => {
|
|
92
62
|
return ret.getValueDB(nodeId);
|
|
93
63
|
}, "tryGetValueDB")
|
|
94
|
-
// getHighestSecurityClass: (nodeId) => {
|
|
95
|
-
// const node = nodes.getOrThrow(nodeId);
|
|
96
|
-
// return node.getHighestSecurityClass();
|
|
97
|
-
// },
|
|
98
|
-
// hasSecurityClass: (nodeId, securityClass) => {
|
|
99
|
-
// const node = nodes.getOrThrow(nodeId);
|
|
100
|
-
// return node.hasSecurityClass(securityClass);
|
|
101
|
-
// },
|
|
102
|
-
// setSecurityClass: (nodeId, securityClass, granted) => {
|
|
103
|
-
// const node = nodes.getOrThrow(nodeId);
|
|
104
|
-
// node.setSecurityClass(securityClass, granted);
|
|
105
|
-
// },
|
|
106
|
-
// sendCommand: async (_command, _options) => {
|
|
107
|
-
// return undefined as any;
|
|
108
|
-
// },
|
|
109
|
-
// schedulePoll: (_nodeId, _valueId, _options) => {
|
|
110
|
-
// return false;
|
|
111
|
-
// },
|
|
112
64
|
};
|
|
113
65
|
return ret;
|
|
114
66
|
}
|
package/build/cjs/mocks.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mocks.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\ttype ControlsCC,\n\ttype EndpointId,\n\ttype GetEndpoint,\n\ttype IsCCSecure,\n\ttype ListenBehavior,\n\ttype NodeId,\n\ttype QuerySecurityClasses,\n\ttype SetSecurityClass,\n\ttype SupportsCC,\n\tValueDB,\n\tZWaveError,\n\tZWaveErrorCodes,\n} from \"@zwave-js/core\";\nimport { createThrowingMap } from \"@zwave-js/shared\";\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;
|
|
4
|
+
"sourcesContent": ["import { type GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\ttype ControlsCC,\n\ttype EndpointId,\n\ttype GetAllNodes,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype IsCCSecure,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype NodeId,\n\ttype QuerySecurityClasses,\n\ttype SetSecurityClass,\n\ttype SupportsCC,\n\tValueDB,\n\tZWaveError,\n\tZWaveErrorCodes,\n} from \"@zwave-js/core\";\nimport { createThrowingMap } from \"@zwave-js/shared\";\n\n// FIXME: At some points this module should be moved into @zwave-js/testing,\n// but this doesn't work right now due to circular dependencies\n\nexport interface CreateTestingHostOptions extends HostIDs, GetDeviceConfig {}\n\nexport type BaseTestEndpoint =\n\t& EndpointId\n\t& SupportsCC\n\t& ControlsCC\n\t& IsCCSecure;\n\nexport type BaseTestNode =\n\t& BaseTestEndpoint\n\t& NodeId\n\t& ListenBehavior\n\t& QuerySecurityClasses\n\t& SetSecurityClass\n\t& SupportsCC\n\t& ControlsCC\n\t& IsCCSecure\n\t& GetEndpoint<BaseTestEndpoint>;\n\nexport interface TestingHost\n\textends\n\t\tHostIDs,\n\t\tGetValueDB,\n\t\tGetSupportedCCVersion,\n\t\tGetAllNodes<BaseTestNode>,\n\t\tGetNode<BaseTestNode>,\n\t\tGetDeviceConfig,\n\t\tLogNode\n{\n\tsetNode(nodeId: number, node: BaseTestNode): void;\n}\n\n/** Creates a {@link TestingHost} that can be used instead of a real driver instance in tests */\nexport function createTestingHost(\n\toptions: Partial<CreateTestingHostOptions> = {},\n): TestingHost {\n\tconst valuesStorage = new Map();\n\tconst metadataStorage = new Map();\n\tconst valueDBCache = new Map<number, ValueDB>();\n\tconst nodes = createThrowingMap<number, BaseTestNode>((nodeId) => {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeId} was not found!`,\n\t\t\tZWaveErrorCodes.Controller_NodeNotFound,\n\t\t);\n\t});\n\n\tconst ret: TestingHost = {\n\t\thomeId: options.homeId ?? 0x7e570001,\n\t\townNodeId: options.ownNodeId ?? 1,\n\t\tgetDeviceConfig: options.getDeviceConfig ?? (() => undefined),\n\t\tlogNode: () => {},\n\t\tgetNode(nodeId) {\n\t\t\treturn nodes.get(nodeId);\n\t\t},\n\t\tgetNodeOrThrow(nodeId) {\n\t\t\treturn nodes.getOrThrow(nodeId);\n\t\t},\n\t\tgetAllNodes() {\n\t\t\treturn [...nodes.values()];\n\t\t},\n\t\tsetNode(nodeId, node) {\n\t\t\tnodes.set(nodeId, node);\n\t\t},\n\t\tgetSupportedCCVersion: (cc, nodeId, endpoint) => {\n\t\t\treturn nodes.get(nodeId)?.getEndpoint(endpoint ?? 0)?.getCCVersion(\n\t\t\t\tcc,\n\t\t\t) ?? 0;\n\t\t},\n\t\tgetValueDB: (nodeId) => {\n\t\t\tif (!valueDBCache.has(nodeId)) {\n\t\t\t\tvalueDBCache.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew ValueDB(\n\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\tvaluesStorage as any,\n\t\t\t\t\t\tmetadataStorage as any,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn valueDBCache.get(nodeId)!;\n\t\t},\n\t\ttryGetValueDB: (nodeId) => {\n\t\t\treturn ret.getValueDB(nodeId);\n\t\t},\n\t};\n\treturn ret;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;AAAA,kBAmBO;AACP,oBAAkC;AAsC5B,SAAU,kBACf,UAA6C,CAAA,GAAE;AAE/C,QAAM,gBAAgB,oBAAI,IAAG;AAC7B,QAAM,kBAAkB,oBAAI,IAAG;AAC/B,QAAM,eAAe,oBAAI,IAAG;AAC5B,QAAM,YAAQ,iCAAwC,CAAC,WAAU;AAChE,UAAM,IAAI,uBACT,QAAQ,MAAM,mBACd,4BAAgB,uBAAuB;EAEzC,CAAC;AAED,QAAM,MAAmB;IACxB,QAAQ,QAAQ,UAAU;IAC1B,WAAW,QAAQ,aAAa;IAChC,iBAAiB,QAAQ,oBAAoB,MAAM;IACnD,SAAS,6BAAK;IAAE,GAAP;IACT,QAAQ,QAAM;AACb,aAAO,MAAM,IAAI,MAAM;IACxB;IACA,eAAe,QAAM;AACpB,aAAO,MAAM,WAAW,MAAM;IAC/B;IACA,cAAW;AACV,aAAO,CAAC,GAAG,MAAM,OAAM,CAAE;IAC1B;IACA,QAAQ,QAAQ,MAAI;AACnB,YAAM,IAAI,QAAQ,IAAI;IACvB;IACA,uBAAuB,wBAAC,IAAI,QAAQ,aAAY;AAC/C,aAAO,MAAM,IAAI,MAAM,GAAG,YAAY,YAAY,CAAC,GAAG,aACrD,EAAE,KACE;IACN,GAJuB;IAKvB,YAAY,wBAAC,WAAU;AACtB,UAAI,CAAC,aAAa,IAAI,MAAM,GAAG;AAC9B,qBAAa,IACZ,QACA,IAAI,oBACH,QACA,eACA,eAAsB,CACtB;MAEH;AACA,aAAO,aAAa,IAAI,MAAM;IAC/B,GAZY;IAaZ,eAAe,wBAAC,WAAU;AACzB,aAAO,IAAI,WAAW,MAAM;IAC7B,GAFe;;AAIhB,SAAO;AACR;AArDgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/esm/index.d.ts
CHANGED
package/build/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
package/build/esm/index.js
CHANGED
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
package/build/esm/mocks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type
|
|
1
|
+
import { type GetDeviceConfig } from "@zwave-js/config";
|
|
2
|
+
import { type ControlsCC, type EndpointId, type GetAllNodes, type GetEndpoint, type GetNode, type GetSupportedCCVersion, type GetValueDB, type HostIDs, type IsCCSecure, type ListenBehavior, type LogNode, type NodeId, type QuerySecurityClasses, type SetSecurityClass, type SupportsCC } from "@zwave-js/core";
|
|
3
3
|
export interface CreateTestingHostOptions extends HostIDs, GetDeviceConfig {
|
|
4
4
|
}
|
|
5
5
|
export type BaseTestEndpoint = EndpointId & SupportsCC & ControlsCC & IsCCSecure;
|
package/build/esm/mocks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EACN,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAIf,MAAM,gBAAgB,CAAC;AAMxB,MAAM,WAAW,wBAAyB,SAAQ,OAAO,EAAE,eAAe;CAAG;AAE7E,MAAM,MAAM,gBAAgB,GACzB,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAEd,MAAM,MAAM,YAAY,GACrB,gBAAgB,GAChB,MAAM,GACN,cAAc,GACd,oBAAoB,GACpB,gBAAgB,GAChB,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,CAAC,gBAAgB,CAAC,CAAC;AAEjC,MAAM,WAAW,WAChB,SACC,OAAO,EACP,UAAU,EACV,qBAAqB,EACrB,WAAW,CAAC,YAAY,CAAC,EACzB,OAAO,CAAC,YAAY,CAAC,EACrB,eAAe,EACf,OAAO;IAER,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;CAClD;AAED,gGAAgG;AAChG,wBAAgB,iBAAiB,CAChC,OAAO,GAAE,OAAO,CAAC,wBAAwB,CAAM,GAC7C,WAAW,CAmDb"}
|
package/build/esm/mocks.js
CHANGED
|
@@ -12,36 +12,7 @@ export function createTestingHost(options = {}) {
|
|
|
12
12
|
homeId: options.homeId ?? 0x7e570001,
|
|
13
13
|
ownNodeId: options.ownNodeId ?? 1,
|
|
14
14
|
getDeviceConfig: options.getDeviceConfig ?? (() => undefined),
|
|
15
|
-
// securityManager: undefined,
|
|
16
|
-
// securityManager2: undefined,
|
|
17
|
-
// securityManagerLR: undefined,
|
|
18
|
-
// getDeviceConfig: () => undefined,
|
|
19
|
-
// lookupManufacturer: () => undefined,
|
|
20
15
|
logNode: () => { },
|
|
21
|
-
// options: {
|
|
22
|
-
// attempts: {
|
|
23
|
-
// nodeInterview: 1,
|
|
24
|
-
// // openSerialPort: 1,
|
|
25
|
-
// sendData: 3,
|
|
26
|
-
// controller: 3,
|
|
27
|
-
// },
|
|
28
|
-
// timeouts: {
|
|
29
|
-
// refreshValue: 5000,
|
|
30
|
-
// refreshValueAfterTransition: 1000,
|
|
31
|
-
// },
|
|
32
|
-
// },
|
|
33
|
-
// getInterviewOptions() {
|
|
34
|
-
// return {};
|
|
35
|
-
// },
|
|
36
|
-
// getUserPreferences() {
|
|
37
|
-
// return undefined;
|
|
38
|
-
// },
|
|
39
|
-
// getCommunicationTimeouts() {
|
|
40
|
-
// return {
|
|
41
|
-
// refreshValue: 5000,
|
|
42
|
-
// refreshValueAfterTransition: 1000,
|
|
43
|
-
// };
|
|
44
|
-
// },
|
|
45
16
|
getNode(nodeId) {
|
|
46
17
|
return nodes.get(nodeId);
|
|
47
18
|
},
|
|
@@ -54,12 +25,8 @@ export function createTestingHost(options = {}) {
|
|
|
54
25
|
setNode(nodeId, node) {
|
|
55
26
|
nodes.set(nodeId, node);
|
|
56
27
|
},
|
|
57
|
-
// getSafeCCVersion: options.getSafeCCVersion ?? (() => 100),
|
|
58
28
|
getSupportedCCVersion: (cc, nodeId, endpoint) => {
|
|
59
29
|
return nodes.get(nodeId)?.getEndpoint(endpoint ?? 0)?.getCCVersion(cc) ?? 0;
|
|
60
|
-
// return options.getSupportedCCVersion?.(cc, nodeId, endpoint)
|
|
61
|
-
// ?? options.getSafeCCVersion?.(cc, nodeId, endpoint)
|
|
62
|
-
// ?? 100;
|
|
63
30
|
},
|
|
64
31
|
getValueDB: (nodeId) => {
|
|
65
32
|
if (!valueDBCache.has(nodeId)) {
|
|
@@ -70,24 +37,6 @@ export function createTestingHost(options = {}) {
|
|
|
70
37
|
tryGetValueDB: (nodeId) => {
|
|
71
38
|
return ret.getValueDB(nodeId);
|
|
72
39
|
},
|
|
73
|
-
// getHighestSecurityClass: (nodeId) => {
|
|
74
|
-
// const node = nodes.getOrThrow(nodeId);
|
|
75
|
-
// return node.getHighestSecurityClass();
|
|
76
|
-
// },
|
|
77
|
-
// hasSecurityClass: (nodeId, securityClass) => {
|
|
78
|
-
// const node = nodes.getOrThrow(nodeId);
|
|
79
|
-
// return node.hasSecurityClass(securityClass);
|
|
80
|
-
// },
|
|
81
|
-
// setSecurityClass: (nodeId, securityClass, granted) => {
|
|
82
|
-
// const node = nodes.getOrThrow(nodeId);
|
|
83
|
-
// node.setSecurityClass(securityClass, granted);
|
|
84
|
-
// },
|
|
85
|
-
// sendCommand: async (_command, _options) => {
|
|
86
|
-
// return undefined as any;
|
|
87
|
-
// },
|
|
88
|
-
// schedulePoll: (_nodeId, _valueId, _options) => {
|
|
89
|
-
// return false;
|
|
90
|
-
// },
|
|
91
40
|
};
|
|
92
41
|
return ret;
|
|
93
42
|
}
|
package/build/esm/mocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../src/mocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../src/mocks.ts"],"names":[],"mappings":"AACA,OAAO,EAgBN,OAAO,EACP,UAAU,EACV,eAAe,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAqCrD,gGAAgG;AAChG,MAAM,UAAU,iBAAiB,CAChC,UAA6C,EAAE;IAE/C,MAAM,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;IAChC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;IAClC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAmB,CAAC;IAChD,MAAM,KAAK,GAAG,iBAAiB,CAAuB,CAAC,MAAM,EAAE,EAAE;QAChE,MAAM,IAAI,UAAU,CACnB,QAAQ,MAAM,iBAAiB,EAC/B,eAAe,CAAC,uBAAuB,CACvC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAgB;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,UAAU;QACpC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC;QACjC,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;QAC7D,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,OAAO,CAAC,MAAM;YACb,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC;QACD,cAAc,CAAC,MAAM;YACpB,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QACD,WAAW;YACV,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,CAAC,MAAM,EAAE,IAAI;YACnB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;YAC/C,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,YAAY,CACjE,EAAE,CACF,IAAI,CAAC,CAAC;QACR,CAAC;QACD,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE;YACtB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC/B,YAAY,CAAC,GAAG,CACf,MAAM,EACN,IAAI,OAAO,CACV,MAAM,EACN,aAAoB,EACpB,eAAsB,CACtB,CACD,CAAC;YACH,CAAC;YACD,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;QAClC,CAAC;QACD,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE;YACzB,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;KACD,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zwave-js/host",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0-beta.1",
|
|
4
4
|
"description": "zwave-js: Host abstractions",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
"import": "./build/esm/index.js",
|
|
14
14
|
"require": "./build/cjs/index.js"
|
|
15
15
|
},
|
|
16
|
-
"./safe": {
|
|
17
|
-
"@@dev": "./src/index_safe.ts",
|
|
18
|
-
"import": "./build/esm/index_safe.js",
|
|
19
|
-
"require": "./build/cjs/index_safe.js"
|
|
20
|
-
},
|
|
21
16
|
"./package.json": "./package.json"
|
|
22
17
|
},
|
|
23
18
|
"files": [
|
|
@@ -29,19 +24,19 @@
|
|
|
29
24
|
"email": "d.griesel@gmx.net"
|
|
30
25
|
},
|
|
31
26
|
"license": "MIT",
|
|
32
|
-
"homepage": "https://github.com/zwave-js/
|
|
27
|
+
"homepage": "https://github.com/zwave-js/zwave-js#readme",
|
|
33
28
|
"repository": {
|
|
34
29
|
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/zwave-js/
|
|
30
|
+
"url": "git+https://github.com/zwave-js/zwave-js.git"
|
|
36
31
|
},
|
|
37
32
|
"bugs": {
|
|
38
|
-
"url": "https://github.com/zwave-js/
|
|
33
|
+
"url": "https://github.com/zwave-js/zwave-js/issues"
|
|
39
34
|
},
|
|
40
35
|
"funding": {
|
|
41
36
|
"url": "https://github.com/sponsors/AlCalzone/"
|
|
42
37
|
},
|
|
43
38
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
39
|
+
"node": ">= 20"
|
|
45
40
|
},
|
|
46
41
|
"scripts": {
|
|
47
42
|
"build": "tsc -b tsconfig.build.json --pretty && yarn postbuild",
|
|
@@ -52,16 +47,16 @@
|
|
|
52
47
|
"lint:ts:fix": "yarn run lint:ts --fix"
|
|
53
48
|
},
|
|
54
49
|
"dependencies": {
|
|
55
|
-
"@zwave-js/config": "
|
|
56
|
-
"@zwave-js/core": "
|
|
57
|
-
"@zwave-js/shared": "
|
|
50
|
+
"@zwave-js/config": "15.0.0-beta.1",
|
|
51
|
+
"@zwave-js/core": "15.0.0-beta.1",
|
|
52
|
+
"@zwave-js/shared": "15.0.0-beta.1",
|
|
58
53
|
"alcalzone-shared": "^5.0.0"
|
|
59
54
|
},
|
|
60
55
|
"devDependencies": {
|
|
61
56
|
"@alcalzone/esm2cjs": "^1.4.1",
|
|
62
57
|
"@microsoft/api-extractor": "^7.48.0",
|
|
63
|
-
"@types/node": "^
|
|
58
|
+
"@types/node": "^20.17.16",
|
|
64
59
|
"del-cli": "^6.0.0",
|
|
65
|
-
"typescript": "5.
|
|
60
|
+
"typescript": "5.7.3"
|
|
66
61
|
}
|
|
67
62
|
}
|
package/build/cjs/ZWaveHost.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { DeviceConfig } from "@zwave-js/config";
|
|
2
|
-
import type { CCId, CommandClasses, ControllerLogger, FrameType, MaybeNotKnown, NodeId, SecurityClass, SecurityManagers, SendCommandOptions, SendCommandReturnType, ValueDB, ValueID } from "@zwave-js/core";
|
|
3
|
-
import type { ZWaveHostOptions } from "./ZWaveHostOptions.js";
|
|
4
|
-
/** Allows querying the home ID and node ID of the host */
|
|
5
|
-
export interface HostIDs {
|
|
6
|
-
/** The ID of this node in the current network */
|
|
7
|
-
ownNodeId: number;
|
|
8
|
-
/** The Home ID of the current network */
|
|
9
|
-
homeId: number;
|
|
10
|
-
}
|
|
11
|
-
/** Allows querying device configuration for a node */
|
|
12
|
-
export interface GetDeviceConfig {
|
|
13
|
-
getDeviceConfig(nodeId: number): DeviceConfig | undefined;
|
|
14
|
-
}
|
|
15
|
-
export interface GetSupportedCCVersion {
|
|
16
|
-
/**
|
|
17
|
-
* Retrieves the maximum version of a command class the given node/endpoint has reported support for.
|
|
18
|
-
* Returns 0 when the CC is not supported or that information is not known yet.
|
|
19
|
-
*/
|
|
20
|
-
getSupportedCCVersion(cc: CommandClasses, nodeId: number, endpointIndex?: number): number;
|
|
21
|
-
}
|
|
22
|
-
export interface GetSafeCCVersion {
|
|
23
|
-
/**
|
|
24
|
-
* Retrieves the maximum version of a command class that can be used to communicate with a node.
|
|
25
|
-
* Returns 1 if the node claims that it does not support a CC.
|
|
26
|
-
* Returns `undefined` for CCs that are not implemented in this library yet.
|
|
27
|
-
*/
|
|
28
|
-
getSafeCCVersion(cc: CommandClasses, nodeId: number, endpointIndex?: number): number | undefined;
|
|
29
|
-
}
|
|
30
|
-
/** Additional context needed for deserializing CCs */
|
|
31
|
-
export interface CCParsingContext extends Readonly<SecurityManagers>, GetDeviceConfig, HostIDs {
|
|
32
|
-
sourceNodeId: number;
|
|
33
|
-
__internalIsMockNode?: boolean;
|
|
34
|
-
/** If known, the frame type of the containing message */
|
|
35
|
-
frameType: FrameType;
|
|
36
|
-
getHighestSecurityClass(nodeId: number): MaybeNotKnown<SecurityClass>;
|
|
37
|
-
hasSecurityClass(nodeId: number, securityClass: SecurityClass): MaybeNotKnown<boolean>;
|
|
38
|
-
setSecurityClass(nodeId: number, securityClass: SecurityClass, granted: boolean): void;
|
|
39
|
-
}
|
|
40
|
-
/** Additional context needed for serializing CCs */
|
|
41
|
-
export interface CCEncodingContext extends Readonly<SecurityManagers>, GetDeviceConfig, HostIDs, GetSupportedCCVersion {
|
|
42
|
-
getHighestSecurityClass(nodeId: number): MaybeNotKnown<SecurityClass>;
|
|
43
|
-
hasSecurityClass(nodeId: number, securityClass: SecurityClass): MaybeNotKnown<boolean>;
|
|
44
|
-
setSecurityClass(nodeId: number, securityClass: SecurityClass, granted: boolean): void;
|
|
45
|
-
}
|
|
46
|
-
/** Host application abstractions that provide support for reading and writing values to a database */
|
|
47
|
-
export interface GetValueDB {
|
|
48
|
-
/** Returns the value DB which belongs to the node with the given ID, or throws if the Value DB cannot be accessed */
|
|
49
|
-
getValueDB(nodeId: number): ValueDB;
|
|
50
|
-
/** Returns the value DB which belongs to the node with the given ID, or `undefined` if the Value DB cannot be accessed */
|
|
51
|
-
tryGetValueDB(nodeId: number): ValueDB | undefined;
|
|
52
|
-
}
|
|
53
|
-
/** Allows accessing a specific node */
|
|
54
|
-
export interface GetNode<T extends NodeId> {
|
|
55
|
-
getNode(nodeId: number): T | undefined;
|
|
56
|
-
getNodeOrThrow(nodeId: number): T;
|
|
57
|
-
}
|
|
58
|
-
/** Allows accessing all nodes */
|
|
59
|
-
export interface GetAllNodes<T extends NodeId> {
|
|
60
|
-
getAllNodes(): T[];
|
|
61
|
-
}
|
|
62
|
-
/** Allows looking up Z-Wave manufacturers by manufacturer ID */
|
|
63
|
-
export interface LookupManufacturer {
|
|
64
|
-
/** Looks up the name of the manufacturer with the given ID in the configuration DB */
|
|
65
|
-
lookupManufacturer(manufacturerId: number): string | undefined;
|
|
66
|
-
}
|
|
67
|
-
/** Allows sending commands to one or more nodes */
|
|
68
|
-
export interface SendCommand {
|
|
69
|
-
sendCommand<TResponse extends CCId | undefined = undefined>(command: CCId, options?: SendCommandOptions): Promise<SendCommandReturnType<TResponse>>;
|
|
70
|
-
}
|
|
71
|
-
/** Allows reading options to use for interviewing devices */
|
|
72
|
-
export interface GetInterviewOptions {
|
|
73
|
-
getInterviewOptions(): ZWaveHostOptions["interview"];
|
|
74
|
-
}
|
|
75
|
-
/** Allows reading user preferences */
|
|
76
|
-
export interface GetUserPreferences {
|
|
77
|
-
getUserPreferences(): ZWaveHostOptions["preferences"];
|
|
78
|
-
}
|
|
79
|
-
/** Allows reading user preferences */
|
|
80
|
-
export interface GetCommunicationTimeouts {
|
|
81
|
-
getCommunicationTimeouts(): ZWaveHostOptions["timeouts"];
|
|
82
|
-
}
|
|
83
|
-
export type LogNode = Pick<ControllerLogger, "logNode">;
|
|
84
|
-
/** Allows scheduling a value refresh (poll) for a later time */
|
|
85
|
-
export interface SchedulePoll {
|
|
86
|
-
schedulePoll(nodeId: number, valueId: ValueID, options: NodeSchedulePollOptions): boolean;
|
|
87
|
-
}
|
|
88
|
-
export interface NodeSchedulePollOptions {
|
|
89
|
-
/** The timeout after which the poll is to be scheduled */
|
|
90
|
-
timeoutMs?: number;
|
|
91
|
-
/**
|
|
92
|
-
* The expected value that's should be verified with this poll.
|
|
93
|
-
* When this value is received in the meantime, the poll will be cancelled.
|
|
94
|
-
*/
|
|
95
|
-
expectedValue?: unknown;
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=ZWaveHost.d.ts.map
|
package/build/cjs/ZWaveHost.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var ZWaveHost_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(ZWaveHost_exports);
|
|
17
|
-
//# sourceMappingURL=ZWaveHost.js.map
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export interface ZWaveHostOptions {
|
|
2
|
-
/** Specify timeouts in milliseconds */
|
|
3
|
-
timeouts: {
|
|
4
|
-
/**
|
|
5
|
-
* How long to wait for a poll after setting a value without transition duration
|
|
6
|
-
*/
|
|
7
|
-
refreshValue: number;
|
|
8
|
-
/**
|
|
9
|
-
* How long to wait for a poll after setting a value with transition duration. This doubles as the "fast" delay.
|
|
10
|
-
*/
|
|
11
|
-
refreshValueAfterTransition: number;
|
|
12
|
-
};
|
|
13
|
-
attempts: {
|
|
14
|
-
/** How often the driver should try communication with the controller before giving up */
|
|
15
|
-
controller: number;
|
|
16
|
-
/** How often the driver should try sending SendData commands before giving up */
|
|
17
|
-
sendData: number;
|
|
18
|
-
/**
|
|
19
|
-
* How many attempts should be made for each node interview before giving up
|
|
20
|
-
*/
|
|
21
|
-
nodeInterview: number;
|
|
22
|
-
};
|
|
23
|
-
interview?: {
|
|
24
|
-
/**
|
|
25
|
-
* Whether all user code should be queried during the interview of the UserCode CC.
|
|
26
|
-
* Note that enabling this can cause a lot of traffic during the interview.
|
|
27
|
-
*/
|
|
28
|
-
queryAllUserCodes?: boolean;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Some SET-type commands optimistically update the current value to match the target value
|
|
32
|
-
* when the device acknowledges the command.
|
|
33
|
-
*
|
|
34
|
-
* While this generally makes UIs feel more responsive, it is not necessary for devices which report their status
|
|
35
|
-
* on their own and can lead to confusing behavior when dealing with slow devices like blinds.
|
|
36
|
-
*
|
|
37
|
-
* To disable the optimistic update, set this option to `true`.
|
|
38
|
-
* Default: `false`
|
|
39
|
-
*/
|
|
40
|
-
disableOptimisticValueUpdate?: boolean;
|
|
41
|
-
preferences?: {
|
|
42
|
-
/**
|
|
43
|
-
* The preferred scales to use when querying sensors. The key is either:
|
|
44
|
-
* - the name of a named scale group, e.g. "temperature", which applies to every sensor type that uses this scale group.
|
|
45
|
-
* - or the numeric sensor type to specify the scale for a single sensor type
|
|
46
|
-
*
|
|
47
|
-
* Single-type preferences have a higher priority than named ones. For example, the following preference
|
|
48
|
-
* ```js
|
|
49
|
-
* {
|
|
50
|
-
* temperature: "°F",
|
|
51
|
-
* 0x01: "°C",
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
* will result in using the Fahrenheit scale for all temperature sensors, except the air temperature (0x01).
|
|
55
|
-
*
|
|
56
|
-
* The value must match what is defined in the sensor type config file and contain either:
|
|
57
|
-
* - the label (e.g. "Celsius", "Fahrenheit")
|
|
58
|
-
* - the unit (e.g. "°C", "°F")
|
|
59
|
-
* - or the numeric key of the scale (e.g. 0 or 1).
|
|
60
|
-
*
|
|
61
|
-
* Default:
|
|
62
|
-
* ```js
|
|
63
|
-
* {
|
|
64
|
-
* temperature: "Celsius"
|
|
65
|
-
* }
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
scales: Partial<Record<string | number, string | number>>;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=ZWaveHostOptions.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var ZWaveHostOptions_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(ZWaveHostOptions_exports);
|
|
17
|
-
//# sourceMappingURL=ZWaveHostOptions.js.map
|
package/build/cjs/index_safe.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var index_safe_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(index_safe_exports);
|
|
18
|
-
__reExport(index_safe_exports, require("./ZWaveHost.js"), module.exports);
|
|
19
|
-
__reExport(index_safe_exports, require("./ZWaveHostOptions.js"), module.exports);
|
|
20
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
-
0 && (module.exports = {
|
|
22
|
-
...require("./ZWaveHost.js"),
|
|
23
|
-
...require("./ZWaveHostOptions.js")
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=index_safe.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index_safe.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/consistent-type-exports */\n/* @forbiddenImports external */\n\nexport * from \"./ZWaveHost.js\";\nexport * from \"./ZWaveHostOptions.js\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;;AAGA,+BAAc,2BAHd;AAIA,+BAAc,kCAJd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/build/esm/ZWaveHost.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { DeviceConfig } from "@zwave-js/config";
|
|
2
|
-
import type { CCId, CommandClasses, ControllerLogger, FrameType, MaybeNotKnown, NodeId, SecurityClass, SecurityManagers, SendCommandOptions, SendCommandReturnType, ValueDB, ValueID } from "@zwave-js/core";
|
|
3
|
-
import type { ZWaveHostOptions } from "./ZWaveHostOptions.js";
|
|
4
|
-
/** Allows querying the home ID and node ID of the host */
|
|
5
|
-
export interface HostIDs {
|
|
6
|
-
/** The ID of this node in the current network */
|
|
7
|
-
ownNodeId: number;
|
|
8
|
-
/** The Home ID of the current network */
|
|
9
|
-
homeId: number;
|
|
10
|
-
}
|
|
11
|
-
/** Allows querying device configuration for a node */
|
|
12
|
-
export interface GetDeviceConfig {
|
|
13
|
-
getDeviceConfig(nodeId: number): DeviceConfig | undefined;
|
|
14
|
-
}
|
|
15
|
-
export interface GetSupportedCCVersion {
|
|
16
|
-
/**
|
|
17
|
-
* Retrieves the maximum version of a command class the given node/endpoint has reported support for.
|
|
18
|
-
* Returns 0 when the CC is not supported or that information is not known yet.
|
|
19
|
-
*/
|
|
20
|
-
getSupportedCCVersion(cc: CommandClasses, nodeId: number, endpointIndex?: number): number;
|
|
21
|
-
}
|
|
22
|
-
export interface GetSafeCCVersion {
|
|
23
|
-
/**
|
|
24
|
-
* Retrieves the maximum version of a command class that can be used to communicate with a node.
|
|
25
|
-
* Returns 1 if the node claims that it does not support a CC.
|
|
26
|
-
* Returns `undefined` for CCs that are not implemented in this library yet.
|
|
27
|
-
*/
|
|
28
|
-
getSafeCCVersion(cc: CommandClasses, nodeId: number, endpointIndex?: number): number | undefined;
|
|
29
|
-
}
|
|
30
|
-
/** Additional context needed for deserializing CCs */
|
|
31
|
-
export interface CCParsingContext extends Readonly<SecurityManagers>, GetDeviceConfig, HostIDs {
|
|
32
|
-
sourceNodeId: number;
|
|
33
|
-
__internalIsMockNode?: boolean;
|
|
34
|
-
/** If known, the frame type of the containing message */
|
|
35
|
-
frameType: FrameType;
|
|
36
|
-
getHighestSecurityClass(nodeId: number): MaybeNotKnown<SecurityClass>;
|
|
37
|
-
hasSecurityClass(nodeId: number, securityClass: SecurityClass): MaybeNotKnown<boolean>;
|
|
38
|
-
setSecurityClass(nodeId: number, securityClass: SecurityClass, granted: boolean): void;
|
|
39
|
-
}
|
|
40
|
-
/** Additional context needed for serializing CCs */
|
|
41
|
-
export interface CCEncodingContext extends Readonly<SecurityManagers>, GetDeviceConfig, HostIDs, GetSupportedCCVersion {
|
|
42
|
-
getHighestSecurityClass(nodeId: number): MaybeNotKnown<SecurityClass>;
|
|
43
|
-
hasSecurityClass(nodeId: number, securityClass: SecurityClass): MaybeNotKnown<boolean>;
|
|
44
|
-
setSecurityClass(nodeId: number, securityClass: SecurityClass, granted: boolean): void;
|
|
45
|
-
}
|
|
46
|
-
/** Host application abstractions that provide support for reading and writing values to a database */
|
|
47
|
-
export interface GetValueDB {
|
|
48
|
-
/** Returns the value DB which belongs to the node with the given ID, or throws if the Value DB cannot be accessed */
|
|
49
|
-
getValueDB(nodeId: number): ValueDB;
|
|
50
|
-
/** Returns the value DB which belongs to the node with the given ID, or `undefined` if the Value DB cannot be accessed */
|
|
51
|
-
tryGetValueDB(nodeId: number): ValueDB | undefined;
|
|
52
|
-
}
|
|
53
|
-
/** Allows accessing a specific node */
|
|
54
|
-
export interface GetNode<T extends NodeId> {
|
|
55
|
-
getNode(nodeId: number): T | undefined;
|
|
56
|
-
getNodeOrThrow(nodeId: number): T;
|
|
57
|
-
}
|
|
58
|
-
/** Allows accessing all nodes */
|
|
59
|
-
export interface GetAllNodes<T extends NodeId> {
|
|
60
|
-
getAllNodes(): T[];
|
|
61
|
-
}
|
|
62
|
-
/** Allows looking up Z-Wave manufacturers by manufacturer ID */
|
|
63
|
-
export interface LookupManufacturer {
|
|
64
|
-
/** Looks up the name of the manufacturer with the given ID in the configuration DB */
|
|
65
|
-
lookupManufacturer(manufacturerId: number): string | undefined;
|
|
66
|
-
}
|
|
67
|
-
/** Allows sending commands to one or more nodes */
|
|
68
|
-
export interface SendCommand {
|
|
69
|
-
sendCommand<TResponse extends CCId | undefined = undefined>(command: CCId, options?: SendCommandOptions): Promise<SendCommandReturnType<TResponse>>;
|
|
70
|
-
}
|
|
71
|
-
/** Allows reading options to use for interviewing devices */
|
|
72
|
-
export interface GetInterviewOptions {
|
|
73
|
-
getInterviewOptions(): ZWaveHostOptions["interview"];
|
|
74
|
-
}
|
|
75
|
-
/** Allows reading user preferences */
|
|
76
|
-
export interface GetUserPreferences {
|
|
77
|
-
getUserPreferences(): ZWaveHostOptions["preferences"];
|
|
78
|
-
}
|
|
79
|
-
/** Allows reading user preferences */
|
|
80
|
-
export interface GetCommunicationTimeouts {
|
|
81
|
-
getCommunicationTimeouts(): ZWaveHostOptions["timeouts"];
|
|
82
|
-
}
|
|
83
|
-
export type LogNode = Pick<ControllerLogger, "logNode">;
|
|
84
|
-
/** Allows scheduling a value refresh (poll) for a later time */
|
|
85
|
-
export interface SchedulePoll {
|
|
86
|
-
schedulePoll(nodeId: number, valueId: ValueID, options: NodeSchedulePollOptions): boolean;
|
|
87
|
-
}
|
|
88
|
-
export interface NodeSchedulePollOptions {
|
|
89
|
-
/** The timeout after which the poll is to be scheduled */
|
|
90
|
-
timeoutMs?: number;
|
|
91
|
-
/**
|
|
92
|
-
* The expected value that's should be verified with this poll.
|
|
93
|
-
* When this value is received in the meantime, the poll will be cancelled.
|
|
94
|
-
*/
|
|
95
|
-
expectedValue?: unknown;
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=ZWaveHost.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveHost.d.ts","sourceRoot":"","sources":["../../src/ZWaveHost.ts"],"names":[],"mappings":"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"}
|
package/build/esm/ZWaveHost.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveHost.js","sourceRoot":"","sources":["../../src/ZWaveHost.ts"],"names":[],"mappings":""}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export interface ZWaveHostOptions {
|
|
2
|
-
/** Specify timeouts in milliseconds */
|
|
3
|
-
timeouts: {
|
|
4
|
-
/**
|
|
5
|
-
* How long to wait for a poll after setting a value without transition duration
|
|
6
|
-
*/
|
|
7
|
-
refreshValue: number;
|
|
8
|
-
/**
|
|
9
|
-
* How long to wait for a poll after setting a value with transition duration. This doubles as the "fast" delay.
|
|
10
|
-
*/
|
|
11
|
-
refreshValueAfterTransition: number;
|
|
12
|
-
};
|
|
13
|
-
attempts: {
|
|
14
|
-
/** How often the driver should try communication with the controller before giving up */
|
|
15
|
-
controller: number;
|
|
16
|
-
/** How often the driver should try sending SendData commands before giving up */
|
|
17
|
-
sendData: number;
|
|
18
|
-
/**
|
|
19
|
-
* How many attempts should be made for each node interview before giving up
|
|
20
|
-
*/
|
|
21
|
-
nodeInterview: number;
|
|
22
|
-
};
|
|
23
|
-
interview?: {
|
|
24
|
-
/**
|
|
25
|
-
* Whether all user code should be queried during the interview of the UserCode CC.
|
|
26
|
-
* Note that enabling this can cause a lot of traffic during the interview.
|
|
27
|
-
*/
|
|
28
|
-
queryAllUserCodes?: boolean;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Some SET-type commands optimistically update the current value to match the target value
|
|
32
|
-
* when the device acknowledges the command.
|
|
33
|
-
*
|
|
34
|
-
* While this generally makes UIs feel more responsive, it is not necessary for devices which report their status
|
|
35
|
-
* on their own and can lead to confusing behavior when dealing with slow devices like blinds.
|
|
36
|
-
*
|
|
37
|
-
* To disable the optimistic update, set this option to `true`.
|
|
38
|
-
* Default: `false`
|
|
39
|
-
*/
|
|
40
|
-
disableOptimisticValueUpdate?: boolean;
|
|
41
|
-
preferences?: {
|
|
42
|
-
/**
|
|
43
|
-
* The preferred scales to use when querying sensors. The key is either:
|
|
44
|
-
* - the name of a named scale group, e.g. "temperature", which applies to every sensor type that uses this scale group.
|
|
45
|
-
* - or the numeric sensor type to specify the scale for a single sensor type
|
|
46
|
-
*
|
|
47
|
-
* Single-type preferences have a higher priority than named ones. For example, the following preference
|
|
48
|
-
* ```js
|
|
49
|
-
* {
|
|
50
|
-
* temperature: "°F",
|
|
51
|
-
* 0x01: "°C",
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
* will result in using the Fahrenheit scale for all temperature sensors, except the air temperature (0x01).
|
|
55
|
-
*
|
|
56
|
-
* The value must match what is defined in the sensor type config file and contain either:
|
|
57
|
-
* - the label (e.g. "Celsius", "Fahrenheit")
|
|
58
|
-
* - the unit (e.g. "°C", "°F")
|
|
59
|
-
* - or the numeric key of the scale (e.g. 0 or 1).
|
|
60
|
-
*
|
|
61
|
-
* Default:
|
|
62
|
-
* ```js
|
|
63
|
-
* {
|
|
64
|
-
* temperature: "Celsius"
|
|
65
|
-
* }
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
scales: Partial<Record<string | number, string | number>>;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=ZWaveHostOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveHostOptions.d.ts","sourceRoot":"","sources":["../../src/ZWaveHostOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAChC,uCAAuC;IACvC,QAAQ,EAAE;QACT;;WAEG;QACH,YAAY,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,2BAA2B,EAAE,MAAM,CAAC;KACpC,CAAC;IAEF,QAAQ,EAAE;QACT,yFAAyF;QACzF,UAAU,EAAE,MAAM,CAAC;QAEnB,iFAAiF;QACjF,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,aAAa,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF,SAAS,CAAC,EAAE;QACX;;;WAGG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;IAEF;;;;;;;;;OASG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IAEvC,WAAW,CAAC,EAAE;QACb;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;QACH,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;KAC1D,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveHostOptions.js","sourceRoot":"","sources":["../../src/ZWaveHostOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index_safe.d.ts","sourceRoot":"","sources":["../../src/index_safe.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
|
package/build/esm/index_safe.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index_safe.js","sourceRoot":"","sources":["../../src/index_safe.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gCAAgC;AAEhC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
|