background preloader

Node-RED

Node-RED
Related:  Node Red & DatabaseNode-Red

Node-RED The purpose of this flow is to give a early warning of overnight frosts, which for me as a keen gardener allows me to protect tender plants and prevent frost damage, but also to set my alarm clock 15 minutes earlier to clear my windscreen in the morning! It uses a Met Office weather model, which determines the likelyhood of frost by accessing windspeed, air temperature & cloud cover from wunderground.com for the forthcoming evening, and following analysis fires off a 'push' message via pushbullet at midday if frost is likely (could equally be Twitter or whatever). A free developers API key is required from to enable access to the XML data feed, and which is inserted where shown in the 'Get forecast' inject node.

Node-RED : Upgrading Currently we recommend the use of npm version 2 or 3, (4 is NOT recommended), please check which version you have installed by running the command npm -v before upgrading. If necessary run sudo npm i -g npm@2.x hash -r If you have installed Node-RED as a global npm package, you can upgrade to the latest version with the following commands: sudo npm cache clean sudo npm update -g --unsafe-perm node-red To check for outdated nodes that are installed in the user directory you can: cd ~/.node-red npm outdated This will print a list of nodes that can be updated. npm update # to update all nodes, or npm update foo # to only update a node called foo You will then need to stop and restart Node-RED. If you upgrade node.js, for example from v0.10.x to v4.6.x, it is better to stop Node-RED, and then re-install as follows: sudo npm cache clean sudo npm install -g --unsafe-perm node-red You will also need to rebuild any nodes that have binary dependancies. cd ~/.node-red npm rebuild

Wiring your first Flow | Raspberry Pi Hosting Node-Red Before delving into the more advanced ways of using Node-Red it's worth understanding the fundamentals of how the systems works. I will now explain a simple "Hello World" setup using an inject node and a debug node. Firstly open up your instance of Node-Red and locate the inject node. Click and drag the inject node anywhere on to the white canvas in the centre of the screen. Next we find our debug node which is listed under the "outputs" section. Drag the debug node on to the canvas near to your input node. Now you can see that the inject node is an input and therefore has a small grey circle on its right hand side. As you begin to drag you are creating a "wire" between the two nodes. It is worth noting that you can have multiple wires going in to a node. As soon as you change the canvas by adding in new nodes or adding/removing wires between nodes you will notice that the "Deploy" button at the top right of the canvas illuminates red. This opens up the nodes options panel.

Managing Node-Red | Raspberry Pi Hosting Node-Red Node-Red is great out of the box but it can be a bit manual to start, stop and run on boot. The following section will describe a simple init script to do all of the hard work for us. Firstly we create a new init.d file, which is essentially a script for starting, stopping and restarting services under Linux. sudo nano /etc/init.d/node_red sudo nano /etc/init.d/node_red Then copy and paste the following code in to the file. The only thing you may need to change before saving is the directory where node-red is installed on your Pi. For those that have installed Node-Red in a different location just change the following line “cd /home/pi/node-red” to reflect the folder location where Node-Red is installed. #! #! Once you have pasted and updated the above script hit CTRL+X and then Y to save changes. sudo chmod +x /etc/init.d/node_red sudo chmod +x /etc/init.d/node_red Finally to ensure the script will start at boot and stop at shutdown we need to update the rc.d file. Thats it! cd ~/node-red/

Raspberry Pi Hosting Node-Red – Take the crap out of developing automation! – The Internet Of Things IOT - RASPBERRY PI This tutorial will document setting up Node-Red on your Raspberry Pi and getting some of your first automation tasks set up! Now I could harp on a good few hours about what Node Red is and how stupidly awesome it is however they say a picture tells a thousand words.. so below are a few thousand. So as you can see.. its graphical, its easy and its developed by cool guys at IBM..need I say more? Well probably so here is the official take on what Node Red actually is: A visual tool for wiring the internet of things Yes we need more.. so read here.Now that the initial blurb has been given its time to get in to the tutorial. Firstly SSH in to your Pi which will hopefully be running Raspbian or something similar. For the Pi it has been a pain in the past to get Node.js running but luckily there have been some tweaks made by the clever people out there that make our lives easier. As always get the new versions of everything… sudo apt-get update sudo apt-get upgrade Then.. node -v sudo node red.js

Quick Connections for MongoDB with Node-RED After last week’s blog post where we connected an Internet of Things temperature sensor to record data in MongoHQ’s MongoDB instances, one Twitter follower commented that it would have been even easier if we had used Node-RED. We were going to write about Node-RED anyway but were keeping that previous post to the bare essentials. Node-RED is an application that was originally developed for handling the MQTT protocol messages but is far from limited to that. Things like this are best demonstrated though. On the left is a palette of nodes we can drag into the workspace in the centre. This lets us select Twitter credentials (and handles authorisation with Twitter), select what feed we want to search (public, followers or direct messages) and enter what we want to search for. Now to get those messages to MongoDB – we drag a MongoDB out node onto the workspace and double click that to configure it.

Quick Connections for MongoDB with Node-RED After last week’s blog post where we connected an Internet of Things temperature sensor to record data in MongoHQ’s MongoDB instances, one Twitter follower commented that it would have been even easier if we had used Node-RED. We were going to write about Node-RED anyway but were keeping that previous post to the bare essentials. Node-RED is an application that was originally developed for handling the MQTT protocol messages but is far from limited to that. With Node-RED, the processing of messages is visualised as a graphical flow between “nodes” representing input, output or processing by Node-RED. A message is generated at an input node and is passed to any node that node’s out is connected to. Things like this are best demonstrated though. On the left is a palette of nodes we can drag into the workspace in the centre. Now to get those messages to MongoDB – we drag a MongoDB out node onto the workspace and double click that to configure it.

Node-red web page - an example to get you started - layer zero labs NB: I no longer think this is a good way to do this! It was a first go, and there is a lot wrong with it. I intend to revisit the web-page idea at some point, and will post something better then. Now we use Freeboard to display data – there is a freenode node for node-red in the contrib section – it makes it super easy to setup and configure. See for an example of how it looks. A simple node-red web page In the aquaponics installation we’re working on, node-red is running on a raspberry pi controlling an aquaponics system. I wanted to create a simple web page that displays the data from each sensor, updating every 2 seconds. I’m quite new to the Internet of Things and to event-driven programming in general, so if you are already an expert you will probably think my solution is hacky for all the wrong reasons. Components: 1. 2. 3. Http request and response in node-red I jumped in with the node-red bit first, being the most fun.

Related: