-
Notifications
You must be signed in to change notification settings - Fork 576
Node RED
The Node-RED build will complain about several issues. This is completely normal behaviour.
Thanks to @fragolinux the SQLite node will install now. WARNING it will output many error and will look as if it has gotten stuck. Just give it time and it will continue.
To communicate to your Pi's GPIO you need to use the node-red-node-pi-gpiod node. It allowes you to connect to multiple Pis from the same nodered service.
You need to make sure that pigpdiod is running. The recommended method is listed here
You run the following command sudo nano /etc/rc.local and add the line /usr/bin/pigpiod above exit 0 and reboot the Pi. There is an option to secure the service see the writeup for further instuctions.
Fot the Rpi Image you will also need to update to the most recent version
sudo apt-get update
sudo apt-get install pigpio python-pigpio python3-pigpio
Drop the gpio node and use your Pi's IP. Example: 192.168.1.123 (127.0.0.1 won't work because this is the local address of every computer'.)
To secure Node-RED you need a password hash. There is a terminal script ./services/nodered/terminal.sh execute it to get into the terminal.
Copy the helper text node -e ..... PASSWORD, paste it and change your password to get a hash.
Open the file ./volumes/nodered/data/settings.js and follow the writeup on https://nodered.org/docs/user-guide/runtime/securing-node-red for further instructions
Containers run in a sandboxed environment they can't see the host (the Pi itself) file system. This presents a problem if you want to read a file directly to the host from inside the container. Fortunately there is a method, the containers have been set up with volume mapping. The volume maps a specific directory or file from the host file system into the container. Therefore if you write to that directory both the host and the container can see the files.
Consider the following:
The docker-compose.yml file shows the following for Node-RED
volumes:
- ./volumes/nodered/data:/data
If inside Node-RED you were to write to the /data folder then the host would see it in ~/IOTstack/volumes/nodered/data (the ./volumes above implies relative to the docker-compose.yml file)

The flow writes the file /data/test.txt and it is visible in the host as ~/IOTstack/volumes/nodered/data/test.txt
Remember, files and directories in the volume are persistent between restarts. If you save your data elsewhere it will be destroyed should you restart. Creating a subdirectory in volume i.e. /data/storage/ would be advised