Showing posts with label Node-RED. Show all posts
Showing posts with label Node-RED. Show all posts

Thursday, September 1, 2022

Notes on Node-RED development on a Raspberry Pi using Visual Studio Code

Notes on Node-RED development on a Raspberry Pi using Visual Studio Code

In the past, I developed Node-RED nodes by locally editing using Visual Studio Code and exporting the directory via NFS to a Raspberry Pi with the appropriate hardware installed, and the node was added to Node-RED via symlinks.  It worked, but it was brittle and there can be permissions issues and its annoying if the Pi reboots and cannot connect to the fileserver then flows will not start because the nodes are not present, it's just so tedious.

My new, improved development environment involves VSC's "remote-ssh" extension.

As always, detailed notes make it easier to set things up.  There are so many small details from configuring git on the RaspPi to removing the "nano" editor to make it easier to do command line git commits.

So, here are my cut and paste notes that start with a newly installed RaspPi (or rephrased, OS and Node-RED previously installed) and end with a working VSC development environment for Node-RED:

On Desktop:

Install Visual Studio Code extension “Remote - SSH”

https://code.visualstudio.com/docs/remote/ssh

https://code.visualstudio.com/docs/remote/linux

https://code.visualstudio.com/docs/remote/troubleshooting#_installing-a-supported-ssh-client

https://code.visualstudio.com/docs/remote/troubleshooting#_improving-security-on-multi-user-servers

Install Windows OpenSSH client

https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui

Move SSH keys around for key-based SSH authentication

On New Remote:

On windows scp the key from the windows host to the new remote

scp c:\users\vince\.ssh\id_rsa.pub pi@new_remote:

then while logged into the new remote run:

cat id_rsa.pub >> .ssh/authorized_keys

Then test a login from windows to the new remote

ssh pi@new_remote

Create a SSH key on the new remote and add the .ssh/id_rsa.pub to GitLab

ssh-keygen, then add the key to GitLab

Prepare git on the new remote

On the new remote:

sudo apt-get install git

sudo dpkg –purge nano

git config –global user.email “vince.mulhollon@springcitysolutions.com”

git config –global user.name “Vince Mulhollon”

Install the git repo for the project on the remote

git clone the applicable Node-RED node project into ~ directory

Add git repo to installed Node-RED

cd ~/.node-red

npm install ~/node_git_repo_from_above

Restart node-red

./node-red-restart

Install standard.js in a project

npm install standard –save-dev

Then run it with “npx standard”.

Install standard.js extension in VS Code

“View” “Extensions”

Search for vscode-standard

Click install

Remember to install the standard engine as a devDependencies and it works automatically.

Anyway I hope these detailed notes help somebody do remote Node-RED development on a Raspberry Pi using Visual Studio Code.


Sunday, December 19, 2021

Node-RED development

A long time ago, I developed some Node-RED nodes for "STEM" and "Amateur Radio" hardware, written in node.js and Python, under a FOSS license for the general public to use.

A couple months ago I noticed a popular electronic hobbyist magazine linked to my code for the relay board.  Which is really cool, the more people using Node-RED to automate and control using flow based programming technologies, the better.

I wrote that old code for my own personal use; but released it to the general public, may as well let everyone play along.  However, if people are interested, I could apply real resources and real effort toward building better Node-RED nodes.  And people DO seem interested.

I decided to set up a project, Patreon funded, to fund further Node-RED node development for "STEM" and "Amateur Radio" related hardware, mostly on Raspberry Pi type computer hardware.  I intend to produce nodes that follow all the standards in full, are well documented in written and video format, are very easy to use, FOSS licensed, and generally of the highest possible quality.  

And so far, so good!  I've cleaned up the relay board a bit, added several example flows, and recorded some pretty good Youtube documentation videos.

The link to the project main page is:

https://www.springcitysolutions.com/nodered

The link to the project Patreon page is:

https://www.patreon.com/springcitysolutions_nodered

I intend to post detailed daily logs of Node-RED project related work on the Patreon page along with downloads and special posts for Patrons and similar add-ons.

I'll only very occasionally post major news about the project on the main company blog.

Thank You in advance for your support!