How to check if there is an upgrade

Can I check if there is an upgrade available to either Node Red itself or any of the installed packages from within a flow?

I want to setup a notification for myself for upgrading if an upgrade is available.

My installation is in a FreeBSD jail if that matters.

You can do it via the exec node.

The commands you need are:

For Node-RED if it is globally installed: npm -g outdated --json

For the installed nodes it is cd ~/.node-red && npm outdated --json

You may need to change the cd folder though to match your installation.

These will return JSON formatted data which you can analyse in Node-RED

3 Likes

I made a flow for Windows PC's that checks for updates, but if you change the file-path to fit your system it will work.

[{"id":"b6faf7d8.b5efa8","type":"tab","label":"Update?","disabled":false,"info":""},{"id":"874a3d4e.9b666","type":"http request","z":"b6faf7d8.b5efa8","name":"http request to https://nodered.org","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://nodered.org","tls":"","persist":false,"proxy":"","authType":"","x":300,"y":400,"wires":[["90243cc1.87edc"]]},{"id":"90243cc1.87edc","type":"html","z":"b6faf7d8.b5efa8","name":"","property":"payload","outproperty":"payload","tag":".node-red-latest-version","ret":"text","as":"multi","x":630,"y":400,"wires":[["05cf562f0b953db6"]]},{"id":"212aff481b0685cb","type":"inject","z":"b6faf7d8.b5efa8","name":"","props":[{"p":"payload"}],"repeat":"259200","crontab":"","once":false,"onceDelay":"","topic":"","payloadType":"str","x":90,"y":440,"wires":[["874a3d4e.9b666","b3ca5d44d94eb375"]]},{"id":"e0fa0b169f53173a","type":"json","z":"b6faf7d8.b5efa8","name":"","property":"payload","action":"obj","pretty":false,"x":570,"y":440,"wires":[["1abacae20abcf0a0"]]},{"id":"9a682b8e06cbc47e","type":"function","z":"b6faf7d8.b5efa8","name":"old version","func":"msg.payload = \"2.0.1\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":480,"wires":[["77873223bd69beae"]]},{"id":"1abacae20abcf0a0","type":"split","z":"b6faf7d8.b5efa8","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":690,"y":440,"wires":[["f6c97623cca5148b"]]},{"id":"f6c97623cca5148b","type":"switch","z":"b6faf7d8.b5efa8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"index","v":"0","vt":"num","v2":"0","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":810,"y":440,"wires":[["779d54d3e94666e0"]]},{"id":"77873223bd69beae","type":"join","z":"b6faf7d8.b5efa8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1110,"y":440,"wires":[["2710a272a2cc1b37"]]},{"id":"12208d376a521184","type":"debug","z":"b6faf7d8.b5efa8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1510,"y":420,"wires":[]},{"id":"2710a272a2cc1b37","type":"switch","z":"b6faf7d8.b5efa8","name":"","property":"payload.0","propertyType":"msg","rules":[{"t":"eq","v":"payload.1","vt":"msg"},{"t":"neq","v":"payload.1","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":1230,"y":440,"wires":[["9d5c0bd73938b521"],["a3dbd1ecd809488a"]]},{"id":"9d5c0bd73938b521","type":"function","z":"b6faf7d8.b5efa8","name":"No update","func":"msg.payload = \"The installed version is \" + msg.payload[0] + \", no update is necessary at this time.\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1370,"y":420,"wires":[["12208d376a521184"]]},{"id":"a3dbd1ecd809488a","type":"function","z":"b6faf7d8.b5efa8","name":"update","func":"msg.payload = \"The installed version is \" + msg.payload[0] + \", an update to version \" + msg.payload[1] + \" is available.\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1350,"y":460,"wires":[["5145c9412b49c0fc","83110640972f117c"]]},{"id":"779d54d3e94666e0","type":"function","z":"b6faf7d8.b5efa8","name":"filter version","func":"msg.payload = msg.payload.version;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":440,"wires":[["77873223bd69beae"]]},{"id":"5145c9412b49c0fc","type":"debug","z":"b6faf7d8.b5efa8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1510,"y":460,"wires":[]},{"id":"b3ca5d44d94eb375","type":"file in","z":"b6faf7d8.b5efa8","name":"","filename":"C:/Users/Bannd/.node-red/.config.nodes.json","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":330,"y":440,"wires":[["e0fa0b169f53173a"]]},{"id":"83110640972f117c","type":"link out","z":"b6faf7d8.b5efa8","name":"Update checked","links":["966d7ce16488d73f"],"x":1475,"y":500,"wires":[]},{"id":"9e3906315247bdf2","type":"inject","z":"b6faf7d8.b5efa8","name":"manual test","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":790,"y":480,"wires":[["9a682b8e06cbc47e"]]},{"id":"e90c1af7ea9b30d8","type":"comment","z":"b6faf7d8.b5efa8","name":"How often to check","info":"","x":110,"y":480,"wires":[]},{"id":"e9e2d19cccb1c1d0","type":"comment","z":"b6faf7d8.b5efa8","name":"Send to a notification flow","info":"","x":1410,"y":540,"wires":[]},{"id":"57e5bc1434255e11","type":"comment","z":"b6faf7d8.b5efa8","name":"replace location for your system","info":"","x":350,"y":480,"wires":[]},{"id":"05cf562f0b953db6","type":"function","z":"b6faf7d8.b5efa8","name":"chomp left","func":"msg.payload = msg.payload.substr(1, +Infinity)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":400,"wires":[["77873223bd69beae"]]},{"id":"b850824df4055e47","type":"comment","z":"b6faf7d8.b5efa8","name":"No need to send this one","info":"","x":1410,"y":380,"wires":[]}]

By default it checks every 3 days, and then pipes a message out to a notification flow if an update is available.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.