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!

12 Replies 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

  • Great article! Having done all of this I have issues trying to access the webserver. When I run it I always get as answer Error: missing password
    I know the password is correct as I use the same to logon with the iOS app. Any ideas where things are going wrong?

    • This webserver is not to be accessed interactively using a browser. It’s only purpose is to be used with another system. eg Domoticz!

  • Hi, Great help your work. It works just as I love it. Thx!
    Only got a warning. Maybe you can adapt your blog to avoid this. See log below.
    Best regards,
    Peter

    sudo npm i nefit-easy-http-server -g
    npm WARN deprecated node-xmpp-client@3.2.0: this package is deprecated please use https://www.npmjs.com/package/@xmpp/client
    npm WARN deprecated node-xmpp-core@5.0.9: this package is deprecated please use https://github.com/xmppjs/xmpp.js
    npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
    npm WARN deprecated node-xmpp-tls-connect@1.0.1: this package is deprecated please use https://github.com/xmppjs/xmpp.js
    npm WARN deprecated har-validator@5.1.5: this library is no longer supported
    /usr/bin/easy-server -> /usr/lib/node_modules/nefit-easy-http-server/bin/easy-server
    + nefit-easy-http-server@5.0.3
    added 142 packages from 123 contributors in 28.842s

  • Edwin, you made me happy with your article, however my Nefit Easy do not show up in Domoticz>Devices.
    I am sure that the Linux part of your article is correct executed, because I received the same outputs after giving the instructions, shown on your site. Also the Domoticz>Hardware was added as show.
    The only lack is that the Nefit devices are not shown in the Domoticz>Devices.
    Please do you know a way to fix this?
    Arie

  • Dear anyone?
    When running the command sudo pm2 list, I see 4 processing (with id 0… 3) running in stead of 1 process as shown in Edwin’s example, causing unnecessary load and heat to the Raspberry Pi.
    I am unfamiliar to Linux and therefore I am looking for a command to delete or kill the excess 3 processes forever?
    I hope somebody can help me out?
    Arie

      • High Edwin,
        Tnx for your reply.
        Despite my previous question(s)/problems, the Nefit Easy devices are still running perfectly and are coping precious data into my Domoticz.
        Double tnx for that.

        Yes, I tried to follow your instructions in one time, however because I made mistakes, I tried to follow your instructions several times.
        As far as I can track down now, the cause of my problem is the instruction which starts every time a new process in the module
        Hope you can help me out to kill or delete these unnecessary processes.
        Arie

      • I noticed that probalbly imported information enclosed within hooks was deleted in my reply.
        The first one was deleted after the instruction: sudo pm2 start
        The second one was deleted after the module: sudo pm2
        Arie

  • Hi Edwin,

    Thanks for this tutorial to get the Nefit Easy connected to Domoticz.

    I could follow all the steps upto and including the entry in Domoticz hardware, though I had to iterate some of the steps to install nodejs and npm and used the domoticz wiki for the nefit Easy as well, though it is similar. The ‘PM2 list’ and ‘PM2 show 0’, show the same as in the tutorial.

    Anyway Nefit does not show up in the Domoticz devices and in the Domoticz log, I get the error message: ” Nefiteasy: Error getting http data!” .

    Could you perhaps give me a clou on where to look at to find the the reaso for this error.

    Thanks in advance
    Wim

Leave a Reply