This is a Node Red node to manage connection to a DHT11 or DHT22 sensor on a Raspberry Pi. It allows you to specify the variables that define the connections to the sensor.
This node is added to the Raspberry Pi section.
This node requires that node-dht-sensor is installed and accessible from Node Red. Since this requires accesss to low-level parts of the Raspberry Pi, you must run your flow with superuser access.
Installing this node requires three steps:
sudo npm install --unsafe-perm -g node-dht-sensor
sudo npm install --unsafe-perm -g node-red-contrib-dht-sensor
You can specify the following, as seen in the picture here:
The node is added to the Raspberry Pi section of the Node-RED pallette, and it can be used in a flow as usual:
The message returned includes the temperature as the payload, and the humidity and the device ID as part of the message itself:
While not having the humidity as part of the payload may seem awkward, it was done with the explicit intention to preserve compatability with the node-red-controb-ds18b20-sensor node. ### Problems? It is possible to run this as an ordinary user rather than root, but it requires that you update the version of the BCM2385 library to version 1.5 or later, and build it according to the instructions. Then you have to uninstall and reinstall the nodes:
sudo npm uninstall --unsafe-perm -g node-red-contrib-dht-sensorsudo npm uninstall --unsafe-perm -g node-dht-sensorsudo npm install --unsafe-perm -g node-dht-sensorsudo npm install --unsafe-perm -g node-red-contrib-dht-sensor
once you do this, you can run it as any user rather than as root.