Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compatibility with node-zwave-js v14 #1308

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/endpoint/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export enum EndpointCommand {
isCCSecure = "endpoint.is_cc_secure",
getCCVersion = "endpoint.get_cc_version",
getNodeUnsafe = "endpoint.get_node_unsafe",
tryGetNode = "endpoint.try_get_node",
setRawConfigParameterValue = "endpoint.set_raw_config_parameter_value",
getRawConfigParameterValue = "endpoint.get_raw_config_parameter_value",
}
6 changes: 6 additions & 0 deletions src/lib/endpoint/incoming_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export interface IncomingCommandEndpointGetNodeUnsafe
command: EndpointCommand.getNodeUnsafe;
}

export interface IncomingCommandEndpointTryGetNode
extends IncomingCommandEndpointBase {
command: EndpointCommand.tryGetNode;
}

export interface IncomingCommandEndpointSetRawConfigParameterValue
extends IncomingCommandEndpointBase {
command: EndpointCommand.setRawConfigParameterValue;
Expand All @@ -75,5 +80,6 @@ export type IncomingMessageEndpoint =
| IncomingCommandEndpointIsCCSecure
| IncomingCommandEndpointGetCCVersion
| IncomingCommandEndpointGetNodeUnsafe
| IncomingCommandEndpointTryGetNode
| IncomingCommandEndpointSetRawConfigParameterValue
| IncomingCommandEndpointGetRawConfigParameterValue;
5 changes: 3 additions & 2 deletions src/lib/endpoint/message_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@
const version = endpoint.getCCVersion(message.commandClass);
return { version };
}
case EndpointCommand.getNodeUnsafe: {
const node = endpoint.getNodeUnsafe();
case EndpointCommand.getNodeUnsafe:
case EndpointCommand.tryGetNode: {
const node = endpoint.tryGetNode();

Check failure on line 97 in src/lib/endpoint/message_handler.ts

View workflow job for this annotation

GitHub Actions / build

Property 'tryGetNode' does not exist on type 'Endpoint'.
return {
node:
node === undefined
Expand Down
1 change: 1 addition & 0 deletions src/lib/endpoint/outgoing_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface EndpointResultTypes {
[EndpointCommand.isCCSecure]: { secure: boolean };
[EndpointCommand.getCCVersion]: { version: number };
[EndpointCommand.getNodeUnsafe]: { node: NodeState | undefined };
[EndpointCommand.tryGetNode]: { node: NodeState | undefined };
[EndpointCommand.setRawConfigParameterValue]: { result?: SupervisionResult };
[EndpointCommand.getRawConfigParameterValue]: {
value: MaybeNotKnown<ConfigValue>;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
"notification",
(endpoint: Endpoint, ccId: CommandClasses, args: any) => {
// only forward value events for ready nodes
const changedNode = endpoint.getNodeUnsafe();
const changedNode = endpoint.tryGetNode();

Check failure on line 365 in src/lib/forward.ts

View workflow job for this annotation

GitHub Actions / build

Property 'tryGetNode' does not exist on type 'Endpoint'.
if (!changedNode) {
throw new NodeNotFoundError(endpoint.nodeId);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ export const dumpCommandClass = (
): CommandClassState => ({
id: commandClass.ccId,
name: CommandClasses[commandClass.ccId],
version: commandClass.version,
version: endpoint.getCCVersion(commandClass.ccId),
isSecure: endpoint.isCCSecure(commandClass.ccId),
});

Expand Down
Loading