Skip to content

Commit

Permalink
Add node.waitForWakeup command (#652)
Browse files Browse the repository at this point in the history
* Add waitForWakeup command

* Missed commit
  • Loading branch information
raman325 authored Jun 19, 2022
1 parent eb8ea5c commit ed25db7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,18 @@ interface {
}
```

#### [Get Firmware Update Capabilities](https://zwave-js.github.io/node-zwave-js/#/api/node?id=getfirmwareupdatecapabilities)

[compatible with schema version: 0+]

```ts
interface {
messageId: string;
command: "node.get_firmware_update_capabilities";
nodeId: number;
}
```

#### [Poll value](https://zwave-js.github.io/node-zwave-js/#/api/node?id=pollvalue)

[compatible with schema version: 1+]
Expand Down Expand Up @@ -694,6 +706,18 @@ interface {
}
```

#### [Wait for wakeup](https://zwave-js.github.io/node-zwave-js/#/api/node?id=waitforwakeup)

[compatible with schema version: 18+]

```ts
interface {
messageId: string;
nodeId: number;
command: "node.wait_for_wakeup";
}
```

### Endpoint level commands

#### [Invoke a Command Classes API method](https://zwave-js.github.io/node-zwave-js/#/api/endpoint?id=invokeccapi)
Expand Down
1 change: 1 addition & 0 deletions src/lib/node/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export enum NodeCommand {
setLocation = "node.set_location",
setKeepAwake = "node.set_keep_awake",
getFirmwareUpdateProgress = "node.get_firmware_update_progress",
waitForWakeup = "node.wait_for_wakeup",
}
7 changes: 6 additions & 1 deletion src/lib/node/incoming_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export interface IncomingCommandGetFirmwareUpdateInProgress
command: NodeCommand.getFirmwareUpdateProgress;
}

export interface IncomingCommandWaitForWakeup extends IncomingCommandNodeBase {
command: NodeCommand.waitForWakeup;
}

export type IncomingMessageNode =
| IncomingCommandNodeSetValue
| IncomingCommandNodeRefreshInfo
Expand All @@ -185,4 +189,5 @@ export type IncomingMessageNode =
| IncomingCommandSetName
| IncomingCommandSetLocation
| IncomingCommandSetKeepAwake
| IncomingCommandGetFirmwareUpdateInProgress;
| IncomingCommandGetFirmwareUpdateInProgress
| IncomingCommandWaitForWakeup;
4 changes: 3 additions & 1 deletion src/lib/node/message_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export class NodeMessageHandler {
);
}
this.firmwareUpdateProgress[nodeId] = true;

return {};
case NodeCommand.abortFirmwareUpdate:
await node.abortFirmwareUpdate();
Expand Down Expand Up @@ -215,6 +214,9 @@ export class NodeMessageHandler {
return {
progress: this.firmwareUpdateProgress[nodeId] === true,
};
case NodeCommand.waitForWakeup:
await node.waitForWakeup();
return {};
default:
throw new UnknownCommandError(command);
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/node/outgoing_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ export interface NodeResultTypes {
[NodeCommand.setLocation]: Record<string, never>;
[NodeCommand.setKeepAwake]: Record<string, never>;
[NodeCommand.getFirmwareUpdateProgress]: { progress: boolean };
[NodeCommand.waitForWakeup]: Record<string, never>;
}

0 comments on commit ed25db7

Please sign in to comment.