Skip to content

Commit

Permalink
feat: add node info received event (#7253)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone authored Oct 8, 2024
1 parent 6b35559 commit 31c327f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/api/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -1581,3 +1581,11 @@ interface RouteStatistics {
routeFailedBetween?: [number, number];
}
```

### `"node info received"`

The node has sent a node information frame (NIF) Z-Wave JS did not expect. This can be caused by the user pushing a button on the device. Some older devices also send a NIF to notify the controller that their status has changed. The callback only references the node itself:

```ts
(node: ZWaveNode) => void
```
2 changes: 2 additions & 0 deletions packages/zwave-js/src/lib/controller/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2621,6 +2621,8 @@ export class ZWaveController
// Resolve active pings that would fail otherwise
this.driver.resolvePendingPings(node.id);

node.emit("node info received", node);

if (
node.canSleep
&& node.supportsCC(CommandClasses["Wake Up"])
Expand Down
1 change: 1 addition & 0 deletions packages/zwave-js/src/lib/node/_Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export interface ZWaveNodeEventCallbacks extends ZWaveNodeValueEventCallbacks {
ready: (node: ZWaveNode) => void;
"interview stage completed": (node: ZWaveNode, stageName: string) => void;
"interview started": (node: ZWaveNode) => void;
"node info received": (node: ZWaveNode) => void;
}

export type ZWaveNodeEvents = Extract<keyof ZWaveNodeEventCallbacks, string>;
Expand Down

0 comments on commit 31c327f

Please sign in to comment.