Skip to content

Commit

Permalink
Support all signatures of node.manuallyIdleNotificationValue
Browse files Browse the repository at this point in the history
  • Loading branch information
raman325 committed Sep 19, 2024
1 parent 3a7f7a9 commit 9482766
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
4 changes: 4 additions & 0 deletions API_SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ Base schema.
- Added controller `inclusion state changed` event
- Added `config_manager` commands
- Added `zniffer` commands

# Schema 39

- Added support for both overloads of `node.manuallyIdleNotificationValue`
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,21 @@ interface {

#### [Manually Idle Notification CC Value](https://zwave-js.github.io/node-zwave-js/#/api/node?id=manuallyidlenotificationvalue)

[compatible with schema version: 28+]
[compatible with schema version: 39+]

This can be called in one of two ways:

Method 1:

```ts
interface {
messageId: string;
command: "node.manually_idle_notification_value";
valueId: ValueID;
}
```

Method 2:

```ts
interface {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const version = require("../../package.json").version;
export const minSchemaVersion = 0;

// maximal/current schema version the server supports
export const maxSchemaVersion = 38;
export const maxSchemaVersion = 39;

export const applicationName = "zwave-js-server";
export const dnssdServiceType = applicationName;
13 changes: 11 additions & 2 deletions src/lib/node/incoming_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,20 @@ export interface IncomingCommandNodeGetValueTimestamp
valueId: ValueID;
}

export interface IncomingCommandNodeManuallyIdleNotificationValue
export interface IncomingCommandNodeManuallyIdleNotificationValueMethod1
extends IncomingCommandNodeBase {
command: NodeCommand.manuallyIdleNotificationValue;
valueId: ValueID;
}

export interface IncomingCommandNodeManuallyIdleNotificationValueMethod2
extends IncomingCommandNodeBase {
command: NodeCommand.manuallyIdleNotificationValue;
notificationType: number;
prevValue: number;
endpointIndex?: number;
}

export interface IncomingCommandNodeSetDateAndTime
extends IncomingCommandNodeBase {
command: NodeCommand.setDateAndTime;
Expand Down Expand Up @@ -276,7 +284,8 @@ export type IncomingMessageNode =
| IncomingCommandWaitForWakeup
| IncomingCommandInterview
| IncomingCommandNodeGetValueTimestamp
| IncomingCommandNodeManuallyIdleNotificationValue
| IncomingCommandNodeManuallyIdleNotificationValueMethod1
| IncomingCommandNodeManuallyIdleNotificationValueMethod2
| IncomingCommandNodeSetDateAndTime
| IncomingCommandNodeGetDateAndTime
| IncomingCommandNodeIsHealthCheckInProgress
Expand Down
10 changes: 9 additions & 1 deletion src/lib/node/message_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,15 @@ export class NodeMessageHandler {
return { timestamp };
}
case NodeCommand.manuallyIdleNotificationValue: {
node.manuallyIdleNotificationValue(message.valueId);
if ("valueId" in message) {
node.manuallyIdleNotificationValue(message.valueId);
} else {
node.manuallyIdleNotificationValue(
message.notificationType,
message.prevValue,
message.endpointIndex,
);
}
return {};
}
case NodeCommand.setDateAndTime: {
Expand Down

0 comments on commit 9482766

Please sign in to comment.