Node-REDA visual wiring tool for the Internet of Things Version 0.16 released <p>Node-RED 0.16 is now available to <a href="">download</a> or <a href="">npm install</a>.</p> <p>If upgrading, please read the <a href="">upgrade instructions</a>.</p> <p>As announced with the 0.15 release, 0.16 will not be made available via the standard Raspberry Pi Jessie repositories. See below for more information on how to update your Pi to this version.</p> <hr /> <h3 id="node-010012-no-longer-supported">Node 0.10/0.12 no longer supported</h3> <p>Also announced with the last release, we no longer support Node.JS 0.10 or 0.12.</p> <p>Neither of these versions are supported by the Node project anymore and continuing support for them was already preventing us from picking up important fixes in other dependencies.</p> <p>If you are running the preinstalled version on a Raspberry Pi, you should follow the instuctions <a href="">here</a> for upgrading your version of node.js.</p> <h3 id="node-red-node-serialport-removed">node-red-node-serialport removed</h3> <p>As we announced in the previous release, we’ve removed the Serial node from the default set of nodes.</p> <p><strong><em>If you are using the Serial node, you will need to manually reinstall the node after upgrading.</em></strong></p> <h3 id="editor-updates">Editor Updates</h3> <h4 id="quick-add-nodeswires">Quick-add nodes/wires</h4> <p>There are two fundamental actions in Node-RED - adding a node and wiring it to another node.</p> <p>One of the challenges can sometimes be finding the node you want in the palette. That can cause lots of scrolling - particularly if you’ve installed lots of nodes.</p> <p>We’ve added a new ‘quick add’ mode for nodes. If you ctrl-click (cmd-click) in the workspace, the new quick-add dropdown will appear. It provides a mini version of your palette right under the cursor that can be filtered to find exactly the node you are looking for. When you click on the node it then appears on your workspace.</p> <p><img src="/blog/content/images/2017/01/quick-add.gif" alt="" /></p> <p>The dropdown lists five common core nodes at the top, then the five most recently added nodes and then all of the nodes in alphabetical order.</p> <p>We’ve been using this for a while now and found it to really speed up creating flows. You don’t have to keep moving your focus over to the palette as you go.</p> <p>Another challenge is when you’ve placed a bunch of nodes in the workspace and want to wire them all together; lots of click-dragging needed.</p> <p>Alongside the quick add mode for nodes, we’ve done something similar for wires.</p> <p>If you hold down ctrl (cmd) when you click on a node’s port to start wiring, you can then let go of the mouse button and simply click on each node you want to have wired together and then release ctrl.</p> <p><img src="/blog/content/images/2017/01/quick-wire.gif" alt="" /></p> <p>As both modes are trigged by holding the ctrl key down when clicking, you can easily combine them.</p> <p><img src="/blog/content/images/2017/01/quick-add-and-wire.gif" alt="" /></p> <h4 id="better-debug-panel">Better Debug panel</h4> <p>The Debug sidebar has had an overhaul to make it much more useful. Previously it would display the message content as raw text. That was fine for simple text or numeric values, but as soon as you sent an Object or Array it was hard to see the details in the blob of text it displayed.</p> <p>The new sidebar provides a much more structured view of the messages. If you are familiar with the JavaScript console in your browser, you’ll be familiar with what you can do here.</p> <p><img src="/blog/content/images/2017/01/debug.gif" alt="" /></p> <p>There are a number of extra features hidden in there. For example, any numeric type can be clicked on to toggle between decimal and hexadecimal. If it looks like a date expressed in milliseconds since epoch, another click will show the formatted date.</p> <p>Another example is if you receive a Buffer object that actually contains text data:</p> <p><img src="/blog/content/images/2017/01/debug-string-buffer.gif" alt="" /></p> <p>You can also now pop the debug sidebar out into its own window by clicking the screen icon in the bottom right corner. That lets you give your debug messages as much room as they need.</p> <p><img src="/blog/content/images/2017/01/debug-detach.png" alt="" /></p> <p>If you have any other suggestions for making the debug panel even more useful, do let us know.</p> <h4 id="flow-diff">Flow diff</h4> <p>We introduced a warning in the last release for when you are about to overwrite changes on the runtime. We knew the warning would be of limited use - it doesn’t help you do anything about it.</p> <p>This release now lets you compare the flows on the server with the changes you’ve made locally. You can then merge those changes together, resolving any conflicts along the way.</p> <p><img src="/blog/content/images/2017/01/diff-view.png" alt="" /></p> <h4 id="new-keyboard-shortcuts">New keyboard shortcuts</h4> <p>The keyboard handling in the editor has had an overhaul to make it easier to add keyboard shortcuts to any action. You can see a full list of the available keyboard shortcuts by pressing <code class="highlighter-rouge">Shift-?</code>, or from the corresponding menu option.</p> <p>Some highlights include:</p> <ul> <li>Opening the search dialog has moved to <code class="highlighter-rouge">Ctrl-F</code> - these removes a clash with a system shortcut on Windows, and is actually more sensible in general.</li> <li><code class="highlighter-rouge">Ctrl-G</code> followed by either <code class="highlighter-rouge">i</code>, <code class="highlighter-rouge">d</code> or <code class="highlighter-rouge">c</code> will open the info, debug or configuration nodes sidebar tabs respectively.</li> <li>You can switch tabs with <code class="highlighter-rouge">Ctrl-Shift-j</code> and <code class="highlighter-rouge">Ctrl-Shift-k</code></li> </ul> <p>The list also shows you other defined actions that don’t currently have a shortcut assigned; this work is a precursor to allowing you to customise the shortcuts in a future release.</p> <h4 id="runtime-state-notification">Runtime state notification</h4> <p>We’ve added a warning to the editor that notifies you if your flows are currently stopped due to missing node types. This was a cause of confusion for users who didn’t watch their runtime logs.</p> <p><img src="/blog/content/images/2017/01/stopped-warning.png" alt="" /></p> <h4 id="jsonata">JSONata</h4> <p><a href="">JSONata</a> is a lightweight query and transformation language for working with JSON documents, developed by some colleagues of ours at IBM.</p> <p>We’ve added support for it in the Change and Switch nodes. This means many simple tasks are now possible without resorting to the Function node.</p> <p>For example, a Change node that converts <code class="highlighter-rouge">msg.payload</code> from Fahrenheit to Celsius:</p> <p><img src="/blog/content/images/2017/01/jsonata-change.png" alt="" /></p> <p>To help you write JSONata expressions, you can open up an expression editor by clicking the button to the right of the field. This provides auto-complete and inline help for the full JSONata language.</p> <p>For more information about JSONata, head over to their <a href="">website</a> and use their <a href="">exerciser to try it out</a>.</p> <h4 id="other-changes">Other changes</h4> <ul> <li>We’ve added a set of tips for using the editor to the info sidebar - not everyone reads the release notes.</li> <li>Installing or removing nodes using the palette manager now has an extra step to confirm the action.</li> <li>The <code class="highlighter-rouge">typedInput</code> widget used by many nodes is now keyboard accessible</li> <li>We’ve added a <code class="highlighter-rouge">delete</code> button to the node edit dialog - not everyone realised you can use the <code class="highlighter-rouge">delete</code> key to do the same.</li> </ul> <h3 id="node-updates">Node Updates</h3> <ul> <li>There’s a new parser node for the <code class="highlighter-rouge">YAML</code> format</li> <li>The <code class="highlighter-rouge">template</code> node can now reference <code class="highlighter-rouge">global</code> and <code class="highlighter-rouge">flow</code> context properties - check its updated info tab for an example</li> <li>The Switch node now keeps your links in order when you rearrange rules</li> </ul> Wed, 11 Jan 2017 00:00:00 +0000 Moving to the JS Foundation <p><em><a href="">Nick O’Leary</a> and <a href="">Dave Conway-Jones</a>, <a href="">IBM Emerging Technologies</a></em>.</p> <p>On a wet January day in 2013, I started playing around with how to visualise mapping messages between MQTT topics. Having got something working in my web browser, I showed Dave and said it wouldn’t take much to have the visualisation update a running system at the click of a button. Without pause, his response was ‘go on then’ and Node-RED was born.</p> <p>Soon after we added a Serial node to get data from a GPS into MQTT for a project Dave was working on. A couple of months after that we were running it on a group of Raspberry Pis strapped to a client’s manufacturing line.</p> <p>At that time it was a side project; something to fit around the day job. As it became evident to us we had something quite useful, the question was how to make the most of it.</p> <p>The obvious answer to us was to open source it and continue to develop it in the open. We quickly convinced the powers that be that this was the route to take and in September 2013 we pushed the first commit to GitHub.</p> <p>Fast forward three years and we find ourselves with over 325,000 installs from npm, over 600 nodes contributed to the community and code contributions coming into the project from over 50 non-IBMers.</p> <p>Node-RED is included on the main Raspberry Pi Raspbian distribution - available directly from the desktop menu.</p> <p>Companies such as <a href="">SenseTecnic</a>, <a href="">AT&amp;T</a> and <a href="">Red Ant</a> provide Node-RED services.</p> <p>Hardware devices are shipped with Node-RED installed to enable end-user configuration - for example the <a href="">Multitech MultiConnect Conduit</a> and Intel’s IoT Gateway Developer Hub.</p> <p>Amongst the many nodes contributed to the community, companies such as <a href="">Opto 22</a> are providing <a href="">nodes</a> for their own devices.</p> <p>It has been used to create <a href="">beautiful interactive lighting displays</a>, to help <a href="">refurbish hovercrafts delivering aid</a> and to bring <a href="">dinosaurs to life</a>.</p> <p>And of course Node-RED is a key part of the <a href="">IBM Watson IoT platform’s Developer experience</a>, making it easy to create IoT applications that can combine the best of what IBM Bluemix has to offer.</p> <p>All of this has been possible through the power of open technology. Had Dave and I kept it to ourselves, we would have got on with our client projects, making incremental changes as and when we needed something from it. But by developing it in the open, we have seen a community build around it that has helped push it further than we could have ever imagined.</p> <h3 id="moving-forward">Moving forward</h3> <p>And that brings us to today’s announcement.</p> <p>The <a href="">JS Foundation</a>, of which IBM is a founding member, has been created to drive widespread adoption and continued development of key JavaScript solutions and related technologies. With a formalised partnership with the Node.js Foundation, it is creating a centre of gravity for all things JavaScript.</p> <p>As part of the launch, we’re excited to announce Node-RED is becoming a project within the foundation.</p> <div style="text-align:center"> <img style="width:150px;" src="/blog/content/images/2016/10/jsf-hex.png" /> <img style="width:150px;" src="/blog/content/images/2016/10/nr-hex.png" /> </div> <p>Becoming part of the foundation means we’ll benefit from increased collaboration and cross-pollination between the wide variety of projects. We’ll have an open technical governance structure and access to a Mentorship Program that will help us continue to drive innovation and increase participation.</p> <p>Over the coming days and weeks we will formalise these things along with the other projects in the foundation.</p> <p>But above all else, we remain an open project that continues to welcome contributions of any sort, from anyone. Our GitHub organisation won’t change, Dave and I aren’t going anywhere and we’re still committed to making Node-RED an indispensable tool for the Internet of Things.</p> <h3 id="community-driven">Community driven</h3> <p>We wouldn’t be here today without you, the community. This move is a great validation of everything we’ve achieved together in a short time.</p> <p>So from Dave and myself, a big thank you for your enthusiasm, your contributions, and even your issues raised on GitHub.</p> <h3 id="more-information">More information</h3> <p>To find out more about this news, check out:</p> <ul> <li>the <a href="">Linux Foundation’s press release</a></li> <li>a <a href="">blog post from Angel Diaz</a>, IBM VP Cloud Architecture &amp; Technology</li> </ul> <p>To see how Node-RED can be used alongside IBM Watson IoT, try out the <a href="">starter application</a> in IBM Bluemix.</p> Mon, 17 Oct 2016 00:00:00 +0000 Version 0.15 released <p>Node-RED 0.15 is now available to <a href="">download</a> or <a href="">npm install</a>.</p> <p>If upgrading, please read the <a href="">upgrade instructions</a>.</p> <p>If you are using the pre-installed version on Raspberry Pi Jessie, the repositories will be updated in the near future.</p> <hr /> <h3 id="editor-updates">Editor Updates</h3> <h4 id="palette-editor">Palette editor</h4> <p>It’s now possible to manage your palette from within the editor. This lets you browse a catalogue of all available nodes and install any of them without having to restart Node-RED.</p> <p><img src="/blog/content/images/2016/10/palette-editor.gif" alt="" /></p> <p>Under the covers, this triggers an npm install of the node module into your user directory - by default, <code class="highlighter-rouge">$HOME/.node-red</code>. Note that if the node has any dependencies beyond the standard npm dependencies, you’ll need to resolve them manually. It also requires you to have <code class="highlighter-rouge">npm</code> installed, which, if you’re using the Raspberry Pi preinstall image, you may not have - check <a href="">the docs</a> for how to get it.</p> <h4 id="scrollable-tabs">Scrollable tabs</h4> <p>Having let you reorder your workspace tabs in the last release, we knew there was more to be done. A common complaint was how the editor handled flows with lots of tabs; we would squeeze them all into the view making it virtually impossible to jump to the right tab first time. It also made the Flows menu unusable as to grew beyond the bottom of the page.</p> <p>With this release, we now behave much more sensibly and allow the tab bar to scroll so the tabs never become too small. That ensures their labels are always legible. We’ve also removed the list of tabs from the Flows menu.</p> <p><img src="/blog/content/images/2016/10/scrolling-tabs.gif" alt="" /></p> <p>But wait a minute, I hear you say, how can you quickly navigate between tabs if they are now scrolled off screen and there’s no menu entry? Well, I reply, you want to see the new search box…</p> <h4 id="search-box">Search box</h4> <p>We’ve added a search box that makes it easy to quickly find any tab or node. You can access it from the ‘Search flows’ option in the menu, or simply hit <code class="highlighter-rouge">Ctrl+.</code> (<code class="highlighter-rouge">Cmd+.</code> on Mac). As you type, it shows a list of possible matches, either click on the one you want, or use the cursor keys and hit enter.</p> <p>If you select a flow or subflow, it will switch to the appropriate tab. If you pick a node in the flow, it switches to the appropriate tab, scrolls to ensure the node is visible and flashes its border so you can spot it. If you pick a configuration node, it will reveal it in the config node sidebar.</p> <p><img src="/blog/content/images/2016/10/flow-search.gif" alt="" /></p> <h4 id="importexport-improvements">Import/Export improvements</h4> <p>The Import and Export dialogs have had a few small updates. When importing a flow, you can now choose to have it import into a new flow rather than the current one.</p> <p>The export dialog gives you more options on what gets exported - whether the selected nodes, the current flow or all flows. You can also pick if the export should be prettified or minified.</p> <p><img src="/blog/content/images/2016/10/import-dialog.png" alt="" /> <img src="/blog/content/images/2016/10/export-dialog.png" alt="" /></p> <p>A couple of other new features on import:</p> <ul> <li>we avoid duplicating subflows if you import one you already have in the palette</li> <li>you can now include credentials in the flow json you import</li> </ul> <h4 id="other-things">Other things</h4> <ul> <li> <p>As you switch between flows, we update the url in the browser so you can link straight into a particular flow or subflow:</p> <p><img src="/blog/content/images/2016/10/flow-url.png" alt="" /></p> </li> <li> <p>We’ve changed the default scope of new config nodes. When we introduced the idea of scoping config nodes to a particular flow we defaulted to the current flow you’re on. This has caused quite a bit of confusion as user’s don’t necessary understand what the scoping is doing and end up creating identical config nodes on each tab. With this release, we now set config nodes to be global by default.</p> </li> </ul> <h3 id="runtime-updates">Runtime Updates</h3> <h4 id="encrypting-credentials">Encrypting credentials</h4> <p>We’ve always taken care to ensure any credential properties are not stored in the main flow file and put them in a dedicated credentials file. This means the main flow file can be version controlled without fear of leaking anything sensitive. However we can’t avoid the fact that credentials really need to be kept in sync with the flows and only version controlling one doesn’t make sense.</p> <p>As we’re building up to adding version control support to Node-RED, we needed to do something to protect the credentials whilst enabling them to be version controlled.</p> <p>As such, we now encrypt the credentials by default. This will mean you can no longer hand-edit the credentials file unless you choose to explicitly disable encryption. The exact details of how we do this are on the wiki <a href="">here</a>.</p> <h4 id="preventing-overwrite-protection">Preventing overwrite protection</h4> <p>In anticipation of version control support, the <code class="highlighter-rouge">/flows</code> admin api has been updated to include a revision identifier along with the flows. When you hit the deploy button, the editor can now check if the flows in the runtime are those it loaded originally. Why is that useful? It means if someone deploys some changes whilst you’re still working on yours, the editor will warn you when you come to deploy. In this release, we give you the option to deploy anyway (over-writing whatever changes had been made), or cancel the deploy.</p> <p>We’ve already started work on being able to see what changes have been made so you can merge them into your changes before deploying, but it didn’t make the cut for this release.</p> <p>As the changes to <code class="highlighter-rouge">/flows</code> are not backward compatible, we’ve added a new custom HTTP header to identify what version of the API should be used. That means any existing use of the <code class="highlighter-rouge">/flows</code> api will continue to work, but can easily opt-in to the new behaviour. The documentation for this new api will get updated later this week.</p> <h3 id="node-010">Node 0.10</h3> <p>Finally, we need to talk about Node.js 0.10. At the <a href="">end of this month</a>, it will no long receive <em>any</em> updates - including security updates. This end-of-life means it is hard for us to justify maintaining support for it. There is a growing list of modules that have already dropped support for both 0.10 and 0.12 which leaves us stuck if a critical issue was to be found in them.</p> <p>The <em>only</em> reason we’ve held onto 0.10 for so long is the fact its the version that Debian Stable ships - and thus it’s the only version available as part of our Raspberry Pi preinstall image. Debian Stable isn’t due to update for quite some time yet, so we’re at a bit of an impasse.</p> <p>Having explored a wide range of options we’ve made the decision that the 0.15 stream will be the last one to support node 0.10 <em>and</em> 0.12.</p> <p><strong>The next milestone release, 0.16, will require Node 4.x.</strong></p> <p>This means, for now, the Raspberry Pi preinstall will be fixed at 0.15. To make life easier, we already include a script on the preinstall image called <code class="highlighter-rouge">update-nodejs-and-nodered</code> that updates node.js to the latest LTS version using the NodeSource repositories and then reinstalls node-red on top. See <a href="">the documentation</a> for more information - including instructions for doing that upgrade manually if you so choose.</p> <h4 id="serial-node">Serial node</h4> <p>One of the more painful parts of the node.js world is handling binary dependencies. It can be a real headache when upgrading between versions to make sure such dependencies continue to work as expected.</p> <p>We’re serving notice that in the 0.16 release <strong>we will be removing <code class="highlighter-rouge">node-red-node-serialport</code> as a default dependency</strong>.</p> <p>That means we’ll no longer include the Serial node as part of the core install.</p> <p>It will remove a lot of hardware/platform dependent code, speeding up the install time and shrinking the runtime footprint for users who have no need of the node.</p> <p>It will also make upgrading more reliable as the serial port code will no longer be buried within Node-RED and can be upgraded just like any other node.</p> <p>This will mean if you are using the serial port nodes you’ll need to manually install them after upgrading to 0.16 - we’ll share more details when we get to that release.</p> <h3 id="and-finally">And finally…</h3> <p>Keep a look out for some announcements next week… we have some exciting news to share!</p> Tue, 11 Oct 2016 00:00:00 +0000 Version 0.14 released <p>Node-RED 0.14.3 is now available to <a href="">download</a> or <a href="">npm install</a>.</p> <p>If upgrading, please read the <a href="">upgrade instructions</a>.</p> <p>If you are using the pre-installed version on Raspberry Pi Jessie, the repositories will be updated in the near future.</p> <hr /> <h3 id="editor-updates">Editor Updates</h3> <p>The biggest change in the editor for this release is the new node edit tray that replaces the old edit dialog. This is something we’ve been working on for a while and was a necessary change to enable some other features in this release.</p> <p>Knowing it was a big change, we made a demo of it available to the community a few weeks ago. That led to lots of great feedback that has helped us to refine the design along the way.</p> <p><img src="/blog/content/images/2016/06/edit-tray.gif" alt="" /></p> <p>A really common complaint with the old edit dialog was that you couldn’t interact with the sidebar whilst the editor was open; when you were most likely to want to check the node’s help. With the new edit tray, you can continue interacting with the Info and Debug tabs whilst editing a node.</p> <h4 id="detaching-wires-again">Detaching wires (again)</h4> <p>The last release added the ability to move wires by holding the Shift key when you drag on a node’s port. We’ve updated it in this release so that if one of those wires is currently selected, we’ll only move that one rather than the whole bundle.</p> <p><img src="/blog/content/images/2016/06/move-link.gif" alt="" /></p> <h4 id="re-ordering-tabs">Re-ordering tabs</h4> <p>Yup - re-ordering your tabs. You’re welcome.</p> <p><img src="/blog/content/images/2016/06/tabs-order.gif" alt="" /></p> <h4 id="filtering-the-debug-sidebar">Filtering the Debug sidebar</h4> <p>You can now filter the debug sidebar to only show debug messages coming from nodes on the current tab. When enabled, as you switch tabs the sidebar refreshes with the messages for the tab you’re on.</p> <p>Also, if a message comes from a debug node inside a subflow, we’ll highlight the subflow instance node to help you track it down.</p> <h4 id="built-in-change-log">Built-in Change-log</h4> <p>With so many changes going in, it can be hard for users to know what’s changed. Believe it or not, not everyone reads these blogs posts. We’ve now made the change log that lists all the high-level changes in the release available from the drop-down menu.</p> <p>This is a small step in helping users discover new features.</p> <p><img src="/blog/content/images/2016/06/changelog.gif" alt="" /></p> <h3 id="node-updates">Node updates</h3> <h4 id="link-nodes">Link nodes</h4> <p>We’ve added a new pair of nodes that will help you better organise your flows; the Link nodes let you create a virtual wire from the end of one flow to the start of another.</p> <p>If you select a link node it will show the virtual wires on your workspace, including any links that disappear off to another tab. To help you navigate around them, the link to another tab can be clicked and you’ll be taken to that tab and the corresponding link nodes pre-selected.</p> <p><img src="/blog/content/images/2016/06/link-nodes.gif" alt="" /></p> <h4 id="splitjoin-nodes">Split/Join nodes</h4> <p>These have been on the to-do list for a long time and we’ve finally got them into a release.</p> <p>The Split node can be used to break a single message up into a series of messages. For example, if <code class="highlighter-rouge">msg.payload</code> is a String it will split that text using whatever character you want so you get a message for each part. An array will get split into its individual elements and an Object into its key/value pairs.</p> <p>The Join node will, by default, do the reverse of the Split node. If you feed it a series of messages sent by the Split node, it will join them back into their original form. You can also configure it manually for a wide variety of scenarios. Check the node’s help for more information.</p> <h4 id="mqtt-with-tls-support">MQTT with TLS support</h4> <p>The MQTT nodes can now make properly configured TLS connections. This makes use of a new common TLS configuration node where you can provide paths to your certificate files. This node is available for other nodes to start using - take a look at the mqtt-broker node to see how to use it.</p> <p>Whilst we were in there, we’ve added the ability to set the QoS you want to subscribe with on the MQTT In node.</p> <h4 id="http-in-nodes---cookie-support-and-http-patch">HTTP In nodes - cookie support and HTTP PATCH</h4> <p>The HTTP In node has had two significant updates; added PATCH as an option and added a standard cookie parser middleware in the stack.</p> <p>This second item means you can now access any cookies set on the session using <code class="highlighter-rouge">msg.req.cookies</code>.</p> <p>We’ve also made it easier to set/clear cookies using the <code class="highlighter-rouge">msg.cookies</code> property on messages passed to the HTTP Response node. Take a look at the node info for more details.</p> <h4 id="change-node">Change node</h4> <p>A new option has been added to the Change node to move a property - something you could do before in two steps with a ‘set’ followed by a ‘delete’.</p> <p>We’ve also updated the syntax you can use when identifying a property to use a more complete object syntax. For example, you can now access properties such as <code class="highlighter-rouge">msg.payload[1].name</code> or <code class="highlighter-rouge">msg.payload["another property"]</code>. This is true of any of the typedInputs used by a few of the nodes.</p> Tue, 14 Jun 2016 00:00:00 +0000 Version 0.13 released <p>Node-RED 0.13.0 is now available to <a href="">download</a> or <a href="">npm install</a>.</p> <p>If upgrading, please read the <a href="">upgrade instructions</a>.</p> <p>If you are using the pre-installed version on Raspberry Pi Jessie, the repositories will be updated in the near future.</p> <hr /> <p>The 0.13 release brings lots of new features in the editor and internal changes to the runtime.</p> <h3 id="editor-updates">Editor Updates</h3> <p>The Editor has had quite a few little changes that make for a nicer experience when creating your flows.</p> <h4 id="grid-layout">Grid layout</h4> <p>One of our existing hidden features has been the ability to align your nodes to an invisible grid by pressing the Shift key whilst dragging nodes around. We’ve made this more obvious by adding options to <code class="highlighter-rouge">Show grid</code> and <code class="highlighter-rouge">Snap to grid</code> under the new <code class="highlighter-rouge">View</code> menu. If you like everything to line up perfectly, turn these options on and enjoy.</p> <p>Whilst we’re talking about moving nodes, one bit that we know annoyed some of you was that simply moving a node didn’t enable the Deploy button; that you had to make a material change to the flow before you could save changes. You can be annoyed no more - moving a node will now enable the Deploy button. If you select the Modified Nodes or Modified Flows deploy option then your layout changes will get saved without disrupting the running nodes (assuming you haven’t made any material changes as well…).</p> <h4 id="splicing-wires">Splicing wires</h4> <p>How many times have you wanted to drop a node onto an existing wire and have it splice itself into place? Well, now you can. <img src="/blog/content/images/2016/01/splice-wire-1.gif" alt="" /></p> <p>You can only splice in new nodes that are either dragged straight from the palette or that have no existing wires.</p> <h4 id="detaching-wires">Detaching wires</h4> <p>How many times have you wanted to replace a node that has lots of wires coming into it, but then had to manually rewire it? Well, now that’s become much easier. If you hold the Shift key when you start dragging on a node’s port, it will detach the existing wires and allow you to reconnect them elsewhere.</p> <p><img src="/blog/content/images/2016/01/rewire-node.gif" alt="" /></p> <h4 id="configuration-nodes-again">Configuration nodes (again)</h4> <p>In the last release we added some warnings at deploy time to let you know about potential problems. One of those warnings was if you had any unused configuration nodes in your workspace. It was an improvement on what we had before - not telling you anything - but it didn’t gain many fans as it got in the way of the deploy and wasn’t really an error as such.</p> <p>With this release, we’ve gotten rid of that warning. In its place, if you deploy with unused configuration nodes, the normal ‘Successfully deployed’ notification has been extended to tell you about the unused nodes. As this notification disappears after ~8 seconds it doesn’t get in the way of your work flow. Significantly, the message also includes a link which opens up the config node sidebar to show you the unused nodes it’s telling you about.</p> <p><img src="/blog/content/images/2016/01/Node-RED.png" alt="" /></p> <p>The config node sidebar has also been updated to show you all config nodes organised by the flow (tab) or subflow they are on. There are controls at the top of the view to show just the unused ones.</p> <p>We think this addresses all of the comments we’ve received about this particular area - do let us know what you think.</p> <h4 id="edit-dialog">Edit dialog</h4> <p>The free-form nature of the node edit dialog means it is hard for the editor to know if there are unsaved changes in the dialog. Because of this we disabled the ‘hit Escape to close’ behaviour you may expect in such a dialog - so you didn’t accidentally lose your changes. For those of you that don’t like leaving the keyboard, you can now use Ctrl-Escape (Cmd-Escape) to close the dialog and discard any changes. Similarly, Ctrl-Enter (Cmd-Enter) hits the Okay button and applies the changes.</p> <p>One thing we spotted in our own nodes was a lot of repeated boilerplate code to handle layout changes when the edit dialog was resized. To make that easier a node’s definition can now include an <code class="highlighter-rouge">oneditresize</code> function that is called whenever the dialog is resized. The core nodes have been updated to use it so you can see how it can be used, for example, with the <a href="">Catch node</a>.</p> <h4 id="typedinput-widget">TypedInput widget</h4> <p>The Change node has been updated to support a richer set of property types. Previously, it could only set a message property to a String value. Now, you can pick from a selection of types using the new <code class="highlighter-rouge">TypedInput</code> widget added in this release.</p> <p><img src="/blog/content/images/2016/01/Node-RED-1.png" alt="" /></p> <p>In that list you’ll see <code class="highlighter-rouge">msg.</code> - which copies one message property to another. You’ll also see <code class="highlighter-rouge">flow.</code> and <code class="highlighter-rouge">global.</code> - more on those in a bit.</p> <p>The JSON option lets you provide a JSON string and it will be parsed to the equivalet JavaScript object. All in all, very handy.</p> <p>The Switch node has also been updated to use this widget. One extra option that is particular to the Switch node is the ability to set the property to ‘previous value’. This let’s you create flows that route messages depending on whether the value of the property has changed. We have the <code class="highlighter-rouge">rbe</code> node (report-by-exception) that can do this as well, but adding it to the Switch node makes it easier to do.</p> <p>The Inject node has also been updated so you have a richer set of choices for what payload it injects.</p> <p>The <code class="highlighter-rouge">TypedInput</code> widget is a Node-RED specific jQuery widget that is available in the editor for any node to use. We’ll be sharing documentation for it in the near future - but you can take a look at the updated nodes to see how it’s used.</p> <h4 id="context">Context</h4> <p>Function nodes have had access to the <code class="highlighter-rouge">context</code> object to give them a space to store state between calls. They also had access to <code class="highlighter-rouge"></code> - the context shared by all Function nodes.</p> <p>In this release, we’ve made some updates to how context is accessed, making it available to all nodes and changed how it’s used.</p> <p>Within the Function node, <code class="highlighter-rouge">context</code> has been joined by <code class="highlighter-rouge">flow</code> and <code class="highlighter-rouge">global</code>. These are three separate scopes of context - within the node, the flow (tab) and across all nodes respectively.</p> <p>Each of these contexts now provide a <code class="highlighter-rouge">get(key)</code> and <code class="highlighter-rouge">set(key,value)</code> pair of functions for accessing the data within them. You can still just attach properties to these objects, for example <code class="highlighter-rouge"> = 1;</code> so existing flows won’t be affected, but doing so is now discouraged in favour of <code class="highlighter-rouge">context.set('foo',1);</code>. This is the first step to the goal of being able to save and restore the context objects across Node-RED restarts.</p> <p>As mentioned earlier, the Inject, Switch and Change nodes are now all able to access the <code class="highlighter-rouge">flow</code> and <code class="highlighter-rouge">global</code> contexts and the Template node can be used to set context properties.</p> <p>The <a href="">documentation on writing Functions</a> has been updated with more details.</p> <h3 id="runtime-updates">Runtime updates</h3> <p>The Admin API has some new additions:</p> <ul> <li>the <a href=""><code class="highlighter-rouge">/flows</code> endpoint</a> can now be used to trigger a reload and restart of the of the active flow configuration by setting the <code class="highlighter-rouge">Node-RED-Deployment-Type</code> header to <code class="highlighter-rouge">reload</code>.</li> <li>the new <code class="highlighter-rouge">/flow</code> endpoint has been added with actions to <a href="">add</a>, <a href="">get</a>, <a href="">update</a> and <a href="">delete</a> an individual flow (tab) without distrupting the other flows.</li> </ul> <p>The runtime itself has been reorganised to better separate the core runtime from the parts that provide the admin api and editor. We’ve also stabalised the runtime api to the point where we can start <a href="">documenting</a> it. We wanted to have it fully documented in time for the release, but inevitably that hasn’t happened - we’re working on it.</p> <p>One note to anyone who has started creating message translations of your own, the catalog files for the editor and runtime have moved. They are now:</p> <ul> <li><code class="highlighter-rouge">red/api/locales/en-US/editor.json</code></li> <li><code class="highlighter-rouge">red/runtime/locales/en-US/runtime.json</code></li> </ul> Mon, 18 Jan 2016 00:00:00 +0000