name: inverse class: center, middle, inverse layout: true .header[.floatleft[.teal[Christopher Biggs] — Node-RED Intro].floatright[.teal[@unixbigot] .logo[@accelerando_au]]] .footer[.floatleft[.hashtag[IoTBNE] Apr 2019]] --- layout: true name: callout class: center, middle, italic, bulletul .header[.floatleft[.teal[Christopher Biggs] — Node-RED Intro].floatright[.teal[@unixbigot] .logo[@accelerando_au]]] .footer[.floatleft[.hashtag[IoTBNE] Apr 2019]] --- layout: true name: toply class: center, toply, italic, bulletul .header[.floatleft[.teal[Christopher Biggs] — Node-RED Intro].floatright[.teal[@unixbigot] .logo[@accelerando_au]]] .footer[.floatleft[.hashtag[IoTBNE] Apr 2019]] --- layout: true template: callout .header[.floatleft[.teal[Christopher Biggs] — Node-RED Intro].floatright[.teal[@unixbigot] .logo[@accelerando_au]]] .footer[.floatleft[.hashtag[IoTBNE] Apr 2019]] --- template: inverse # Node-RED, an Introduction .bottom.right[ Christopher Biggs, .logo[Accelerando Consulting]
@unixbigot .logo[@accelerando_au] ] --- layout: true template: callout .crumb[ # Welcome ] --- class: vtight # Who am I? ## Christopher Biggs — .teal[@unixbigot] — .logo[@accelerando_au] * Brisbane, Australia * Previously: Programmer, Architect, Developer Lead * Convenor, Brisbane Internet Of Things Meetup * Founder, .logo[Accelerando Consulting] * Accelerando is a "full service" consultancy - chips to cloud ??? I founded Accelerando Consulting which helps businesses use technology to reduce stress. Really, that's what I believe, that technology is the gradual process of freeing humanity from drudgery and fear, and I started Accelerando because I wanted to contribute to a future that I will be excited to live in. And that's what I want to talk about today, some ways to enjoy the awesome benefits of technology while avoiding a few pitfalls. --- # Agenda * Node-RED in a nutshell * Nodes and Flows and Dashboards, Oh My! * IoT, Data visualisation, Glue APIs ??? This presentation will give you a whirlwind tour of how the Node-RED visual programming system makes it easier than ever before to connect all data that surrounds us, and make it do more for us. Javascript just gets everywhere. And the Node-dot-js ecosystem has code for talking to so many other systems that it's uniquely placed to be the duct tape in your data toolbox. --- layout: true template: callout .crumb[ # Welcome # Node-RED ] --- template: inverse # Introducing Node-RED ??? * A project of the IBM Emerging technology group * Visual system for wiring the internet of things * Flow based data processing (obsolete programmers) * Integrated dashboarding * Javascript (duh) --- .fig80[ ![Front door flow](nodered-frontdoor.png)] .spacedown[ # Open Sesame] ??? * an example to give you flavour * all the key concepts - inputs, messages, formatting, outputs * Node library at left * Tab bar at top * Deploy Button * Orange==Javascript --- .fig27[![](blynk_dashboard_home.png) ] .fig27[![](ui_dashboard_home.png) ] .spacedown[ ##Dashboard Awesomesauce] ??? Monitor environment, security, power usage Control lighting, ventilation, blinds etc Web and App control panels (incl mobile) Pluggability --- .fig27[![BI Goal Display](blynk_bi_goals.png) ] .fig27[![BI Error Display](blynk_bi_errors.png) ] .spacedn.nolm[ ## BI Supervillain Lair * Collect info from databases and message brokers * Interact with social media and chat platforms ] ??? In the workplace, Node-RED plugs into pretty much every database, message bus and notification system out there. What I see in the BI world is that everyone wants to be your one stop shop, so you typically end up with a number of silos that meet maybe 80% of your business needs, and don't play well with others. If you have your traffic data in elastic search, and your sales data in postgres, and your server status in redis, then if you want to produce some report or alert combining pieces of that you can build a flow in Node-RED that pulls all the information together. You can push the answers you come up with out by email, or web api, or slack, to a dashboard, or whatever. You can monitor what people are saying about you on social media and pick up on dips in sentiment hopefully in time to avoid a faceplant. --- template: inverse # Nodes and Flows and Dashboards, Oh My! --- layout: true template: callout .crumb[ # Welcome # Node-RED # Concepts ] --- ## Installation and Setup * `sudo npm install -g node-red`, or * `docker run nodered/node-red-docker` - Optional Authentication (see config file in `~/.node-red`) - Can also serve assets and APIs at configurable paths - Check out my starter project here: [github.com/unixbigot/iotlab](https://github.com/unixbigot/iotlab) ??? So how do you use Node-RED? * Easy to install from NPM - Out of the box in RasPi - See my blog soon for EC2 * Runs as a daemon - Listens on port 1880 - Everything is configurable, commented out examples - Separate area for static files - Separate area for web APIs * Interactive web editor is the core interface - Nodes are like subroutines (but more) - Flows are programs - Messages travel through flows --- ## Step One # Select **nodes** from palette ??? So whats the process. Nodes are npm modules. Nodes take an input, and produce one or more outputs. --- ## Nodes * Inputs: Manual, Timers, Network, IoT, PubSub, Database * Processing: Filter, Smooth, RBE, Analyse, Format * Output: web, email, Dashboard, PubSub, Alerts, SocMed, Chat, IoT * Services have configuration nodes * Function nodes run arbitrary code * Nodes are in own namespace, various levels of "globals" * Huge node library, installable as `npm` modules ??? * Three kinds of nodes - Inputs (generate messages) - Filters (process and propagate messages (or not)) - Outputs (receive messages, do stuff) * Configuration nodes for services * Function node can do pretty much anything (but don't) * Status text and symbols for nodes * Make your own nodes as simple npm modules --- ## Step Two # Connect nodes into **flows** ??? Flows programs. Save as JSON, organise into libraries --- .fig60[![Simplest flow example](simplest_flow.png) ] .nolm[ ## Flows * Drag and drop flow construction * Debug sidebar * Flows are JSON data * clipboard exchange * easy to track and review changes ] ??? * Flows are collections of connected nodes - Select a data source - Drag in a debug node - Build in stages - Deploy, or refresh to abort * Multiple inputs, use topic to distinguish * Nodes may output mulitiple messages, or to multiple links (or both) * Organise flows into libraries, easy cut and paste * Its all JSON, amenable to change tracking and code review * Links can be moved in editor * Links can jump tabs using 'link' node --- ## Step Three # **Messages** travel through flows ??? A message is a json object, typically a topic and a payload. External message systems as senders or recipients. Input nodes - events or timers --- ## Messages * Node receives an input as an object called `msg` * Most nodes operate on `msg.payload` * `msg.topic` often used to distinguish message type * Delayed message output is possible (eg after callback) * Handy features for rate limiting ??? * Messages are javascript objects * Some conventions - payload, topic * Query results and files easily converted to/from msg * Nodes can output more than one message per input message - ...or none - ...or asynchronously * Rate limiting and deadband filter are handy for avoiding message overload --- .fig80[ ![slack](slack_hooks.png)] .spacedown[ # A **lot** of nodes.] ??? * 800+ node modules. * Inputs output obs. * Messages, databases * Signal processing * Social Media- --- ## Dashboards .fig50l[![Dashboard editor](dashboard_editor.png) ] .fig50r[![Dashboard UI](dashboard_ui.png) ] ??? * One last concept - Own dashboarding now built in * site:1880/ui * Push values to widgets - Buttons, sliders, text, gauges, charts * Arrange widgets into groups and tabs * Responsive, presents well on mobile * Really great for smart TVs or tablets --- layout: true template: callout .crumb[ # Welcome # Node-RED # Concepts # Applications ] --- template: inverse # Applications of Node-RED --- # Applications * IoT and Home Automation * Robotics & SCADA * Business Dashboarding * Rapid API development * Social Media Integration (cf. IFTTT) --- # IoT and Home Automation * Subscribe to MQTT messages * Read local or remote sensors * Control many IoT device families: - Smart appliances (eg Philips Hue) - Talk to other hubs (Amazon, Google, Apple) - Anything with a remote control (TVs, garage doors, lights, pools) --- # Environment monitoring .fig80[![Sensors to blynk](sensors_to_blynk.png) ] --- .fig30l[![Blynk Dashboard](blynk_dashboard_home.png) ] .fig30r[![UI Dashboard](ui_dashboard_home.png) ] .spacedown[## Environmental Dashboards ] --- # Robotics & SCADA * Read/Write pins on Raspberry Pi and other SBCs * Tethered Arduino etc. * PID control * Geolocation and mapping --- .fig80[![Sensor Tracking](sensors_to_dashboard.png) ] .spacedown[ # Sensor tracking and response ] --- .fig80[![](ventilation.png) ] .spacedown[ # Predictive maintenance] --- .fig80[![](site_finder.png) ] .spacedown[ # Remote monitoring] --- .fig50r[![Home Automation Hub](unix_wall.jpg)] ] # Home Automation Hub * Raspberry Pi running Node-RED * Arduino tethered over USB * Motion Sensors, LED lighting, Door Locks, Weather Display --- .fig80[![Front door flow](nodered-frontdoor.png) ] .spacedown[ # Open Sesame (again)] --- .fig70[![Integrated Office Automation](pamela.png) ] .spacedown[ # Comprehensive office automation] --- .fig50r[![](pamela_sensors.png) ] .nolm.spacedn[ # Accelerando Integrated Office * WiFi and UHF security sensors * IP Cameras * Arm/Disarm from your phone * Remote camera access * Instant notifications of alerts and activity * Sensor health monitoring * Fully wireless with backup battery and 4G ] --- .fig50r[ ![](visionav.png)] .nolm.spacedn[ # Rapid API Development * Create HTTP APIs * Bridge different kinds of APIs (eg REST to PubSub) * Websockets * Work with CSV, JSON and XML data * Interoperate with all kinds of IoT gadgets ] --- .fig80[![Slack Hooks](slack_hooks.png) ] .spacedown[ # Slack to MQTT API] --- # Social Media Integration * Receive feeds from twitter * Recieve feeds from app stores * Post to slack, and monitor channels * Analyse, Summarise, Respond, Alert --- layout: true template: callout .crumb[ # Welcome # Node-RED # Concepts # Applications # Coda ] --- .fig30[ ![](keep-calm.jpg) ] # Recap .nolm.vtight[ * Node-RED is internet duct-tape * Nodes -> Flows <- Messages * Retrofit IoT to stupid tech * Dashboard all the things * Keep an eye on social media, too ] --- ## Resources, Questions .nolm.vvtight[ ### Node-RED - Nick O'Leary, Dave Conway-Jones, et.al. - Website [nodered.org](https://node-red.org) - Code: `npm` or [github](github.com/node-red) - Support: google group, slack team ### Me - Christopher Biggs - Related talks - [http://christopher.biggs.id.au/#talks](http://christopher.biggs.id.au/#talks) - Email: .blue[christopher @ accelerando.com.au] - Twitter: .blue[@unixbigot] - BNE IoT Meetup: .blue[@iotbne] - Accelerando Consulting - IoT, DevOps, Big Data - .blue[@accelerando_au] https://accelerando.com.au/ ]