From 2da42c949591bd2a6eecd58f707c47159a709811 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 28 Nov 2022 11:50:08 +0000 Subject: [PATCH] Let sensehat ignore colour sensor warning to close #958 --- hardware/sensehat/package.json | 2 +- hardware/sensehat/sensehat.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hardware/sensehat/package.json b/hardware/sensehat/package.json index 20947ada..c9845b99 100644 --- a/hardware/sensehat/package.json +++ b/hardware/sensehat/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pi-sense-hat", - "version" : "0.1.3", + "version" : "0.1.4", "description" : "A Node-RED node to interact with a Raspberry Pi Sense HAT", "repository" : { "type":"git", diff --git a/hardware/sensehat/sensehat.js b/hardware/sensehat/sensehat.js index 6172c752..f41d4360 100644 --- a/hardware/sensehat/sensehat.js +++ b/hardware/sensehat/sensehat.js @@ -107,7 +107,13 @@ module.exports = function(RED) { // Any data on stderr means a bad thing has happened. // Best to kill it and let it reconnect. if (RED.settings.verbose) { RED.log.error("err: "+data+" :"); } - hat.kill('SIGKILL'); + if (data.indexOf("WARNING") === 0) { + if (data.indexOf("sensor not present") !== -1) { return; } + else { RED.log.warn(data); } + } + else { + hat.kill('SIGKILL'); + } }); hat.stderr.on('error', function(err) { }); hat.stdin.on('error', function(err) { });