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.
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.
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.
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?
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.
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.
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
login to the Rpi as your standard user (typically pi)
Copy your xxx.flow and xxx_cred.flow files from ~.node-red to somewhere safe
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