From Domoticz
Jump to: navigation, search

This page describes how to compile/build the latest beta snapshot of Domoticz for Debian-based Linux operating systems.
This procedure has been tested on Ubuntu Server 14.04 LTS and 16.04 LTS

Installing the required libraries

Note: If you are running Ubuntu 16.04 or higher it is recommended to use apt instead of apt-get.

First update your system:

sudo apt-get update
sudo apt-get upgrade

This could take a while if you haven't done it recently.

Then install the development tools and libraries needed for compiling Domoticz:

sudo apt-get install build-essential nano cmake git libboost-dev libboost-thread-dev libboost-system-dev
sudo apt-get install libsqlite3-dev curl libcurl4-openssl-dev libssl-dev libusb-dev zlib1g-dev python3-dev

Fixing possible dependency problems with Ubuntu 12.04 LTS and older

Using the above method on older versions of Ubuntu (12.04 LTS) may result in the compilation failing with errors like: error: ‘class boost::asio::io_service’ has no member named ‘stopped’ In this situation you need to update your boost libraries to a later version than that installed by apt-get. The simplest way to do this is to follow the instructions on the Raspberry Pi page HERE

CMake version

To use Python Plugins cmake version 3.0.1 or above is required so that Python 3 is discovered properly. To discover the version of cmake on your system use:cmake --version. If it is at not at least version 3 the cmake process can not find python 3.

Download and build 3.2.2 of cmake using:

sudo apt-get install build-essential
tar xf cmake-3.2.2.tar.gz
cd cmake-3.2.2
sudo make install

Compiling/building the Domoticz binaries

Note: If you need support for Z-Wave and/or Tellstick you need install support for them before compiling Domoticz. Read in the following sections how to install support for Z-Wave and Tellstick.

Compiling will take about 10-15 minutes on a slower PC. If you have a multicore system you can pass the -j flag to 'make' to use several cores, which is a lot faster. On a quad (four core) system you can for example write make -j4 instead of only make.

Get the latest Domoticz sourcecode and compile/build by running:

cd ~
git clone domoticz
cd domoticz
cmake -DCMAKE_BUILD_TYPE=Release .

Note: If you have any hardware connected via USB or serial interfaces you need to enable access to ttyUSB ports before starting Domoticz. Follow these instructions.

Some older Boost libraries on certain hardware can give you If linkage error. In that case you could try adding the flag -DCMAKE_EXE_LINKER_FLAGS=-lboost_atomic to the cmake command.

To start Domoticz type:


When you open your browser at http://ip_of_your_machine:8080, you should be presented with the Domoticz web interface.

For additional parameters of the Domoticz daemon, run:

./domoticz -h

To start Domoticz automatically when the system boots follow these instructions.

Allow non-root user to access ttyUSB* ports

If you don't plan on interfacing Domoticz with USB and/or serial devices, you can skip this step.

By default (at least on Ubuntu) a non-root user has no permission to access the ttyUSB* ports. So if you have Domoticz running under a separate user (which is always a good idea to make the system more secure), Domoticz isn't allowed access to your RFXCOM for example. Here are two methods of doing it. For most people the first one by adding the user to the dialout goup is enough and by far the easiest.

Adding the user to the dialout group

This can be done by running the command below:

sudo usermod -a -G dialout YOURUSERNAME

(Where you replace YOURUSERNAME with the user that runs Domoticz.)

Setting up an udev rule

Alternatively you can setup (as root) a udev rule that matches the RFXCOM device. To find which attributes match your device use the command:

udevadm info -a -p $(udevadm info -q path /dev/ttyUSB1) | less

Where /dev/ttyUSB1 is the device. If you wish to run Domoticz under the YOURUSERNAME credentials, who is member of the YOURGROUPNAME group and your device has serial YOURSERIAL a suitable udev rule would be:


Save it to a file under /etc/udev/rules.d/ with the .rules extention and run:

service udev reload

Unplug and replug the device and execute:

ls -l /dev/ttyUSB*

You should see something like

crw-rw---- 1 domoticz domoticz 188, 1 Nov 10 15:27 /dev/ttyUSB1
lrwxrwxrwx 1 root     root          7 Nov 10 15:27 /dev/ttyUSB21 -> ttyUSB1

The added SYMLINK+= creates an additional link to the device node. This is a static name that is useful when you have multiple usb-serial devices that go into your box. Use the static link in Domoticz. For more information on udev rules have a look here:

Starting Domoticz automatically when the system boots

Init.d Method

To let Domoticz start automatically when the system boots (which is probably the case, as most people run it on a headless server), run the commands below, (You want to end up in /home/YOURUSERNAME/domoticz/)

cd domoticz
sudo cp /etc/init.d
sudo chmod +x /etc/init.d/
sudo update-rc.d defaults

Edit the startup script.

sudo nano /etc/init.d/

The lines you usually need to change are USERNAME, DAEMON and DAEMON_ARGS

DAEMON_ARGS="-daemon -www 8080"
  • Change the USERNAME variable to the user you want domoticz to be run as. It's recommended to run domoticz as its own user and not as root, due to security reasons.
  • If you installed Domoticz in the USERNAME home directory /home/yourusername/domoticz you don't need to change the DAEMON variable. If you installed it in an alternate location for example /usr/local/domoticz/ you should change DAEMON to /usr/local/domoticz/$NAME
  • If you want to use another web interface port change the '8080' in: DAEMON_ARGS="-daemon www 8080" to your own port.

Note: To be able to use ports below 1024, for example the standard port for webbrowsing, 80, you need to run domoticz as the root user.

If you want to see more arguments for DAEMON_ARGS run this in the domoticz directory. This is usually not needed.

./domoticz -h

Domoticz will now start automatically when you reboot your machine.

Manually controlling the Domoticz service

This only works if you followed the above steps.

You can now start/stop/restart and check the status of domoticz with:

sudo /etc/init.d/ start
sudo /etc/init.d/ stop
sudo /etc/init.d/ restart
sudo /etc/init.d/ status

If your system supports it you can instead use:

sudo service start
sudo service stop
sudo service restart
sudo service status

Systemd Alternative

Open the systemd configuration file :

vi /etc/systemd/system/domoticz.service
       ExecStart=/home/domoticz/domoticz/domoticz -www 80 -sslwww 443
       #give the right to open priviliged ports
       ExecStartPre=setcap 'cap_net_bind_service=+ep' /home/domoticz/domoticz/domoticz

Enable the service

systemctl daemon-reload
systemctl enable domoticz.service

Start the service

systemctl start domoticz.service

Updating Domoticz

Once in a while, a new Domoticz version is released, and of course you want to update. You can do this with the commands below:

  1. First stop Domoticz with sudo /etc/init.d/ stop or sudo service stop
  2. Navigate to the directory where Domoticz is installed: cd domoticz (You want to end up in /home/YOURUSERNAME/domoticz/)
  3. Pull the latest Domoticz code from Github: git pull
  4. Compile/build the files that have been downloaded: make && sudo /etc/init.d/ start (Compiling will take a while, but the command will automatically start Domoticz again when compiling is done, so you can go to sleep or do something else in the meantime.)

If all went correctly, Domoticz should be updated to the latest version and should be running again automatically.

Attention: when you use Monit, be sure to disable it before doing the update process, otherwise after you have stopped Domoticz by hand yourself, it will get restarted automatically by Monit within a few minutes (because that is what is Monit should do normally).
Stopping Monit can be done by sudo /etc/init.d/monit stop and after updating it can be started again with sudo /etc/init.d/monit start.
You could also use this command: make && sudo /etc/init.d/ start && sudo /etc/init.d/monit start to update, start Domoticz & start Monit when updating is done.

Script to update almost automatically

For updating almost automatically, i made this script

#! /bin/sh
cd /home/YOURUSERNAME/domoticz/ \
&& sudo /etc/init.d/monit stop \
&& sudo /etc/init.d/ stop \
&& git pull \
&& make \
&& sudo /etc/init.d/ start\
&& sudo /etc/init.d/monit start

Save it as, give it executable rights (chmod +x and call it by sh /home/YOURUSERNAME/
It will change the current path to the Domoticz folder, stop Monit, stop Domoticz, pull binaries, compile, start Domoticz, start Monit again.
Very handy to run & go do something else.

In theory it can work automatically (weekly cronjob for example), however when running as a non-root user (which is the case in my situation), it will ask for the password of the user. But after you have provided the password (almost immediately after the script has started), it will continue without needing any further user input.
In theory it is possible to let it run fully automated, but i myself prefer a bit of feedback (watching afterwards if all went well). If you want to work around this sudo password asking, look here.

Add support for Z-Wave

Follow the steps below if you want to add support for Z-Wave devices in Domoticz. This needs to be done before compiling domoticz.

Install libudev-dev

To install the specific dependencies issue the command:

   sudo apt-get install libudev-dev

Compile OpenZWave

The OpenZWave source directory needs to be in the same directory as the domoticz directory

   cd ~
   git clone
   ln -s open-zwave open-zwave-read-only
   cd open-zwave
   cd ..

The directory should look something like this

   drwxrwxr-x 27 pi pi 4096 aug 12 19:59 domoticz
   drwxrwxr-x 11 pi pi 4096 aug 14 16:30 open-zwave
   lrwxrwxrwx  1 pi pi   10 aug 14 16:32 open-zwave-read-only -> open-zwave

Updating OpenZWave

To update the OpenZWave-part, run these commands:

   cd open-zwave
   git pull
   make clean
   cd ..

Problems when compiling Domoticz with OpenZWave

For people having trouble compiling with OpenZWave try with a fresh source.


instead of

   cmake -DCMAKE_BUILD_TYPE=Release .

when compiling the main Domoticz binary. For more information read this thread on the forum: Link

Problems locating Python

Some users, particularly those on old operating systems see the following message when starting Domoticz:

 2016-12-20 09:44:32.251 PluginSystem: Failed dynamic library load, Python not found on your system. 

this shows that, even though python3 may be on the system, the python library can not be located. This error will not stop Domoticz from starting but will mean that hardware supported by the Python Plugin Framework will not be available. To fix this, find the newest version of python3 for the platform and install the library. For example, RaspberryPi Jessie has python 3.4 on it but the library is not included. Executing:

 sudo apt-get install libpython3.4

should solve the issue. Note that python 3.4 is the earliest support version of python. If the python 3 is installed but Make is not able to progress, try to add


just before find_package(PythonLibs 3.4) in the CMakeLists.txt

If your platform does have a compatible version, for example RaspberryPi Wheezy, then one can be built from source using:

 tar -xvf Python-3.5.2.tar.xz
 cd Python-3.5.2
 ./configure --enable-shared
 sudo make install

Add support for Tellstick

If you need support for Tellstick or Tellstic Duo you need to install telldus-core before compiling Domoticz. On Debian-based systems (For example Ubuntu and Raspbian) telldus-core can be installed by doing the following:

echo "deb stable main" | sudo tee /etc/apt/sources.list.d/telldus.list
wget -q -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install libtelldus-core-dev