If any newcomers are using the hassbian image for raspberry pi, I’ve made changes to the install_openzwave.sh
script which will apply the garage door opener (barrier_operator) additions to openzwave and openzwave-control-panel automatically before building and installing them. This should make things really simple for absolute beginners.
Here are instructions for those starting off from scratch:
-
Download the hassbian image and follow the instructions, then verify that you can successfully browse to http://hassbian.local:8123
as mentioned.
-
ssh into your Raspberry Pi and replace the existing install_openzwave.sh script. To make that modification, edit the existing script with nano:
nano hassbian-scripts/install_openzwave.sh
then replace its contents by holding down CTRL+K to remove everything, then pasting in the new script below (usually by right clicking, if using putty or Windows 10’s bash):
#!/bin/bash
echo
echo “Open Z-Wave Installer for Hassbian”
echo “Modified by Landrash for use with Hassbian.”
echo “Remodified by unt1tled for use with Linear NGDZ00-4 (barrier_operator).”
echo “Copyright© 2016 Dale Higgs https://gitter.im/dale3h”
echo
if [ “$(id -u)” != “0” ]; then
echo “This script must be run with sudo. Use “sudo ${0} ${*}”” 1>&2
exit 1
fi
echo “Running apt-get preparation”
apt-get update
apt-get upgrade -y
apt-get install -y make python3-dev libudev-dev python3-sphinx python3-setuptools libgnutlsxx28 libgnutls28-dev libssl-dev
echo “Changing to homeassistant user”
sudo -u homeassistant -H /bin/bash <<EOF
echo “Activating virtualenv”
source /srv/homeassistant/bin/activate
echo “Installing latest version of cython”
Currently locked to this version since build fails for later versions.
pip3 install --upgrade cython==0.24.1
echo “Creating source directory”
mkdir -p /srv/homeassistant/src
chown -R homeassistant:homeassistant /srv/homeassistant/src
echo “Cloning python-openzwave”
cd /srv/homeassistant/src
git clone https://github.com/OpenZWave/python-openzwave.git
chown homeassistant:homeassistant python-openzwave
cd python-openzwave
echo “Cloning openzwave”
git checkout python3
rm -rf openzwave
git clone git://github.com/OpenZWave/open-zwave.git openzwave
echo “Replacing openzwave source files to add barrier_operator support”
wget -O openzwave/config/device_classes.xml https://raw.githubusercontent.com/OpenZWave/open-zwave/c808b7431fb6c28b408e7fdc5492e46420cb6926/config/device_classes.xml
wget -O openzwave/cpp/src/command_classes/BarrierOperator.cpp https://raw.githubusercontent.com/OpenZWave/open-zwave/c808b7431fb6c28b408e7fdc5492e46420cb6926/cpp/src/command_classes/BarrierOperator.cpp
wget -O openzwave/cpp/src/command_classes/BarrierOperator.h https://raw.githubusercontent.com/OpenZWave/open-zwave/c808b7431fb6c28b408e7fdc5492e46420cb6926/cpp/src/command_classes/BarrierOperator.h
wget -O openzwave/cpp/src/command_classes/CommandClasses.cpp https://raw.githubusercontent.com/OpenZWave/open-zwave/c808b7431fb6c28b408e7fdc5492e46420cb6926/cpp/src/command_classes/CommandClasses.cpp
echo “Building python-openzwave with barrier_operator support”
make build
make install
echo “Deactivating virtualenv”
deactivate
EOF
echo “Creating libmicrohttpd directory”
cd /srv/homeassistant/src
mkdir libmicrohttpd
chown homeassistant:homeassistant libmicrohttpd
cd /srv/homeassistant/src/libmicrohttpd
echo “Downloading libmicrohttpd-0.9.19”
wget ftp://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.19.tar.gz
chown homeassistant:homeassistant libmicrohttpd-0.9.19.tar.gz
tar zxvf libmicrohttpd-0.9.19.tar.gz
chown homeassistant:homeassistant libmicrohttpd-0.9.19
echo “Building libmicrohttpd-0.9.19”
cd libmicrohttpd-0.9.19
./configure
make
make install
echo “Cloning open-zwave-control-panel”
cd /srv/homeassistant/src
git clone https://github.com/OpenZWave/open-zwave-control-panel.git
chown -R homeassistant:homeassistant open-zwave-control-panel
cd open-zwave-control-panel
echo “Replacing open-zwave-control-panel source files with barrier_operator support”
wget -O zwavelib.cpp https://raw.githubusercontent.com/legrego/open-zwave-control-panel/0925251a566a36543e0c6b5cb0b2c1498bddfa68/zwavelib.cpp
echo “Building open-zwave-control-panel”
rm Makefile
wget https://raw.githubusercontent.com/home-assistant/fabric-home-assistant/master/Makefile
chown homeassistant:homeassistant Makefile
make
echo “Linking ozwcp config directory”
ln -sd /srv/homeassistant/lib/python3./site-packages/libopenzwave-0.-linux*.egg/config
chown -R homeassistant:homeassistant /srv/homeassistant/src
echo “Linking Home Assistant OpenZWave config directory”
cd /home/homeassistant/.homeassistant
sudo -u homeassistant ln -sd /srv/homeassistant/lib/python3./site-packages/libopenzwave--linux*.egg/config
chown -R homeassistant:homeassistant /home/homeassistant/.homeassistant
echo
echo “Installation done!”
echo
echo “If you have issues with this script, please contact @Landrash on gitter.im”
echo “Original script by @dale3h on gitter.im”
echo
Overwrite the existing file by hitting CTRL+X, then Y to save changes.
3. Now run the new script with this command:
sudo ./hassbian-scripts/install_openzwave.sh
and wait (and wait) for it to complete.
4. If your NGDZ00-4 is already paired, then you’ll need to re-add your security key to your options.xml
. Or if this is your first time pairing it, you’ll need to generate a new security key.
Either way, follow the instructions here and modify your options.xml
by entering:
nano /srv/homeassistant/lib/python3.4/site-packages/libopenzwave-0.3.2-py3.4-linux-armv7l.egg/config/options.xml
(note to people in the future: the version numbers in this path may have changed)
5. Also, you’ll need add the zwave and cover platforms to your configuration.xml
:
Edit the configuration.xml
by entering
nano /home/homeassistant/.homeassistant/configuration.yaml
Then append the following on the bottom:
zwave:
usb_path: /dev/ttyACM0
config_path: /srv/homeassistant/lib/python3.4/site-packages/libopenzwave-0.3.2-py3.4-linux-armv7l.egg/config/
cover:
platform: zwave
6. Reboot the pi by entering sudo reboot
and then, if required, securely add your NGDZ00-4 device with zwave.add_node_secure
. If done correctly, you’ll have your shiny new automated garage door opener working under a “cover” device like this:
From here, refer to the documentation on customizing the name, etc.
Cheers!