How to upgrade Node-Red?

How do I upgrade Node-Red, and what will the upgrade likely break?
I have two installations of Node-Red, one on Raspian (NR Version 0.17.5) and one on Hass.io (NR Version 0.19.5) and I just realized that the Range node is different in the newer node.

I have two Node-Reds because I originally started IOT using Node-Red on Raspian, then many months later, I set up Home Assistant on another Pi running the Home Assistant image from Hass.io. There are nodes on the Raspian system that I can't install on the Hass.io Pi, and vice-versa. So I have two.

So, I tried copying a flow with a Range node from the newer Pi to the older Pi, only to discover that the Range node was not working the same.

Or, I could just write a function to simulate the Range node.

Any ideas? Thanks,
Steve

On the non hass.io pi the best solution is to use the upgrade script listed on the raspberry pi page of the docs.

This will upgrade Node-RED and the underlying node.js and npm versions.

With has.io as Node-RED comes bundled I would suggest checking in their support site what the most effective way to upgrade is.

I can’t think of any nodes that would work in has.io Node-RED but not on stand-alone node-RED so could you list them please?

What differences in the range node are you seeing ?

1 Like

Thanks for the prompt responses.

dceejay: The newer version has a property selection. The older version only works on msg.payload. In my appplication I need to map the 0-100% returned by Alexa Home node for brightness (msg.bri) to 0-256 for the Z-wave light I am controlling from Alexa.

Since it's easy to make a clone of my SD card in Raspian, I have little risk in upgrades there since I can always go back to the last working clone. (This is the older version of NR that needs upgrading). Cloning my SD card in Hass.io is not as easy, but can be done using dd on a separate Pi running Raspian, and hope that I ID the source and destination devices correctly.

ukmoose: In the older version on the Raspian Pi, I installed the Home Assistant nodes, but they don't appear in the nodes pallette on the left side of the Node Red workspace.

On Hass.io, I cannot install npm on Hass.io since there is no "apt-get" in the OS. I did an upgrade from the Home Assistant Hass.io page and didn't break anything. I am very slow to upgrade Hass.io since every upgrade is accompanied with a lot of posts on Home Assistant forum of "Upgrade to xx.yy broke [component or automation]". I.E., not stable. I only try an upgrade if absolutely necessary to gain a new function or component.

as per the Home assistant nodes readme it requires nodejs v8+ not a specific version of node-RED

Thanks. How do I update Node.js on Raspian?

For standard raspbian, the node-red upgrade script will upgrade node.js ( currently to v8)
After you have done the upgrade you will need to rebuild any additional nodes you have installed.

All described on the Raspberry Pi page of the docs https://nodered.org/docs/hardware/raspberrypi

Hi guys,

Node-Red 0.19 has added few interesting features, particularly in Dashboard: Led, Level, and more controls. One one hand it's temptation to upgrade 0.18.7 to 0.19.+. On other hand, this search is just scary..

Did anyone has positive experience with upgrading NR 0.18.7 or less to 0.19.5 or more?

Thank you.

Of course, few people have problems when upgrading. Just make sure you use the right technique. What hardware and operating system are you using?

PasPI 3 model B.
Linux shm 4.14.37-v7+ #1111 SMP Thu Apr 26 13:56:59 BST 2018 armv7l GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"

copy your xxx.flow and xxx_cred.flow to another machine
Buy a new GOOD SD card, install stretch (or Buster)
Put the new card in the Pi and update/upgrade -
install NR using the script in the documentation.
Add in any contrib nodes you use.
restore your xxx.flow and xxx_cred.flow
test things out

This way you can fall back to your originl SD card if you need to.

1 Like

Is this the right technique?

How did you install Node-RED originally?

Did you use the install script our docs for the Pi points at? Have you read the docs for how to upgrade on the pi?

https://nodered.org/docs/getting-started/raspberrypi#installing-node-red

That is a perfectly valid technique. Personally, if everything else installed is fine and all you want to do is to update node-red on a Pi then I would first make an image backup of the card (so you can restore the whole card if necessary), make separate copies of anything else important on the card, and the flows and creds file as suggested, just in case the upgrade fails catastrophically and you discover that for some reason your image backup is not restorable, then just run the Pi upgrade script.
In fact I have never had the update script fail catastrophically, but you should keep up to date backups of everything important anyway.

@knolleary Yes, I used "getting started" guide.
@Colin That makes sense. Thank you.

Nick,

For the sake of clarity on that page that you have referenced for upgrading NR - would it not be better to have a section How To Upgrade - rather than just have it as a one liner under the heading How to Install ? i.e.

How to Upgrade

  • Assuming you have used the script referenced above to perform your original install - we would suggest the following steps to perform an inplace upgrade
  1. login to the Rpi as your standard user (typically pi)
  2. Copy your xxx.flow and xxx_cred.flow files from ~.node-red to somewhere safe

Blah blah

regards

Craig

Maybe. I'll happily review a pull request with some proposed changes.

OK i will try and work out how to do that

Hang on - just had a look - i am talking about updating the Doco - not changing scripts etc - is there a way for me to submit a "PR" for doing that - i thought that was just Github for the scripts itself etc

Craig

Hmm - OK wiill submit it tomorrow - thanks

regards

Craig