Advanced - Dependencies installation

Install the tailer library for Python

Install tailer :

$ sudo pip install tailer

Install python-openzwave

Purpose

This not a plugin, but an external library for zwave plugin, is based on python-openzwave software.

python-openzawe and openzawe are in high development, by two different teams, so installing it can be sometimes not so easy. So we propose you different methods to install it.

For the operation of ozwave domogik plugin there is only need part python-openzwave Lib.

Of course you can install part python-openzwave API

Get information from bibi21000 home site form more python-openzwave details.

All information are extracted from the git repository https://github.com/OpenZWave/python-openzwave

Installing python-openzwave from archive

This is the simplest (and the fastest) way to install python- openzwave. It cames with openzwave source files and is already cythonized.

This is surely the best solution to install python-openzwave on a raspberry pi.

Get archive of python-openzwave

You are now ready to download sources of python-openzwave here :

This archive contains sources of python-openzwave and openzwave.

tar xvzf python-openzwave-X.Y.Z.tar.gz

This command will extract all the needed sources. And change to the right directory.

cd python-openzwave-X.Y.Z

Install the needed tools

You must install git and other tools to get sources of python- openzwave and openzwave and build them. Look at the documentation of your Linux distribution to do that.

On a debian like distribution :

sudo make deps

Build process

Now, you can compile sources :

make build

If you have already built python-openzwave or the build failed you can use the clean option :

sudo make clean
make build

Do not use root to build python-openzwave as it will surely fails. Please use a “normal user”.

Installation

You can now install the packages using the following command will.

sudo make install

The installation script create a list of installed files. So you can remove python-openzwave using the following command :

sudo make uninstall

If it fails

Simply remove the python-openzwave-x.y.z directory and extract it again.

Installing python-openzwave from repository

Install the needed tools

You must install git and make to retrieve sources of python-openzwave and openzwave.

On a debian like distribution :

sudo apt-get install -y git make

Get sources of python-openzwave

You are now ready to download sources of python-openzwave :

git clone https://github.com/OpenZWave/python-openzwave

The previous command will create a copy of the official repository on your computer in a directory called python-openzwave.

Install dependencies

You need some tools (a c++ compiler, headers dir python, ...) to build python-openzwave and openzwave library.

On a debian like distribution :

sudo make repo-deps

For non-debian (fedora, ...), you can retrieve the packages needed in the Makefile.

Update and build process

Go to the previously created directory

cd python-openzwave

The following command will update your local repository to the last release of python-openzwave and openzwave.

make update

When update process is done, you can compile sources

make build

Or if you have already build python-openzwave in a previous installation, you can use the clean target to remove old builds.

sudo make clean

Do not use root to build python-openzwave as it will surely fails. Please use a “normal user”.

Installation

You can now ready to install the eggs using the following command :

sudo make install

You can also remove python-openzwave using :

sudo make uninstall

Running tests

You can launch the regression tests using :

make tests

Keep in mind that the tests will “play” with your nodes : switching on and off, dimming, adding and removing scenes, ...

Static vs dynamic (or shared)

The openzwave (c++) lib needs to run as a singleton : it means that it MUST have only one instance of the manager running on your computer.

There is 2 ways of linking libraries with a program :

static : includes a copy of the library in your binary program. This means

that your program has its own instance of the library. This the way the install.sh runs. So you CAN’T have another program (like the control-panel) running when using the python-openzwave library

dynamic or shared : includes a link to the library in your binary program.

This means that your program share the library with other programs. In this case, the instance is owned directly by the library. This the way the debian package works. So you CAN have another program running when using the python-openzwave library. Of course, this program MUST use the shared library.

Creating the zwave device controller

We need to create an udev rule in order to create the device /dev/zwave - check your device It’s suppose your zwave controller is at /dev/ttyUSB0

$ udevadm info --name=/dev/ttyUSB0 --attribute-walk
  • locate your idVendor and idProdroduct

In /etc/udev/rules.d, create a file zwave.rules, and write the following rule

Example, for aeon stick

| SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60",
               SYMLINK+="zwave", MODE="0666"

Other zwave tool

Migrating from python-openzwave 0.2.X to 0.3.0

I need to update source tree of python-openzwave and modules’s names because of a bug in setuptools : https://bitbucket.org/pypa/setuptools/issue/230/develop-mode-does-not-respect-src . Sorry for that.

Update your sources:

git pull

Before building python-openzwave 0.3.0, you must uninstall the old version :

sudo make uninstall

About cython : I’ve made many tests using cython installed via pip : (0.20, 0.21 and 0.22). Compilation is ok but a segfault appears when launching the tests. Please remove it.

sudo pip uninstall Cython

You also need to make some minor updates in you code, look at CHANGELOG

If you have problems, please submit an issue with :

  • cython -V
  • the content of the directory /usr/local/lib/python2.7/dist-packages/ (for python2.7)
  • the content of /usr/local/lib/python2.7/dist-packages/easy-install.pth (for python 2.7)

Ubuntu 64bits ... and the others

If you’re using Ubuntu 64 bits (and mayde others) and keep your distribution up to date, you certainly have the segfault problem.

It appears with the last update of python :

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

I’ve open a discussion on cython-users here : https://groups.google.com/forum/#!topic/cython-users/mRsviGuCFOk

The only way I found to avoid this is to rebuild and reinstall the old release of python :

wget https://launchpad.net/ubuntu/+archive/primary/+files/python2.7_2.7.6-8.dsc https://launchpad.net/ubuntu/+archive/primary/+files/python2.7_2.7.6.orig.tar.gz https://launchpad.net/ubuntu/+archive/primary/+files/python2.7_2.7.6-8.diff.gz

dpkg-source -x python2.7_2.7.6-8.dsc

sudo apt-get build-dep python2.7

cd python2.7-2.7.6

dpkg-buildpackage

Wait, wait and await again :)

cd ..

sudo dpkg -i *.deb

To prevent future updates of python, you could mark its packages. For example, if you use apt to update your distribution, use the following command :

sudo apt-mark hold idle-python2.7 libpython2.7-minimal python2.7-dbg python2.7-minimal libpython2.7 libpython2.7-stdlib python2.7-dev libpython2.7-dbg  libpython2.7-testsuite python2.7-doc libpython2.7-dev python2.7 python2.7-examples

Some users have reported that building python-openzwave using the archive (INSTALL_ARCH) can also do the trick. Let me know if it works for you.

Openzwave control-panel

In order to identify your network and collect the NodeID of your devices, you can use the openzwave-control-panel