node-red-contrib-norelite
A set of Node-RED nodes to ease the implementation of your home automation requirements.
The package is the successor to the npm package norelite. The package/repo was changed due to a major restructuring and changes to the code base as well as the interaction format between the nodes has changed.
Install
cd ~/.node-red
npm install node-red-contrib-norelite
Additional nodes that can be used with node-red-contrib-norelite can be found here:
Get started
I know, there are many nodes and reading the documentation is not that fun. Start by taking a look at the exmples that you get when you install the bundle. Examples are available through the Node-RED UI at Import -> Examples
What is it?
Simplified, node-red-contrib-norelite is a set of Node-RED nodes that are designed to managed your simple and complex rules that controls your IoT enabled devices. It includes plenty of nodes to manage incoming values, create rules based on the values, utilities to change the instructions and and some device nodes to convert the instructions into a message that can be understood by the transmitting node that finally will transmit the instruction to your IoT device such as a lamp or power switch.
The simplest flow of events is:
- Store an incoming value in a source node
- A rule will compare the value in a rule node
- A device node converts the internal messaging format to an instruction that can be understood by the transmitting node. E.g. Tellstick (node-red-contrib-tellstick), Z-wave (node-red-contrib-openzwave), rfxcom (node-red-contrib-rfxcom) or any custom node as the messaging format is simple.
But there is much more to it... and the nodes should be well described in the node descriptions.
Basic structure and order
- Collect data - use nrl-source to store the data to be used by the nrl-eval nodes
- Define action flows
- Evaluate rules - use nrl-eval or nrl-on to start a new flow
- Apply filters - use utility nodes
- Calculate final instruction - use nrl-switch that can take multiple inputs
- Convert the instruction for the device that is to be controlled - use device nodes
- Connect to transmitting nodes or go through nrl-limit to limit the load on the transmitting node (e.g. node-red-contrib-tellstick)
The nodes are divided into 3 categories
( * ): Message in/out should support the messaging format as per below
- Core
nrl-source
: Stores incoming values. Stateful
nrl-eval
: Evalutes the values and generates a message. Stateful (*)
nrl-limit
: Can be used to intelligently limit load on the transmitting node. Input should come from a Device node as the messaging format is unique for this node
nrl-on
: Always send on turn on instruction. Stateful (*)
nrl-switch
: Takes multiple inputs, session persistent storage of the messages, calculates the outbound message and onsly sends an instruction if the result has changed. Stateful (*)
- Util
nrl-dayslimit
: Filters based on weekday (*)
nrl-timelimit
: Filters based on time of day (*)
nrl-hold
: Hold the state for a defined time (*)
nrl-set
: Overrides the incoming values (*)
nrl-value
: Changes the dim value (*)
nrl-gate
: Routes message based on rules (2 outputs). Similar to nrl-eval but is stateless and the inbound message can be of any format
nrl-route
: Routes message based on msg.payload.enabled (2 outputs). See messaging format below. (*)
- (
nrl-color
is found in node-red-contrib-norelite-color package): Changes the color value in HEX (*)
- Device
Let me know if you have created more nodes that I can add to this list.
Messaging format
Between the Node-RED nodes the following messages will be sent (with the exception from the device nodes and limit node):
msg.payload = {
id : '31728023.39c83', //the node.id of the sending node
enabled: true, //is the message instruction active (on/off)
type: 0, //prioritization value (used by the switch node). Default '0'
dim: 100, //dim value 0-100
color: '#FFFFFF' //for use of color enabled devices
}
id is used for the switch node that keeps a record of all incoming messages and from where it was sent in order to calculate the outbound message from the node.
Examples
Look in the examples folder