A visual tool for wiring the Internet of Things

This is not a plugin, but a page where is described how you can use Node-RED together with DomotiGa.

Installing Node.js

Notes for Ubuntu 14.04

Removing the previous Node.js version.
You can skip these steps if you are installing Node.js for the first time. Else run the commands below to remove a previous Node.js installation.

$ dpkg --get-selections | grep node
node install
If you find any previous “node” installed then run the following command to wipe it out entirely.

$ sudo apt-get remove --purge node nodejs

We need a newer version (>4.0) than the one distributed with Ubuntu. (0.10)
$ cd ~
$ mkdir -p install/nodejs
$ cd install/nodejs
$ curl -sL | sudo -E bash -
$ sudo apt-get install -y nodejs

  1. Run `apt-get install nodejs` (as root) to install Node.js 5.x and npm

$ sudo apt-get install nodejs
$ node -v
$ npm -v

Installing Node-RED

We have successfully configured Node.js, we can now download Node-RED.
The latest Node-RED version can be fetched from it's GIT repository so that we can work on it's most recent version updated with any new commits.

To download from GIT, you must make sure that you have GIT package installed.
If it is not there, run the following command to get the GIT installed on your system.

$ sudo apt-get install git-core

After successfully installing GIT, navigate to your home directory to continue with Node-RED installation.
I’ll now list out the steps that you will be executing to first clone the Node-RED repository and then install it using the “npm” command which is the Node Package Manager that we had earlier setup during Node.js installation.

$ cd ~
$ mkdir -f install
$ cd install
$ git clone
$ cd node-red
$ sudo npm install

Starting Node-RED

To start node-red simply run.

$ node-red

Welcome to Node-RED

7 Jan 20:25:22 - [info] Node-RED version: v0.12.5
7 Jan 20:25:22 - [info] Node.js  version: v5.4.0
7 Jan 20:25:22 - [info] Loading palette nodes
7 Jan 20:25:22 - [warn] ------------------------------------------
7 Jan 20:25:22 - [warn] Failed to register 1 node type
7 Jan 20:25:22 - [warn] Run with -v for details
7 Jan 20:25:22 - [warn] ------------------------------------------
7 Jan 20:25:22 - [info] Settings file  : /home/ron/.node-red/settings.js
7 Jan 20:25:22 - [info] User directory : /home/ron/.node-red
7 Jan 20:25:22 - [info] Flows file : /home/ron/.node-red/flows_rdznl.json
7 Jan 20:25:22 - [info] Server now running at
7 Jan 20:25:22 - [info] Creating new flow file
7 Jan 20:25:22 - [info] Starting flows
7 Jan 20:25:22 - [info] Started flows

The [warn] lines are caused by trying to load raspberry pi stuff, you can investigate this with the -v option as described.

$ node-red -v

Node-RED is now available on the default port 1880…

Now we are all set to open the Node-RED session into the browser.
Open your default browser and type the following URL to see the Node-RED interface.


You will be presented with a blank work-space into the browser window with all the default functional “nodes” tiled on the left side of the screen. You can now play around using drag and drop to start linking things together.

Connecting to DomotiGa

There are several options:
By using JSON-RPC calls, or publishing to a MQTT topic where DomotiGa is listening on.

More information follows.

Example Flows

Nefit Easy Status and Control

A small example showing you how to read data from a Nefit Easy and publish this via MQTT so DomotiGa picksup the values.
The other way around you can alter the setpoint of the thermostat by controlling a setting device value.

It has a small disavantage because we need to split up the thermostat control and status values across a few devices.
We can also use JSON-RPC instead of MQTT as output, this way we can combine them, this will be described later, or you can have a try yourself.

You need to install the following:

*Node.js >4.0 (you have that already if you followed above instructions)

*Mosquitto MQTT
Configured DomotiGa to use MQTT

*Nefit Easy Client

Continue with the installation of the Nefit Easy Client.

$ npm i nefit-easy-cli -g

The code and instructions can be found here

Create these scripts, fill with correct values.
$ sudo mkdir -p /opt/nefit

$ sudo vi /opt/nefit/nefit-status
easy status

$ sudo vi /opt/nefit/nefit-pressure
easy pressure

$ sudo vi /opt/nefit/nefit-set
easy set temperature "$*"

$ sudo chmod +x /opt/nefit/nefit-*

Run the status script, it should return something like this.

@$ /opt/nefit/nefit-status {"user mode":"clock","clock program":"auto","in house status":"ok","in house temp":19,"boiler indicator":"off","control":"room","temp override duration":0,"current switchpoint":24,"ps active":false,"fp active":false,"temp override":false,"holiday mode":false,"boiler block":null,"boiler lock":null,"boiler maintainance": null,"temp setpoint":19,"temp override temp setpoint":19.5,"temp manual setpoint":19.5,"hed enabled":null,"hed device at home":null,"outdoor temp":10,"outdoor source type":"virtual"}@

You are now ready to configure Node-RED and DomotiGa

Open Node-RED and on a blank page import the next code.

[{"id":"dcbe5f11.2341a","type":"mqtt-broker","broker":"","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"willQos":"0","birthQos":"0"},{"id":"fc9c0635.0363f8","type":"inject","z":"aabcd525.554328","name":"","topic":"nefit-update","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"x":253,"y":110,"wires":[["6fc2915e.903d7"]]},{"id":"6fc2915e.903d7","type":"exec","z":"aabcd525.554328","command":"/opt/nefit/nefit-status","addpay":false,"append":"","useSpawn":"","name":"Nefit Status","x":529.4444427490234,"y":110.66667175292969,"wires":[["8663968c.799c68"],[],[]]},{"id":"56db830e.a9247c","type":"debug","z":"aabcd525.554328","name":"","active":false,"console":"true","complete":"true","x":926.111083984375,"y":166.44444274902344,"wires":[]},{"id":"52d9f2be.ad260c","type":"mqtt in","z":"aabcd525.554328","name":"raw/nefit-set","topic":"raw/nefit-set","broker":"dcbe5f11.2341a","x":233.99998474121094,"y":277,"wires":[["87d8dd06.78272"]]},{"id":"b9d5f3c1.462a1","type":"debug","z":"aabcd525.554328","name":"","active":false,"console":"false","complete":"true","x":924.25,"y":262.75,"wires":[]},{"id":"a7b31194.584cf","type":"exec","z":"aabcd525.554328","command":"/opt/nefit/nefit-set","addpay":true,"append":"","useSpawn":"","name":"Nefit Set Temp","x":707,"y":276.75,"wires":[["b9d5f3c1.462a1"],[],[]]},{"id":"4e09352.fb1f6cc","type":"comment","z":"aabcd525.554328","name":"Catch command from DomotiGa and send to Easy","info":"","x":260.99998474121094,"y":233,"wires":[]},{"id":"8663968c.799c68","type":"function","z":"aabcd525.554328","name":"Create MQTT Payload","func":"var NefitJSON = JSON.parse(msg.payload);\nvar domotiga_msg = {};\n\ndomotiga_msg.payload = {};\n\nif (msg.topic 'nefit-update') {\n domotiga_msg.topic = \"raw/nefit-status\";\n domotiga_msg.payload.value1 = \"\" + NefitJSON['in house temp'];\n domotiga_msg.payload.value2 = \"\" + NefitJSON['outdoor temp'];\n domotiga_msg.payload.value3 = \"\" + NefitJSON['control'];\n domotiga_msg.payload.value4 = \"\" + NefitJSON['boiler indicator'];\n}\nif (msg.topic 'nefit-pressure') {\n domotiga_msg.topic = \"raw/nefit-pressure\";\n domotiga_msg.payload.value1 = \"\" + NefitJSON['pressure'];\n}\n\nreturn domotiga_msg;","outputs":1,"noerr":0,"x":734.5,"y":126.5,"wires":[["d1e1d286.2e1e3","56db830e.a9247c"]]},{"id":"d1e1d286.2e1e3","type":"mqtt out","z":"aabcd525.554328","name":"DomotiGa MQTT","topic":"","qos":"","retain":"","broker":"dcbe5f11.2341a","x":956.25,"y":79.25,"wires":[]},{"id":"d9a60de2.2659f","type":"exec","z":"aabcd525.554328","command":"/opt/nefit/nefit-pressure","addpay":false,"append":"","useSpawn":"","name":"Nefit Easy Pressure","x":507.99999237060547,"y":171,"wires":[["8663968c.799c68"],[],[]]},{"id":"23114874.dceeb8","type":"inject","z":"aabcd525.554328","name":"","topic":"nefit-pressure","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"x":259,"y":171,"wires":[["d9a60de2.2659f"]]},{"id":"f32fff69.0cd","type":"comment","z":"aabcd525.554328","name":"Publish data from Nefit Easy Client to DomotiGa","info":"","x":253.99998474121094,"y":64,"wires":[]},{"id":"87d8dd06.78272","type":"change","z":"aabcd525.554328","name":"","rules":[{"t":"change","p":"payload","from":"Dim","to":"","re":false},{"t":"change","p":"payload","from":"SP ","to":"","re":false}],"action":"","property":"","from":"","to":"","reg":false,"x":438,"y":277,"wires":[["a7b31194.584cf"]]}]

It will look like the flow above.

I used the following params
MQTT broker: localhost:1883
Status Topic raw/nefit-status
Control Topic raw/nefit-set
Water Pressure Topic raw/nefit-pressure

It gathers the following values:

Room Temp, Outside Temp, Control mode, Boiler Status.
But you can change/add them in the Node-RED flow if you want.

Bar pressure

Create the devices like this:

It's not the most ideal construction yet, but it's a start.

Two notes:

We can change the Control device in a Shell device type and directly call /opt/nefit/nefit-set, we only have to strip the Dim and/or SP part from the argument.

We can use JSON-RPC instead of MQTT altogether, this give the possibility to set specify value numbers without changing the others of the same device.
So we can combine the status and pressure device into one.

Related Resources

    Updated by: rdnzl, Updated about 1 year ago
    Access count: 9742 since 2016-01-09

    node-red-logo.png (13 KB) rdnzl, 01/09/2016 12:47 PM

    nefit-domotiga.png (14.1 KB) rdnzl, 01/09/2016 03:38 PM

    nefit-easy-flow.png (52.6 KB) rdnzl, 01/09/2016 03:38 PM

    nefit-thermostat.png (51.3 KB) rdnzl, 01/09/2016 03:46 PM

    nefit-control.png (51.1 KB) rdnzl, 01/09/2016 03:46 PM

    nefit-control-options.png (48.9 KB) rdnzl, 01/09/2016 03:46 PM

    nefit-pressure.png (52.3 KB) rdnzl, 01/09/2016 03:47 PM

    Also available in: PDF HTML TXT