Hi there,
I am running Raspberry Pi with 2018-03-13-raspbian-stretch.
- I am trying to set up the DHT-22 sensor with node-red but isn’t working. The debug says 'TypeError: failed to initialize".
If I run python code from the shell it gives me results from DHT-22 successfully, I also installed necessary library.
- How should I set up MQTT client let’s say to work with DHT-22 and node red?
Thank you!
What node-RED node are you using to try and read the DHT-22?
I have the newest up to date node-red on RASPBIAN STRETCH.
Which node are you using to read it ?
I seem to recall that most of the DHT nodes require you to run Node-RED as root - which is a pain and causes issues like you are seeing. If you do run as root you’ll need some command line parameters to point to your existing user directory. https://nodered.org/docs/getting-started/running
I’d advise anyone not to use the DHT sensors if at all possible. Yes they work but the number of issues we have…
If by that you mean the one that comes installed on Raspbian stretch then it unfortunately isn't the newest available and uses a very old version of nodejs. There are simple instructions to how to get the latest version of Node-RED (v0.18.7) here Redirecting…
@dceejay - I've no problem running NR v0.18.7 as user pi with latest raspbian and using a dht22...well there was the issue of setting the dht22 to use physical pin 4 - which is ground - causing the pi to freeze. But other than that, it seems to run fine.
I did open an issue in github (Causes a freeze the pi when choosing physical pin 4 · Issue #14 · bpmurray/node-red-contrib-dht-sensor · GitHub) about it but the authors 'solution' was to change the readme to:
Note: If you're daft enough to select an earth (ground) pin, this will cause the Pi to freeze.
1 Like