SenseHat ERROR shutsdown the system
keefer223 opened this issue · 1 comments
SenseHat 013 kills the whole system.
Initially SenseHat connects but within a couple of minutes not only does SenseHat disconnect but kills the Node-RED system.
the node-red has to be restarted has to be restarted.
30 Jul 20:56:29 - [error] TypeError: Cannot read properties of null (reading 'kill')
at Socket. (/home/keefer/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.js:110:21)
at Socket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
keefer@rpi4:~ $
});
hat.stderr.on('data', function (data) {
**// 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');
});
?? python2.7 - I thought it was dead?
10 if (!fs.existsSync('/usr/lib/python2.7/dist-packages/sense_hat') && !fs.existsSync('/usr/lib/python3/dist-packages/sense_hat')) {
throw "Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat";
sudo apt-get install sense-hat didn't work. I ended up using pip.
Please tell us about your environment:
- Node-RED version: 301
- node.js version: v16.16.0
- npm version:8.15.1
- Platform/OS: Debian 11
- Browser: firefox, chrom
I did more fooling around with the code. There is a better way to catch the error, than:
});
hat.stderr.on('data', function (data) {
// 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');
});
after doing some bla bla bla, SenseHat v1 doesn't have a TCS34725 colour sensor, while v2 does have the TCS34725 colour sensor.
the python code checks for the TCS34725 colour sensor.
line 96 # initialise the TCS34725 colour sensor (if possible)
try:
self._colour = ColourSensor()
except Exception as e:
logging.warning(e)
pass