Skip to content

Commit

Permalink
Patch to compensate for zwave-js issue zwave-js/node-zwave-js#3657
Browse files Browse the repository at this point in the history
  • Loading branch information
bchabrier committed Dec 12, 2021
1 parent 6e8bd82 commit f333159
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 116 deletions.
2 changes: 1 addition & 1 deletion modules/openzwave/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"homepage": "https://github.com/bchabrier/domoja/modules/openzwave#readme",
"dependencies": {
"tracer": "^1.1.2",
"zwave-js": "8.4"
"zwave-js": "8.7.5"
},
"devDependencies": {
"@types/mocha": "<=8",
Expand Down
10 changes: 9 additions & 1 deletion modules/openzwave/sources/openzwave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createLogMessagePrinter, CommandClasses, allCCs, TranslatedValueID } fr
import * as winston from "winston";
import * as chokidar from 'chokidar';
import * as assert from 'assert'

import { exit } from 'process';

var logger = require("tracer").colorConsole({
dateformat: "dd/mm/yyyy HH:MM:ss.l",
Expand Down Expand Up @@ -82,6 +82,7 @@ export class Openzwave extends Source {

// Tell the driver which serial port to use
this.driver = new Driver(driverPort, {
enableSoftReset: false,
logConfig: {
enabled: true,
level: level,
Expand All @@ -98,6 +99,13 @@ export class Openzwave extends Source {
]
}
});

// the driver catches SIGINT which prevents the process to exit on the first ^C
// this issue has been submitted: https://github.com/zwave-js/node-zwave-js/issues/3657
this.logger.warn("The line below should be removed when issue 'https://github.com/zwave-js/node-zwave-js/issues/3657' is solved.")
process.off("SIGINT", exit);
process.on("SIGINT", exit);

// You must add a handler for the error event before starting the driver
this.driver.on("error", (e) => {
// Do something with it
Expand Down
Loading

0 comments on commit f333159

Please sign in to comment.