Compiling open-zwave-control-panel on a Raspberry Pi 3

I’ve recently started diving into home automation stuff, and of course immediately ran into issues. I purchased a z-wave water sensor and planned to use Home Assistant to monitor the sensor and send me alerts (via pushover) if it detects water. While getting HA installed was quick and easy, the trouble began when I tried to actually read from the sensor. I could see in the OZW_Log.txt log file that the system was receiving data, but the HA log had no event information.

After a bunch of searching, I came across a post talking about using open-zwave-control-panel (ozwcp) to diagnose and configure z-wave devices. Awesome! Sadly, the documentation for this project is lacking, and it took a bit of trial and error to figure out the right steps to get ozwcp build, let alone run. Eventually I figured it out, reconfigured my sensor and everything worked. So to save others the frustration of trying to build ozwcp, I’ve got a quick and simple tutorial for you!


UPDATE: There’s a docker image that’s only slightly out of date, I suggest trying that first before going to the effort of compiling ozwcp. If you don’t have docker installed, follow one of the many tutorials out there, then run this command (where /dev/ttyUSB0 is your zwave controller):

docker run -p 8008:8008 –device /dev/ttyUSB0 openzwave/openzwave-control-panel &>/dev/null &


And now back to our regularly scheduled programming:

Please note, these instructions have only been tested on Raspbian 8 (jessie) on a Raspberry Pi 3. Your milage may vary! All commands are run as root, because I’m lazy.

First, install some (probably) important libraries:

apt-get update
apt-get install libgnutls28-dev libgnutlsxx28

Download, build and install libmicrohttpd

cd
wget ftp://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.19.tar.gz
tar zxvf libmicrohttpd-0.9.19.tar.gz
mv libmicrohttpd-0.9.19 libmicrohttpd
cd libmicrohttpd
./configure
make
make install

Download and build the open-zwave library

cd
git clone https://github.com/OpenZWave/open-zwave.git
cd open-zwave
make

Download open-zwave-control-panel

cd
git clone https://github.com/OpenZWave/open-zwave-control-panel.git
cd open-zwave-control-panel

Open the Makefile and find the following line:

OPENZWAVE := ../
LIBMICROHTTPD := -lmicrohttpd

Change it to:

OPENZWAVE := ../open-zwave
LIBMICROHTTPD := /usr/local/lib/libmicrohttpd.a

Build ozwcp

make
ln -sd ../open-zwave/config

And finally, run it!

./ozwcp -p 8888

Now you can open http://your_system:8888 in a browser to start using the open-zwave-control-panel!

33 comments for “Compiling open-zwave-control-panel on a Raspberry Pi 3

  1. Tom
    April 16, 2016 at 12:59 pm

    Great tutorial. I also had to set the location for LIBMICROHTTPD in the Make File for open-zwave-control-panel.

    LIBMICROHTTPD := /usr/local/lib/libmicrohttpd.a

  2. Brendan
    April 29, 2016 at 9:06 am

    Should this be done from within the hass virtualenv?

  3. May 5, 2016 at 5:03 pm

    It does not need to be done in a virtualenv.

  4. James
    May 15, 2016 at 7:13 am

    Thank you. Exactly what I needed.

  5. kktwo
    May 21, 2016 at 7:26 pm

    I’m new to Linux and home automation and I’m following your guide but I’m stuck on “open makefile” What do I have to type to do this?

  6. Dennis
    June 8, 2016 at 8:33 pm

    this is awesome thanks. I’m actualy trying to do the exact same thing (flood sensors with a pi, aeon gen 5 stick, and everspring). Do you have sample configs of your configuration.yaml by chance?

  7. Tim
    July 20, 2016 at 5:13 pm

    @kktwo, use any editor you want. This should do it:

    nano Makefile

  8. Alan
    August 8, 2016 at 11:19 am

    Thanks for the guide, i follow the step, everything go fine until i compile the open-zwave-control-panel.

    g++: error: IOKit: No such file or directory
    g++: error: CoreFoundation: No such file or directory
    g++: error: unrecognized command line option â-frameworkâ
    g++: error: unrecognized command line option â-frameworkâ
    Makefile:72: recipe for target ‘ozwcp’ failed
    make: *** [ozwcp] Error 1

    Any one face this issue?

  9. Alan
    August 9, 2016 at 3:01 am

    I founded is my mistake did not edit the compilation for Linux. Original Makefile

    # for Linux uncomment out next three lines
    LIBZWAVE := $(wildcard $(OPENZWAVE)/*.a)
    #LIBUSB := -ludev
    #LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB) -lresolv

    # for Mac OS X comment out above 2 lines and uncomment next 5 lines
    #ARCH := -arch i386 -arch x86_64
    #CFLAGS += $(ARCH)
    #LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
    LIBUSB := -framework IOKit -framework CoreFoundation
    LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB) $(ARCH) -lresolv

    So just need to comment LIBUSB and LIBS for Mac OS X, then remove the comment for Linux. Then everything will be work.

    Thanks

  10. Billy Tsang
    August 23, 2016 at 10:48 pm

    Hi,

    I am new in Linux. By following your step, I can compile and run open zwave control panel in raspberry pi 3. But I got the problem of Manager::GetDriver failed – Home ID 0x00000000 is unknown no matter I tried /dev/ttyACM0 or /dev/ttyUSB0 in device name box (ozcp). Actually, I created a slink /dev/ttyUSB0 -> /dev/ttyACM0.

    I glanced the manager.cpp although I don’t know C++. It seems to me that no Z-Wave driver is found so Home ID is 0x0000000.

    How can I solve the issue?

    Thanks

    Billy

  11. Billy Tsang
    August 23, 2016 at 10:52 pm

    Hi

    I am sorry that I forgot provide the controller information.

    I am using Sigma Design Z-Wave Static Controller (USB).

    Thanks

  12. Jeff
    September 14, 2016 at 10:59 pm

    I followed Alan’s advice and uncommented the Linux commands but I am still getting an error after running make command:

    [email protected]:~/open-zwave-control-panel $ make
    g++ -c -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -g -DDEBUG -ggdb -O0 -I ../open-zwave/cpp/src -I ../open-zwave/cpp/src/command_classes/ -I ../open-zwave/cpp/src/value_classes/ -I ../open-zwave/cpp/src/platform/ -I ../open-zwave/cpp/src/platform/unix -I ../open-zwave/cpp/tinyxml/ -I /usr/local/include/ -o ozwcp.o ozwcp.cpp
    ozwcp.cpp:54:24: fatal error: microhttpd.h: No such file or directory
    #include “microhttpd.h”
    ^
    compilation terminated.
    Makefile:51: recipe for target ‘ozwcp.o’ failed
    make: *** [ozwcp.o] Error 1

    Any ideas?

    Thanks

  13. September 19, 2016 at 3:15 pm

    Why libmicrohttpd-0.9.19 instead of a much newer version, such as libmicrohttpd-0.9.51?

  14. Dan Clemmensen
    September 21, 2016 at 11:47 am

    Thanks for the instructions: they were mostly complete. I did make a few additional modifications to the Makefile based on comments therein. The result compiled and executed without any muss, fuss, or bother, and the result is a great tool for debugging and understanding my network.

    DO be aware, however, that the code is NOT under the GPL. The copyright license permits copying WITHOUT MODIFICATION for any purpose. Copyright law permits you to modify it anyway, but you cannot then make the modified result available to anyone else. I expect most people will not care, but please be careful.

  15. Dan Clemmensen
    September 21, 2016 at 11:58 am

    Billy Tsang: I am using a Z-stick. On my system, it is recognized as /dev/ttyACM0. Since you are new to Limux, you may not be aware of the /dev directory, so I provide the following “recipe”. This is brute-force but easy to do. There are other methods.

    1) remove your z-stick and reboot your Pi.
    2) issue the command
    ls /dev
    3) insert the z-stick
    4) again issue the command
    ls /dev
    5) look for added names in the list. In my case there are two: ttyACM0 and one other, so the z-stick represents itself as two separate USB devices in the USB tree. Note that neither of these is the default /dev/ttyUSB0 that is expected by some parts of OpenZWave.

    Now you can open the OZWCP web page and enter /dev/ttyACM0 in the “device name” box, and the system should find your controller.

  16. Ronald
    October 6, 2016 at 1:56 pm

    So close to the finish but I am stuck at “ln -sd ../python-openzwave/open-zwave/config” (=the path that worked for me in the Makefile)

    [email protected]:~/open-zwave-control-panel$ ln -sd ../python-openzwave/open-zwave/config
    ln: failed to create symbolic link ‘./config’: File exists

    Does somebody have a suggestion for me? It seems to be necessary for running the ozwp program because ….

    [email protected]:~/open-zwave-control-panel$ ./ozwcp -p 8888
    2016-10-06 18:51:54.219 Error, Cannot find a path to the configuration files at ./config/. Exiting…
    2016-10-06 18:51:54.222 Error, Exception: Options.cpp:91 – 1 – Cannot Find Configuration Files
    Error: Options.cpp:91 – Cannot Find Configuration Files

    If I sound ignorant … I am pretty new to Linux 😉

    Cheers Ronald

  17. Ronald
    October 6, 2016 at 2:01 pm

    P.S. the “/python-openzwave/open-zwave/config” file exists but it is empty

  18. Ronald
    October 9, 2016 at 6:34 am

    I made a new install (with the open-zwave install to the “open-zwave” folder) and can now run ./ozwcp -p 8888 and connect via the webinterface (which I now have to figure out how to discover my Z-stick Gen5).

    BTW the microhttpd library mentioned above was to old and failed for me when running ./ozwcp -p 8888.\
    I fixed this with …
    $ sudo apt-get -y install libmicrohttpd-dev

  19. mechaxl
    October 15, 2016 at 5:29 pm

    If anybody else is using Ansible to manage their setup, this Ansible role might be useful:

    https://github.com/mechaxl/ansible-ozwcp

    It’s mostly just copying these instructions, with some extra goodies, such as running as a non-root user, and systemd integration (which will automatically shut down the home assistant service to run ozwcp, if it’s been set up with https://github.com/mechaxl/ansible-homeassistant).

    Check it out and feel free to star it on Github if you find it useful at all. Thanks!

  20. seok hyun ko
    November 18, 2016 at 9:05 am

    can we use this with not usb stick but razberry module?

  21. sid
    November 28, 2016 at 2:21 am

    Can anyone explain this command –
    make
    ln -sd ../open-zwave/config (What does this command mean)

  22. Todd
    December 19, 2016 at 11:14 pm

    Was there ever an answer to:

    Jeff
    September 14, 2016 at 10:59 pm
    I followed Alan’s advice and uncommented the Linux commands but I am still getting an error after running make command:

    [email protected]:~/open-zwave-control-panel $ make
    g++ -c -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -g -DDEBUG -ggdb -O0 -I ../open-zwave/cpp/src -I ../open-zwave/cpp/src/command_classes/ -I ../open-zwave/cpp/src/value_classes/ -I ../open-zwave/cpp/src/platform/ -I ../open-zwave/cpp/src/platform/unix -I ../open-zwave/cpp/tinyxml/ -I /usr/local/include/ -o ozwcp.o ozwcp.cpp
    ozwcp.cpp:54:24: fatal error: microhttpd.h: No such file or directory
    #include “microhttpd.h”
    ^
    compilation terminated.
    Makefile:51: recipe for target ‘ozwcp.o’ failed
    make: *** [ozwcp.o] Error 1

    Any ideas?

    Thanks

  23. December 30, 2016 at 11:58 am

    In the main section – Edit Make file: need to add the (un)coment Linux/Mac lines note.

    OK, up and running, sees Node5, 6, & 7. All sorts of logs when I manually turn 5 on/off/on/off.

    A) “Add Device”, Go, “Waiting for user action” – Ah, turned light on and “command complete”.
    B) and this is my primary question: How do I turn that light on/off from the command line? Well via a Bash script.

  24. December 30, 2016 at 12:54 pm

    (typos in prev – lack of coffee – my story…)

    Still more playing in browser:
    1 *LB Static Controller Static Controller Aeotec DSA02203 Z-Stick S2 9:39:29 AM Ready
    5 LBR Routing Slave Binary Power Switch GE 45609 On/Off Relay Switch on 10:21:39 AM Ready
    6 LR Routing Slave Binary Power Switch off 9:39:34 AM Dead
    7 LBR Routing Slave Binary Power Switch off 9:39:35 AM Dead

    and 6 & 7 are???? I only have 1 switch wired. I’m unable to turn 5 off (unless I walk into the other room and hit the switch).
    Then I went out to my greenhouse and plugged in 2 GE 12720 outdoor smart switches, came back in, still only 5,6,7 – no 8 or 9. Also when I stop/restart ozwcp and the web app I have to start all over with Device name etc. Is there no config file?
    Just restarted everything, 5 & 6 gone, 7 listed. added 5 again and it’s back. Turned a 12720 on/off (add dev) and nothing. ??
    Thanks for any help
    Chuck

  25. December 30, 2016 at 7:12 pm

    I wish I could edit previous posts – I’m up and running – web page working fine – U7 On (I confess, I confess), U7 Off. Now all I need is to get ozw-cli working.

  26. December 31, 2016 at 11:23 am

    OK, I’ve got everything working – web wise. However I need to be able to turn things On/Off from the command like (or via sw) ie. turn a greenhouse pump on for 45 seconds then off. Is there a way to pipe a string [0x0109001305022502252ccc..] through say telnet sg53:8888 or via nc or …

    Thanks

  27. John
    January 6, 2017 at 7:56 am

    I was getting the following error:
    “/home/ubuntu/open-zwave/cpp/hidapi/linux/hid.c:46:21: fatal error: libudev.h: No such file or directory
    compilation terminated.”
    when running “make” for open-zwave. Fixed by running:
    apt-get install libudev-dev

    (source: https://github.com/OpenZWave/open-zwave/issues/902)

  28. John
    January 6, 2017 at 8:05 am

    Also got this error when trying to “make” open-zwave-control-panel:
    g++ -o ozwcp -g ozwcp.o webserver.o zwavelib.o ../open-zwave//libopenzwave.a /usr/local/lib/libmicrohttpd.a -pthread -framework IOKit -framework CoreFoundation -lresolv
    g++: error: IOKit: No such file or directory
    g++: error: CoreFoundation: No such file or directory
    g++: error: unrecognized command line option ‘-framework’
    g++: error: unrecognized command line option ‘-framework’
    Makefile:71: recipe for target ‘ozwcp’ failed
    make: *** [ozwcp] Error 1

    Had to edit these parts of the Makefile as well:
    # for Linux uncomment out next three lines
    LIBZWAVE := $(wildcard $(OPENZWAVE)/*.a)
    LIBUSB := -ludev
    LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB) -lresolv

    # for Mac OS X comment out above 2 lines and uncomment next 5 lines
    #ARCH := -arch i386 -arch x86_64
    #CFLAGS += $(ARCH)
    #LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
    #LIBUSB := -framework IOKit -framework CoreFoundation
    #LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB) $(ARCH) -lresolv

    (I’m on Ubuntu)

  29. Chip Cox
    February 8, 2017 at 4:08 pm

    You have no idea how long I have been beating my head against this one. THANK YOU!!! THANK YOU!!!

Leave a Reply

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