Introduction The function node is used to run JavaScript code against the msg object. The function node accepts a msg object as input and can return 0 or more message objects as output. This message object must have a payload property (msg.payload), and usually has other properties depending on the proceeding nodes. In order to use the function node you will need a basic understanding of JavaScript. Click to rate this post! [Total: 0 Average: 0]
Continue readingCategory: programming
A list of node-red programming related posts
Using Subflows and Groups in Node-Red
A node-red subflow is a collection of nodes that appear as a single node in the workspace. They also appear in the node palette and can be added to a flow like any other node. They are effectively reusable groups of nodes much like sub routines in traditionally programs. Any changes to the subflow are effective immediately in all flows using that subflow Click to rate this post! [Total: 0 Average: 0]
Continue readingFunction Node Programming-Arrays,Objects and Loops
To work with node-red function node you will need a basic understanding of JavaScript objects and arrays. An object is a collection of key value pairs separated by a comma and enclosed in braces ({}) Example: let data={“voltage”:100,current:2}; Note that the key doesn’t need to be in quotes but it often is. Click to rate this post! [Total: 0 Average: 0]
Continue readingStoring and Retrieving JSON Data In SQLite
It has always been possible to store JSON Data in an SQLite database as JSON data is simply text data. However what was not previously possible was how to query this JSON data using a key. This changed in version 3.9 in 2015 (SQLite history) and so there is now no need to separate out the JSON data so that you can query using a key. . Click to rate this post! [Total: 5 Average: 4.2]
Continue readingUsing Environmental Variables
Environmental variables are used on operating systems (Linux,Windows etc) to store user and system data. Environmental variables are stored as key value pairs of the form name=value. A common environmental variable on Linux and Windows is the use home directory. On windows this is HOMEPATH and on Linux HOME. Click to rate this post! [Total: 3 Average: 5]
Continue readingWorking With Time- Node-Red Programming
Working With Time is very common in all programming languages. In this tutorial I want to take you through the basics of dealing with dates and times in JavaScript and some code snippets that I commonly use in my flows. Click to rate this post! [Total: 4 Average: 5]
Continue readingNode-Red Message and Object Cloning
As previously discussed in the the understanding the message object tutorial messages are passed between nodes using a message object. This object is a standard JavaScript object and In JavaScript objects are passed by reference and not by value. Click to rate this post! [Total: 1 Average: 5]
Continue readingNode-Red – Storing IOT Data in a SQL Database
IOT data from sensors and other devices usually comes as either a text string usually with key value pairs or more commonly as JSON encoded data. Databases accept a variety of data formats the most common are INT and TEXT. Click to rate this post! [Total: 3 Average: 5]
Continue readingUsing The Node-Red Library
If you want to save a flow or function and reuse it later in another flow on the same computer then you can save it to the local library. To save a flow to the library highlight all nodes in the flow by using CTRL+A then use the main menu (top right) and select Export>Library. Click to rate this post! [Total: 0 Average: 0]
Continue readingUnderstanding and Using Buffers In Node-Red
When data is read from a file or network it is read byte by byte into a data buffer. Data Buffers are temporary storage used for transferring data. To work with binary data we will need access to these buffers. Click to rate this post! [Total: 3 Average: 5]
Continue reading