Skip to content

Commit e993b16

Browse files
authoredJun 16, 2024··
Bump zwave-js to 12.11.0 and add new commands (#1222)
1 parent 7b436f1 commit e993b16

12 files changed

+171
-94
lines changed
 

‎API_SCHEMA.md

+1
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ Base schema.
6565
- Added `maxLongRangePowerlevel`, `longRangeChannel`, and `supportsLongRangeAutoChannelSelection` to controller state dump
6666
- Added commands for controller methods `getMaxLongRangePowerlevel`, `setMaxLongRangePowerlevel`, `getLongRangeChannel`, and `setLongRangeChannel`
6767
- Removed deprecated `mandatoryControlledCCs` and `mandatorySupportedCCs` properties from device class dump
68+
- Added commands for `node.createDump` and `driver.sendTestFrame`

‎README.md

+47
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,42 @@ interface {
397397
}
398398
```
399399

400+
#### [Shutdown the Z-Wave API on the controller](https://zwave-js.github.io/node-zwave-js/#/api/driver?id=shutdown)
401+
402+
[compatible with schema version: 36+]
403+
404+
```ts
405+
interface {
406+
messageId: string;
407+
command: "driver.shutdown";
408+
}
409+
```
410+
411+
#### [Update driver options](https://zwave-js.github.io/node-zwave-js/#/api/driver?id=updateoptions)
412+
413+
[compatible with schema version: 36+]
414+
415+
```ts
416+
interface {
417+
messageId: string;
418+
command: "driver.update_options";
419+
options: EditableZWaveOptions;
420+
}
421+
```
422+
423+
#### [Send test frame to node](https://zwave-js.github.io/node-zwave-js/#/api/driver?id=sendtestframe)
424+
425+
[compatible with schema version: 36+]
426+
427+
```ts
428+
interface {
429+
messageId: string;
430+
command: "driver.send_test_frame";
431+
nodeId: number;
432+
powerlevel: Powerlevel;
433+
}
434+
```
435+
400436
### Controller level commands
401437

402438
`zwave-js-server` supports all of the controller methods listed in the [Z-Wave JS documentation](https://zwave-js.github.io/node-zwave-js/#/api/controller?id=controller-methods). `zwave-js-server` uses [snake casing](https://en.wikipedia.org/wiki/Snake_case) for commands and prefixes every controller command with `controller.`, so `beginInclusion` is called using the `controller.begin_inclusion` command.
@@ -946,6 +982,17 @@ interface {
946982
}
947983
```
948984

985+
#### [Dump node debug data](https://zwave-js.github.io/node-zwave-js/#/api/CCs/Configuration?id=createdump)
986+
987+
[compatible with schema version: 36+]
988+
989+
```ts
990+
interface {
991+
messageId: string;
992+
command: "node.create_dump";
993+
}
994+
```
995+
949996
### Endpoint level commands
950997

951998
#### [Invoke a Command Classes API method](https://zwave-js.github.io/node-zwave-js/#/api/endpoint?id=invokeccapi)

‎package-lock.json

+90-88
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"ws": "^8.13.0"
3535
},
3636
"peerDependencies": {
37-
"zwave-js": "^12.9.0"
37+
"zwave-js": "^12.11.0"
3838
},
3939
"devDependencies": {
4040
"@tsconfig/node18": "^18.2.1",
@@ -54,7 +54,7 @@
5454
"semver": "^7.5.4",
5555
"ts-node": "^10.9.2",
5656
"typescript": "^5.3.3",
57-
"zwave-js": "^12.9.0"
57+
"zwave-js": "^12.11.0"
5858
},
5959
"husky": {
6060
"hooks": {

‎src/lib/driver/command.ts

+1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export enum DriverCommand {
1616
hardReset = "driver.hard_reset",
1717
shutdown = "driver.shutdown",
1818
updateOptions = "driver.update_options",
19+
sendTestFrame = "driver.send_test_frame",
1920
}

‎src/lib/driver/incoming_message.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { LogConfig } from "@zwave-js/core";
22
import { DriverCommand } from "./command";
33
import { IncomingCommandBase } from "../incoming_message_base";
4-
import { EditableZWaveOptions, ZWaveOptions } from "zwave-js";
4+
import { EditableZWaveOptions, Powerlevel, ZWaveOptions } from "zwave-js";
55
import { LogContexts } from "../logging";
66

77
interface IncomingCommandGetConfig extends IncomingCommandBase {
@@ -78,6 +78,12 @@ interface IncomingCommandUpdateOptions extends IncomingCommandBase {
7878
options: EditableZWaveOptions;
7979
}
8080

81+
interface IncomingCommandSendTestFrame extends IncomingCommandBase {
82+
command: DriverCommand.sendTestFrame;
83+
nodeId: number;
84+
powerlevel: Powerlevel;
85+
}
86+
8187
export type IncomingMessageDriver =
8288
| IncomingCommandGetConfig
8389
| IncomingCommandUpdateLogConfig
@@ -95,4 +101,5 @@ export type IncomingMessageDriver =
95101
| IncomingCommandTrySoftReset
96102
| IncomingCommandHardReset
97103
| IncomingCommandShutdown
98-
| IncomingCommandUpdateOptions;
104+
| IncomingCommandUpdateOptions
105+
| IncomingCommandSendTestFrame;

‎src/lib/driver/message_handler.ts

+7
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ export class DriverMessageHandler {
113113
driver.updateOptions(message.options);
114114
return {};
115115
}
116+
case DriverCommand.sendTestFrame: {
117+
const status = await driver.sendTestFrame(
118+
message.nodeId,
119+
message.powerlevel,
120+
);
121+
return { status };
122+
}
116123
default: {
117124
throw new UnknownCommandError(command);
118125
}

‎src/lib/driver/outgoing_message.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LogConfig } from "@zwave-js/core";
1+
import { LogConfig, TransmitStatus } from "@zwave-js/core";
22
import { DriverState } from "../state";
33
import { DriverCommand } from "./command";
44

@@ -24,4 +24,5 @@ export interface DriverResultTypes {
2424
[DriverCommand.hardReset]: Record<string, never>;
2525
[DriverCommand.shutdown]: { success: boolean };
2626
[DriverCommand.updateOptions]: Record<string, never>;
27+
[DriverCommand.sendTestFrame]: { status?: TransmitStatus };
2728
}

‎src/lib/node/command.ts

+1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ export enum NodeCommand {
3838
setDefaultVolume = "node.set_default_volume",
3939
setDefaultTransitionDuration = "node.set_default_transition_duration",
4040
hasDeviceConfigChanged = "node.has_device_config_changed",
41+
createDump = "node.create_dump",
4142
}

‎src/lib/node/incoming_message.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ export interface IncomingCommandNodeHasDeviceConfigChanged
241241
command: NodeCommand.hasDeviceConfigChanged;
242242
}
243243

244+
export interface IncomingCommandNodeCreateDump extends IncomingCommandNodeBase {
245+
command: NodeCommand.createDump;
246+
}
247+
244248
export type IncomingMessageNode =
245249
| IncomingCommandNodeSetValue
246250
| IncomingCommandNodeRefreshInfo
@@ -279,4 +283,5 @@ export type IncomingMessageNode =
279283
| IncomingCommandNodeAbortHealthCheck
280284
| IncomingCommandNodeSetDefaultVolume
281285
| IncomingCommandNodeSetDefaultTransitionDuration
282-
| IncomingCommandNodeHasDeviceConfigChanged;
286+
| IncomingCommandNodeHasDeviceConfigChanged
287+
| IncomingCommandNodeCreateDump;

‎src/lib/node/message_handler.ts

+4
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ export class NodeMessageHandler {
302302
const changed = node.hasDeviceConfigChanged();
303303
return { changed };
304304
}
305+
case NodeCommand.createDump: {
306+
const dump = node.createDump();
307+
return { dump };
308+
}
305309
default: {
306310
throw new UnknownCommandError(command);
307311
}

‎src/lib/node/outgoing_message.ts

+1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ export interface NodeResultTypes {
6161
[NodeCommand.setDefaultVolume]: Record<string, never>;
6262
[NodeCommand.setDefaultTransitionDuration]: Record<string, never>;
6363
[NodeCommand.hasDeviceConfigChanged]: { changed: MaybeNotKnown<boolean> };
64+
[NodeCommand.createDump]: { dump: object }; // TODO: Fix type
6465
}

0 commit comments

Comments
 (0)
Please sign in to comment.