IBM's Nick O'Leary Demos Node-RED for the Internet of Things
Nick O'Leary presented Node-RED, an open-source project focused on the Internet of Things (IoT), at the last QCon London. The project, created by IBM's Emerging Technology team, provides a browser-based environment for visually "wiring together hardware devices, APIs and online services in new and interesting ways". Node-RED is capable of running on low cost hardware such as the Raspberry Pi and in the cloud and aims to enable developers to "focus on the task at hand and not worry about the plumbing".
After presenting several example use cases of IoT, Nick demonstrated Node-RED's ease of use and versatility by simply using his web browser to create a small message flow that consumed tweets with hash tag #qconlondon, performed a sentiment analysis and simultaneously output the positive ones to a LED panel in front of his speaker desk via a serial port and to the presentation in his browser via WebSockets.
Nick stressed that his examples don't just show how to solve a specific problem, but also highlight the enabling quality of open data and APIs. However, he continued, the diversity of devices and platforms makes that difficult for any individual, because "half of it won't interoperate, everyone has their own API, there are lots of different protocols out there, […] it's a glorious mess". As a result, developers need to "spend more time on the plumbing of a solution than what [they] are trying to achieve".
Node-RED's goal is to change that by providing a browser-based editor, which allows connecting a wide range of 'Nodes' that encapsulate readily available pieces of functionality from a 'Palette' into a 'Flow', configure their behavior and deploy the flow into the Node.js based runtime with a click on a button. For example, the Twitter node knows how to perform the required OAuth authentication flow and how to talk to the Twitter REST API. Developers are shielded from all the integration details.
A QCon attendee, David Laing, skipped the next session after Nick's presentation to put Node-RED to the test:
Node-RED is an intriguing open source solution for 'If This Then That' workflows. I've been able to construct an alerting workflow that pulls in data from our monitoring API and generates an alert when some condition is met, in less than two hours.
The lightweight runtime is usually run standalone, but can be embedded into other Node.js applications too, a recently added headless mode also allows running it without its UI.
Available node types cover a wide range of functionality and are presented in the palette under different categories depending on whether they offer inputs, outputs, functions or specific integrations, for example:
- Hardware – Rasperry Pi, BeagleBone Black, Arduino
- Network – HTTP, TCP, UDP, MQTT, WebSocket
- Parsers – CSV, JSON, XML
- Social – Twitter, Twillio, Email, IRC, RSS, XMPP
- Storage – Filesystem, MongoDB, MySQL, PostgreSQL, Redis
- Analysis – Sentiment, Statistics
Node-RED's user interface offers multiple workspaces to edit different flows in parallel, import of flows from and export to the clipboard and a built-in library. Flows are represented in JSON to ease serialization and exchange, a respective JSON structure can even be dragged and dropped onto the Node-RED editor directly. They can be shared with other users by adding them to the public Flow Library, which creates a private Gist on GitHub on behalf of and owned by the submitter.
The project's source code and issue tracking is available on GitHub, with a collection of extra nodes in a separate repository. The documentation is hosted on its main site, progress and updates are communicated via a blog and a Twitter presence, and an active Google group enables more involved community participation.
Russ Danner May 03, 2015