@zwave-js/host 9.6.3-0-pr-4887-2ae9538 → 10.0.0-beta.10
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/ZWaveHost.d.ts +48 -35
- package/build/ZWaveHost.d.ts.map +1 -1
- package/build/ZWaveHostOptions.d.ts +78 -0
- package/build/ZWaveHostOptions.d.ts.map +1 -0
- package/build/{ZWaveNodeBase.js → ZWaveHostOptions.js} +1 -1
- package/build/ZWaveHostOptions.js.map +1 -0
- package/build/index.d.ts +1 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -2
- package/build/index.js.map +1 -1
- package/build/index_safe.d.ts +1 -2
- package/build/index_safe.d.ts.map +1 -1
- package/build/index_safe.js +2 -3
- package/build/index_safe.js.map +1 -1
- package/build/mocks.d.ts +5 -5
- package/build/mocks.d.ts.map +1 -1
- package/build/mocks.js +52 -21
- package/build/mocks.js.map +1 -1
- package/package.json +10 -8
- package/build/ZWaveEndpointBase.d.ts +0 -10
- package/build/ZWaveEndpointBase.d.ts.map +0 -1
- package/build/ZWaveEndpointBase.js +0 -3
- package/build/ZWaveEndpointBase.js.map +0 -1
- package/build/ZWaveNodeBase.d.ts +0 -16
- package/build/ZWaveNodeBase.d.ts.map +0 -1
- package/build/ZWaveNodeBase.js.map +0 -1
package/build/ZWaveHost.d.ts
CHANGED
|
@@ -1,42 +1,17 @@
|
|
|
1
|
-
import type { ConfigManager } from "@zwave-js/config";
|
|
2
|
-
import type { CommandClasses, ControllerLogger, SecurityManager, SecurityManager2, ValueDB } from "@zwave-js/core";
|
|
1
|
+
import type { ConfigManager, DeviceConfig } from "@zwave-js/config";
|
|
2
|
+
import type { CommandClasses, ControllerLogger, ICommandClass, IZWaveNode, Maybe, SecurityClass, SecurityManager, SecurityManager2, SendCommandOptions, SendCommandReturnType, ValueDB, ValueID } from "@zwave-js/core";
|
|
3
3
|
import type { ReadonlyThrowingMap } from "@zwave-js/shared";
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Some Command Classes support reporting that a value is unknown.
|
|
8
|
-
* When this flag is `false`, unknown values are exposed as `undefined`.
|
|
9
|
-
* When it is `true`, unknown values are exposed as the literal string "unknown" (even if the value is normally numeric).
|
|
10
|
-
* Default: `false`
|
|
11
|
-
*/
|
|
12
|
-
preserveUnknownValues?: boolean;
|
|
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
|
-
}
|
|
24
|
-
/** Host application abstractions to be used in Serial API and CC implemenations */
|
|
4
|
+
import type { ZWaveHostOptions } from "./ZWaveHostOptions";
|
|
5
|
+
/** Host application abstractions to be used in Serial API and CC implementations */
|
|
25
6
|
export interface ZWaveHost {
|
|
26
|
-
controllerLog: ControllerLogger;
|
|
27
|
-
/** Gives access to the configuration files */
|
|
28
|
-
configManager: ConfigManager;
|
|
29
|
-
/** Management of Security S0 keys and nonces */
|
|
30
|
-
securityManager: SecurityManager | undefined;
|
|
31
|
-
/** Management of Security S2 keys and nonces */
|
|
32
|
-
securityManager2: SecurityManager2 | undefined;
|
|
33
7
|
/** The ID of this node in the current network */
|
|
34
8
|
ownNodeId: number;
|
|
35
9
|
/** The Home ID of the current network */
|
|
36
10
|
homeId: number;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
11
|
+
/** Management of Security S0 keys and nonces */
|
|
12
|
+
securityManager: SecurityManager | undefined;
|
|
13
|
+
/** Management of Security S2 keys and nonces */
|
|
14
|
+
securityManager2: SecurityManager2 | undefined;
|
|
40
15
|
/**
|
|
41
16
|
* Retrieves the maximum version of a command class that can be used to communicate with a node.
|
|
42
17
|
* Returns 1 if the node claims that it does not support a CC.
|
|
@@ -44,11 +19,49 @@ export interface ZWaveHost {
|
|
|
44
19
|
*/
|
|
45
20
|
getSafeCCVersionForNode(cc: CommandClasses, nodeId: number, endpointIndex?: number): number;
|
|
46
21
|
/**
|
|
47
|
-
*
|
|
22
|
+
* Determines whether a CC must be secure for a given node and endpoint.
|
|
23
|
+
*/
|
|
24
|
+
isCCSecure(cc: CommandClasses, nodeId: number, endpointIndex?: number): boolean;
|
|
25
|
+
getHighestSecurityClass(nodeId: number): SecurityClass | undefined;
|
|
26
|
+
hasSecurityClass(nodeId: number, securityClass: SecurityClass): Maybe<boolean>;
|
|
27
|
+
setSecurityClass(nodeId: number, securityClass: SecurityClass, granted: boolean): void;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the next callback ID. Callback IDs are used to correlate requests
|
|
48
30
|
* to the controller/nodes with its response
|
|
49
31
|
*/
|
|
50
32
|
getNextCallbackId(): number;
|
|
51
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Returns the next session ID for supervised communication
|
|
35
|
+
*/
|
|
36
|
+
getNextSupervisionSessionId(): number;
|
|
37
|
+
getDeviceConfig?: (nodeId: number) => DeviceConfig | undefined;
|
|
38
|
+
__internalIsMockNode?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** A more featureful version of the ZWaveHost interface, which is meant to be used on the controller application side. */
|
|
41
|
+
export interface ZWaveApplicationHost extends ZWaveHost {
|
|
42
|
+
/** Gives access to the configuration files */
|
|
43
|
+
configManager: ConfigManager;
|
|
44
|
+
options: ZWaveHostOptions;
|
|
45
|
+
controllerLog: ControllerLogger;
|
|
46
|
+
/** Returns the value DB which belongs to the node with the given ID, or throws if the Value DB cannot be accessed */
|
|
52
47
|
getValueDB(nodeId: number): ValueDB;
|
|
48
|
+
/** Returns the value DB which belongs to the node with the given ID, or `undefined` if the Value DB cannot be accessed */
|
|
49
|
+
tryGetValueDB(nodeId: number): ValueDB | undefined;
|
|
50
|
+
/** Readonly access to all node instances known to the host */
|
|
51
|
+
nodes: ReadonlyThrowingMap<number, IZWaveNode>;
|
|
52
|
+
/** Whether the node with the given ID is the controller */
|
|
53
|
+
isControllerNode(nodeId: number): boolean;
|
|
54
|
+
sendCommand<TResponse extends ICommandClass | undefined = undefined>(command: ICommandClass, options?: SendCommandOptions): Promise<SendCommandReturnType<TResponse>>;
|
|
55
|
+
waitForCommand<T extends ICommandClass>(predicate: (cc: ICommandClass) => boolean, timeout: number): Promise<T>;
|
|
56
|
+
schedulePoll(nodeId: number, valueId: ValueID, options: NodeSchedulePollOptions): boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface NodeSchedulePollOptions {
|
|
59
|
+
/** The timeout after which the poll is to be scheduled */
|
|
60
|
+
timeoutMs?: number;
|
|
61
|
+
/**
|
|
62
|
+
* The expected value that's should be verified with this poll.
|
|
63
|
+
* When this value is received in the meantime, the poll will be cancelled.
|
|
64
|
+
*/
|
|
65
|
+
expectedValue?: unknown;
|
|
53
66
|
}
|
|
54
67
|
//# sourceMappingURL=ZWaveHost.d.ts.map
|
package/build/ZWaveHost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveHost.d.ts","sourceRoot":"","sources":["../src/ZWaveHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ZWaveHost.d.ts","sourceRoot":"","sources":["../src/ZWaveHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,OAAO,EACP,OAAO,EACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE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,qHAAqH;IACrH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAEpC,0HAA0H;IAC1H,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAEnD,8DAA8D;IAC9D,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAE/C,2DAA2D;IAC3D,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAE1C,WAAW,CAAC,SAAS,SAAS,aAAa,GAAG,SAAS,GAAG,SAAS,EAClE,OAAO,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC;IAE7C,cAAc,CAAC,CAAC,SAAS,aAAa,EACrC,SAAS,EAAE,CAAC,EAAE,EAAE,aAAa,KAAK,OAAO,EACzC,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd,YAAY,CACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,uBAAuB,GAC9B,OAAO,CAAC;CACX;AAED,MAAM,WAAW,uBAAuB;IACvC,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 Command Classes support reporting that a value is unknown.
|
|
32
|
+
* When this flag is `false`, unknown values are exposed as `undefined`.
|
|
33
|
+
* When it is `true`, unknown values are exposed as the literal string "unknown" (even if the value is normally numeric).
|
|
34
|
+
* Default: `false`
|
|
35
|
+
*/
|
|
36
|
+
preserveUnknownValues?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Some SET-type commands optimistically update the current value to match the target value
|
|
39
|
+
* when the device acknowledges the command.
|
|
40
|
+
*
|
|
41
|
+
* While this generally makes UIs feel more responsive, it is not necessary for devices which report their status
|
|
42
|
+
* on their own and can lead to confusing behavior when dealing with slow devices like blinds.
|
|
43
|
+
*
|
|
44
|
+
* To disable the optimistic update, set this option to `true`.
|
|
45
|
+
* Default: `false`
|
|
46
|
+
*/
|
|
47
|
+
disableOptimisticValueUpdate?: boolean;
|
|
48
|
+
preferences?: {
|
|
49
|
+
/**
|
|
50
|
+
* The preferred scales to use when querying sensors. The key is either:
|
|
51
|
+
* - the name of a named scale group, e.g. "temperature", which applies to every sensor type that uses this scale group.
|
|
52
|
+
* - or the numeric sensor type to specify the scale for a single sensor type
|
|
53
|
+
*
|
|
54
|
+
* Single-type preferences have a higher priority than named ones. For example, the following preference
|
|
55
|
+
* ```js
|
|
56
|
+
* {
|
|
57
|
+
* temperature: "°F",
|
|
58
|
+
* 0x01: "°C",
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
* will result in using the Fahrenheit scale for all temperature sensors, except the air temperature (0x01).
|
|
62
|
+
*
|
|
63
|
+
* The value must match what is defined in the sensor type config file and contain either:
|
|
64
|
+
* - the label (e.g. "Celsius", "Fahrenheit")
|
|
65
|
+
* - the unit (e.g. "°C", "°F")
|
|
66
|
+
* - or the numeric key of the scale (e.g. 0 or 1).
|
|
67
|
+
*
|
|
68
|
+
* Default:
|
|
69
|
+
* ```js
|
|
70
|
+
* {
|
|
71
|
+
* temperature: "Celsius"
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
scales: Partial<Record<string | number, string | number>>;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=ZWaveHostOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;;;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZWaveHostOptions.js","sourceRoot":"","sources":["../src/ZWaveHostOptions.ts"],"names":[],"mappings":""}
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./FileSystem"), exports);
|
|
18
18
|
__exportStar(require("./mocks"), exports);
|
|
19
|
-
__exportStar(require("./ZWaveEndpointBase"), exports);
|
|
20
19
|
__exportStar(require("./ZWaveHost"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./ZWaveHostOptions"), exports);
|
|
22
21
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,0CAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,0CAAwB;AACxB,8CAA4B;AAC5B,qDAAmC"}
|
package/build/index_safe.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index_safe.d.ts","sourceRoot":"","sources":["../src/index_safe.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index_safe.d.ts","sourceRoot":"","sources":["../src/index_safe.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
package/build/index_safe.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* @
|
|
2
|
+
/* @forbiddenImports external */
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
__exportStar(require("./FileSystem"), exports);
|
|
19
|
-
__exportStar(require("./ZWaveEndpointBase"), exports);
|
|
20
19
|
__exportStar(require("./ZWaveHost"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./ZWaveHostOptions"), exports);
|
|
22
21
|
//# sourceMappingURL=index_safe.js.map
|
package/build/index_safe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index_safe.js","sourceRoot":"","sources":["../src/index_safe.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"index_safe.js","sourceRoot":"","sources":["../src/index_safe.ts"],"names":[],"mappings":";AAAA,gCAAgC;;;;;;;;;;;;;;;;AAEhC,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC"}
|
package/build/mocks.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { IZWaveNode } from "@zwave-js/core";
|
|
1
2
|
import { type ThrowingMap } from "@zwave-js/shared";
|
|
2
3
|
import type { Overwrite } from "alcalzone-shared/types";
|
|
3
|
-
import type { ZWaveHost } from "./ZWaveHost";
|
|
4
|
-
import type { ZWaveNodeBase } from "./ZWaveNodeBase";
|
|
4
|
+
import type { ZWaveApplicationHost, ZWaveHost } from "./ZWaveHost";
|
|
5
5
|
export interface CreateTestingHostOptions {
|
|
6
6
|
homeId: ZWaveHost["homeId"];
|
|
7
7
|
ownNodeId: ZWaveHost["ownNodeId"];
|
|
8
8
|
getSafeCCVersionForNode: ZWaveHost["getSafeCCVersionForNode"];
|
|
9
9
|
}
|
|
10
|
-
export declare type TestingHost = Overwrite<
|
|
11
|
-
nodes: ThrowingMap<number,
|
|
10
|
+
export declare type TestingHost = Overwrite<Omit<ZWaveApplicationHost, "__internalIsMockNode">, {
|
|
11
|
+
nodes: ThrowingMap<number, IZWaveNode>;
|
|
12
12
|
}>;
|
|
13
|
-
/** Creates a {@link
|
|
13
|
+
/** Creates a {@link ZWaveApplicationHost} that can be used for testing */
|
|
14
14
|
export declare function createTestingHost(options?: Partial<CreateTestingHostOptions>): TestingHost;
|
|
15
15
|
//# sourceMappingURL=mocks.d.ts.map
|
package/build/mocks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../src/mocks.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../src/mocks.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,UAAU,EAKV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5B,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClC,uBAAuB,EAAE,SAAS,CAAC,yBAAyB,CAAC,CAAC;CAC9D;AAED,oBAAY,WAAW,GAAG,SAAS,CAClC,IAAI,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,EAClD;IAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CAAE,CAC1C,CAAC;AAEF,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAChC,OAAO,GAAE,OAAO,CAAC,wBAAwB,CAAM,GAC7C,WAAW,CA2Fb"}
|
package/build/mocks.js
CHANGED
|
@@ -1,35 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTestingHost = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/require-await */
|
|
4
5
|
const config_1 = require("@zwave-js/config");
|
|
5
6
|
const core_1 = require("@zwave-js/core");
|
|
6
7
|
const shared_1 = require("@zwave-js/shared");
|
|
7
|
-
/** Creates a {@link
|
|
8
|
+
/** Creates a {@link ZWaveApplicationHost} that can be used for testing */
|
|
8
9
|
function createTestingHost(options = {}) {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
let callbackId = 0xff;
|
|
11
|
-
const getNextCallbackId = () => {
|
|
12
|
-
callbackId = (callbackId + 1) & 0xff;
|
|
13
|
-
if (callbackId < 1)
|
|
14
|
-
callbackId = 1;
|
|
15
|
-
return callbackId;
|
|
16
|
-
};
|
|
17
10
|
const valuesStorage = new Map();
|
|
18
11
|
const metadataStorage = new Map();
|
|
19
12
|
const valueDBCache = new Map();
|
|
20
13
|
const ret = {
|
|
21
|
-
homeId:
|
|
22
|
-
ownNodeId:
|
|
14
|
+
homeId: options.homeId ?? 0x7e570001,
|
|
15
|
+
ownNodeId: options.ownNodeId ?? 1,
|
|
16
|
+
isControllerNode: (nodeId) => nodeId === ret.ownNodeId,
|
|
23
17
|
securityManager: undefined,
|
|
24
18
|
securityManager2: undefined,
|
|
25
|
-
|
|
26
|
-
attempts: {
|
|
27
|
-
nodeInterview: 1,
|
|
28
|
-
openSerialPort: 1,
|
|
29
|
-
sendData: 3,
|
|
30
|
-
controller: 3,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
19
|
+
getDeviceConfig: undefined,
|
|
33
20
|
controllerLog: new Proxy({}, {
|
|
34
21
|
get() {
|
|
35
22
|
return () => {
|
|
@@ -38,17 +25,61 @@ function createTestingHost(options = {}) {
|
|
|
38
25
|
},
|
|
39
26
|
}),
|
|
40
27
|
configManager: new config_1.ConfigManager(),
|
|
28
|
+
options: {
|
|
29
|
+
attempts: {
|
|
30
|
+
nodeInterview: 1,
|
|
31
|
+
// openSerialPort: 1,
|
|
32
|
+
sendData: 3,
|
|
33
|
+
controller: 3,
|
|
34
|
+
},
|
|
35
|
+
timeouts: {
|
|
36
|
+
refreshValue: 5000,
|
|
37
|
+
refreshValueAfterTransition: 1000,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
41
40
|
nodes: (0, shared_1.createThrowingMap)((nodeId) => {
|
|
42
41
|
throw new core_1.ZWaveError(`Node ${nodeId} was not found!`, core_1.ZWaveErrorCodes.Controller_NodeNotFound);
|
|
43
42
|
}),
|
|
44
|
-
getSafeCCVersionForNode:
|
|
45
|
-
getNextCallbackId,
|
|
43
|
+
getSafeCCVersionForNode: options.getSafeCCVersionForNode ?? (() => 100),
|
|
44
|
+
getNextCallbackId: (0, shared_1.createWrappingCounter)(0xff),
|
|
45
|
+
getNextSupervisionSessionId: (0, shared_1.createWrappingCounter)(core_1.MAX_SUPERVISION_SESSION_ID),
|
|
46
46
|
getValueDB: (nodeId) => {
|
|
47
47
|
if (!valueDBCache.has(nodeId)) {
|
|
48
48
|
valueDBCache.set(nodeId, new core_1.ValueDB(nodeId, valuesStorage, metadataStorage));
|
|
49
49
|
}
|
|
50
50
|
return valueDBCache.get(nodeId);
|
|
51
51
|
},
|
|
52
|
+
tryGetValueDB: (nodeId) => {
|
|
53
|
+
return ret.getValueDB(nodeId);
|
|
54
|
+
},
|
|
55
|
+
isCCSecure: (ccId, nodeId, endpointIndex = 0) => {
|
|
56
|
+
const node = ret.nodes.get(nodeId);
|
|
57
|
+
const endpoint = node?.getEndpoint(endpointIndex);
|
|
58
|
+
return (node?.isSecure !== false &&
|
|
59
|
+
!!(endpoint ?? node)?.isCCSecure(ccId) &&
|
|
60
|
+
!!(ret.securityManager || ret.securityManager2));
|
|
61
|
+
},
|
|
62
|
+
getHighestSecurityClass: (nodeId) => {
|
|
63
|
+
const node = ret.nodes.getOrThrow(nodeId);
|
|
64
|
+
return node.getHighestSecurityClass();
|
|
65
|
+
},
|
|
66
|
+
hasSecurityClass: (nodeId, securityClass) => {
|
|
67
|
+
const node = ret.nodes.getOrThrow(nodeId);
|
|
68
|
+
return node.hasSecurityClass(securityClass);
|
|
69
|
+
},
|
|
70
|
+
setSecurityClass: (nodeId, securityClass, granted) => {
|
|
71
|
+
const node = ret.nodes.getOrThrow(nodeId);
|
|
72
|
+
node.setSecurityClass(securityClass, granted);
|
|
73
|
+
},
|
|
74
|
+
sendCommand: async (_command, _options) => {
|
|
75
|
+
return undefined;
|
|
76
|
+
},
|
|
77
|
+
waitForCommand: async (_predicate, _timeout) => {
|
|
78
|
+
return undefined;
|
|
79
|
+
},
|
|
80
|
+
schedulePoll: (_nodeId, _valueId, _options) => {
|
|
81
|
+
return false;
|
|
82
|
+
},
|
|
52
83
|
};
|
|
53
84
|
return ret;
|
|
54
85
|
}
|
package/build/mocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../src/mocks.ts"],"names":[],"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EAAE,EAAE;YAC3C,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;QAC7C,CAAC;QACD,gBAAgB,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE;YACpD,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QACD,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;YACzC,OAAO,SAAgB,CAAC;QACzB,CAAC;QACD,cAAc,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE;YAC9C,OAAO,SAAgB,CAAC;QACzB,CAAC;QACD,YAAY,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;YAC7C,OAAO,KAAK,CAAC;QACd,CAAC;KACD,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AA7FD,8CA6FC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zwave-js/host",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-beta.10",
|
|
4
4
|
"description": "zwave-js: Host abstractions",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -40,23 +40,25 @@
|
|
|
40
40
|
"url": "https://github.com/sponsors/AlCalzone/"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
|
-
"node": ">=
|
|
43
|
+
"node": ">=14.13.0 <15 || >= 16 <16.9.0 || >16.9.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsc -b tsconfig.build.json --verbose",
|
|
47
|
+
"extract-api": "yarn api-extractor run",
|
|
47
48
|
"clean": "tsc -b tsconfig.build.json --clean",
|
|
48
49
|
"watch": "yarn run build --watch --pretty"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@zwave-js/
|
|
52
|
-
"@zwave-js/
|
|
52
|
+
"@zwave-js/config": "10.0.0-beta.10",
|
|
53
|
+
"@zwave-js/core": "10.0.0-beta.10",
|
|
54
|
+
"@zwave-js/shared": "10.0.0-beta.10",
|
|
53
55
|
"alcalzone-shared": "^4.0.1"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
58
|
+
"@microsoft/api-extractor": "*",
|
|
56
59
|
"@types/jest": "^27.5.2",
|
|
57
|
-
"@types/node": "^14.18.
|
|
60
|
+
"@types/node": "^14.18.23",
|
|
58
61
|
"jest-extended": "^2.0.0",
|
|
59
|
-
"typescript": "4.
|
|
60
|
-
}
|
|
61
|
-
"stableVersion": "9.6.0"
|
|
62
|
+
"typescript": "4.7.4"
|
|
63
|
+
}
|
|
62
64
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { CommandClasses } from "@zwave-js/core";
|
|
2
|
-
export interface ZWaveEndpointBase {
|
|
3
|
-
readonly nodeId: number;
|
|
4
|
-
readonly index: number;
|
|
5
|
-
getCCVersion(cc: CommandClasses): number;
|
|
6
|
-
supportsCC(cc: CommandClasses): boolean;
|
|
7
|
-
controlsCC(cc: CommandClasses): boolean;
|
|
8
|
-
isCCSecure(cc: CommandClasses): boolean;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=ZWaveEndpointBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveEndpointBase.d.ts","sourceRoot":"","sources":["../src/ZWaveEndpointBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,EAAE,cAAc,GAAG,MAAM,CAAC;IACzC,UAAU,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC;CACxC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveEndpointBase.js","sourceRoot":"","sources":["../src/ZWaveEndpointBase.ts"],"names":[],"mappings":""}
|
package/build/ZWaveNodeBase.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { DeviceConfig } from "@zwave-js/config";
|
|
2
|
-
import type { FLiRS, InterviewStage, Maybe, NodeStatus, SecurityClassOwner } from "@zwave-js/core";
|
|
3
|
-
import type { ZWaveEndpointBase } from "./ZWaveEndpointBase";
|
|
4
|
-
export interface ZWaveNodeBase extends ZWaveEndpointBase, SecurityClassOwner {
|
|
5
|
-
readonly id: number;
|
|
6
|
-
isListening: boolean | undefined;
|
|
7
|
-
isFrequentListening: FLiRS | undefined;
|
|
8
|
-
readonly canSleep: boolean | undefined;
|
|
9
|
-
readonly status: NodeStatus;
|
|
10
|
-
interviewStage: InterviewStage;
|
|
11
|
-
deviceConfig?: DeviceConfig;
|
|
12
|
-
getEndpoint(index: 0): ZWaveEndpointBase;
|
|
13
|
-
getEndpoint(index: number): ZWaveEndpointBase | undefined;
|
|
14
|
-
readonly isSecure: Maybe<boolean>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=ZWaveNodeBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveNodeBase.d.ts","sourceRoot":"","sources":["../src/ZWaveNodeBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EACX,KAAK,EACL,cAAc,EACd,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,aAAc,SAAQ,iBAAiB,EAAE,kBAAkB;IAC3E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,mBAAmB,EAAE,KAAK,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B,WAAW,CAAC,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC;IACzC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZWaveNodeBase.js","sourceRoot":"","sources":["../src/ZWaveNodeBase.ts"],"names":[],"mappings":""}
|