Since a couple of years I use a Nefit Easy thermostat to control my heating at home. This instruction allows you to control and read the thermostat from your Domoticz home automation.
First I asume you already have Domoticz up and running. I run it on a RaspBerry Pi using Raspian Buster.

Install the Nefit Easy server

First connect to your Raspberry Pi using SSH.
Then we have to install some components
– NodeJS
– NPM
– PM2
– Nefit Easy Server

To do so run the following commands

sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install nodejs 
sudo apt-get install npm
sudo npm install pm2 -g 
sudo pm2 startup 
sudo npm i nefit-easy-http-server -g

After installing the components you have to create a script called nefiteasyhttpserver.sh
Create the script by running touch nefiteasyhttpserver.sh
Edit the script using nano nefiteasyhttpserver.sh and put the following content in the script

#!/bin/bash
/usr/bin/easy-server --serial=<serial number> --access-key=<access-key> --password=<pincode> --host=127.0.0.1 >/dev/null

The credentials you must use are the same you use when accessing the Nefit Easy through the Android or IOS app.
After saving your script you must make it executable by running: chmod 755 nefiteasyhttpserver.sh
I experienced some linux versions or nodejs versions use a different path. I am not 100% sure what it is. If it is not working try changing the location in the nefiteasyhttpserver.sh file in /usr/local/bin/easy-server After that the file looks like this:

#!/bin/bash
/usr/local/bin/easy-server --serial=<serial number> --access-key=<access-key> --password=<pincode> --host=127.0.0.1 >/dev/null

If you run Raspbian Buster unfortunately we have to lower the minimum encryption: sudo nano /etc/ssl/openssl.cnf and add the following lines toe the file:

MinProtocol = None
CipherString = DEFAULT

Start the script by running: sudo pm2 start /home/pi/nefiteasyhttpserver.sh
To check the scipt is running enter: sudo pm2 list
The output looks like:

pi@pi-hostmane:~ $ sudo pm2 list
┌────┬─────────────────────────┬─────────┬─────────┬──────────┬────────┬──────┬──────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name                    │ version │ mode    │ pid      │ uptime │ ↺    │ status   │ cpu      │ mem      │ user     │ watching │
├────┼─────────────────────────┼─────────┼─────────┼──────────┼────────┼──────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ 0  │ nefiteasyhttpserver     │ N/A     │ fork    │ 460      │ 2D     │ 0    │ online   │ 0%       │ 1.8mb    │ root     │ disabled │
└────┴─────────────────────────┴─────────┴─────────┴──────────┴────────┴──────┴──────────┴──────────┴──────────┴──────────┴──────────┘

Do not forget to make it start through reboots by running sudo pm2 save
In case you have problems you can run sudo pm2 show <id> (were the <id> is the number in the id column above). If you run the command you see a output similar as below. All the locations of the scripts and logs are displayed, You can view them for troubleshooting.


pi@pi-hostname:~ $ sudo pm2 show 0
 Describing process with id 0 - name nefiteasyhttpserver
┌───────────────────┬───────────────────────────────────────────────┐
│ status            │ online                                        │
│ name              │ nefiteasyhttpserver                           │
│ version           │ N/A                                           │
│ restarts          │ 0                                             │
│ uptime            │ 2D                                            │
│ script path       │ /home/pi/scripts/nefiteasyhttpserver.sh       │
│ script args       │ N/A                                           │
│ error log path    │ /root/.pm2/logs/nefiteasyhttpserver-error.log │
│ out log path      │ /root/.pm2/logs/nefiteasyhttpserver-out.log   │
│ pid path          │ /root/.pm2/pids/nefiteasyhttpserver-0.pid     │
│ interpreter       │ bash                                          │
│ interpreter args  │ N/A                                           │
│ script id         │ 0                                             │
│ exec cwd          │ /home/pi/scripts                              │
│ exec mode         │ fork_mode                                     │
│ node.js version   │ N/A                                           │
│ node env          │ N/A                                           │
│ watch & reload    │ ✘                                             │
│ unstable restarts │ 0                                             │
│ created at        │ 2019-11-10T10:06:52.841Z                      │
└───────────────────┴───────────────────────────────────────────────┘
 Divergent env variables from local env
┌──────────────┬────────────────────────────────────────────────────────────┐
│ SUDO_COMMAND │ /usr/bin/pm2 start /home/pi/scripts/nefiteasyhttpserver.sh │
└──────────────┴────────────────────────────────────────────────────────────┘

 Add your own code metrics: http://bit.ly/code-metrics
 Use `pm2 logs nefiteasyhttpserver [--lines 1000]` to display logs
 Use `pm2 env 0` to display environment variables
 Use `pm2 monit` to monitor CPU and Memory usage nefiteasyhttpserver

Adding the Nefit Easy server to Domoticz

After doing all the CLI work at your linux installation, browse to your Domoticz webpage and perform the instructions below

Now the hardware is added and after a few minutes the devices should appear:

If they do not appear make sure the “Accept new Hardware Devices” is enabled or hit the “Allow for 5 minutes” button in settings.

That’s it!

One Reply to “Make your Nefit Easy thermostat work with Domoticz”

  • Hi Edwin,

    I don’t know how to thank you for this information.
    I run my self written domotics software which partially uses Domoticz running on a mini-PC under Windows 10. I port the sensor data to mij software through SQL request on the Domiticz.db.
    I had a spare Raspberry so installed the Nefit-Easy server on that. I connected the two Domoticz so now get the Raspberry data in my Windows Domoticz where I can port it to my software. Next step is to port everything to the Raspberry such as the Smart meter.
    Thanks again,

    Rob

Leave a Reply

Your email address will not be published. Required fields are marked *