Install Z-Stick & ConBee II on RPI/Openhabian

Here is how to configure properly an Aeotec Z-Stick Gen5 and a Conbee II stick on a RPI 4 installed with Openhabian (running OpenHab 3)

Click to Read More

First, be sure that openhabian can access the serial ports. The easiest is to configure that via openhabian-config > System Settings > Serial Port:

sudo openhabian-config 

You can also do it with raspi-config > Interfacing Options > Serial :

sudo apt-get install raspi-config
sudo raspi-config

> Would you like a login shell accessible over serial? → No
> Would you like the serial port hardware to be enabled? → Yes

 

Next, check that the sticks are well plugged with the command:

lsusb

You should see something like

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 011: ID 1cf1:0030 Dresden Elektronik ZigBee gateway [ConBee II]
Bus 001 Device 005: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In order to always have the USB sticks mounted on the same "port", instead of being assigned once on /dev/ttyACM0, once on /dev/ttyACM1, ... create a UDEV Rule file:

sudo nano /etc/udev/rules.d/99-usb-serial.rules

Type the following, using the ID of the USB sticks found above, in this file:

SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyUSB-ZWave", GROUP="dialout", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1cf1", ATTRS{idProduct}=="0030", SYMLINK+="ttyUSB-ZigBee", GROUP="dialout", MODE="0666"

If you didn't prepare openhabian for ZigBee via sudo openhabian-config > System Settings > Serial Port, grant the following access for openhab :

sudo adduser openhab dialout
sudo adduser openhab tty

Now, reboot (sudo reboot) and test if symlink was created with the command :

ls /dev/tty*

You should see

/dev/ttyUSB-ZigBee
/dev/ttyUSB-ZWave

Add edit openhab config file to add the symlinks to the PATH variable for Java (NB: for openhab 2, the file is namge openhab2 !!):

sudo nano /etc/default/openhab

Search the line with EXTRA_JAVE_OPTS and modify accordingly to complete the parameter 'Dgnu.io.rxtx.SerialPorts':

EXTRA_JAVA_OPTS="-Xms192m -Xmx320m -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB-ZWave:/dev/ttyUSB-ZigBee"

Now, reboot again (sudo reboot) and install Phoscon, the application to manage the ZigBee devices. The easiest is to install it (on port 8081 as recommended) via openhabian-config > Optional Components > deCONZ:

sudo openhabian-config

You can also look here on the phoscon website for a manual setup

If you have a RPI 4B, also update the WiringPI like this:

cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

You can now open phoscon to login and search for ZigBee devices on http://<your RPI IP>:8081

If after a reboot, this UI is not available, then enable manually the service:

sudo systemctl enable deconz

If you want to change the port of Phoscon, edit the parameter 'http-port' in this file:

sudo nano /lib/systemd/system/deconz.service

 

Finally, install the following addons (Bindings) in OpenHab :

  • "Dresden Elektronik deCONZ Binding"
  • "Z-Wave Binding"

The ConBee gateway will be detected automatically by OpenHab and appear twice in the 'Inbox': once as Deconz and once as Hue (indeed, it emulates a Philips Hue Bridge). If it was not detected automatically, open the Phoscon UI > Gateway > Advanced (Gear Icon at the bottom of the page) and CLick on "Authenticat App". Then add the Thing manually into OpenHab using the Scan button of:

OpenHab UI > Administration > Parameters > Things > + (Add Thing) > Dresden Elektronik deCONZ Binding

 

The Zwave gateway will only appear if you add it explicitly into OpenHab:

OpenHab UI > Administration > Parameters > Things > + (Add Thing) > Z-Wave Binding > Z-Wave Serial Controller

In the field Serial Port, type manually '/dev/ttyUSB-ZWave' (without the quotes) and click 'Create Thing'

Wait for about 10 seconds and the gateway will soon become online.

Et voilà.

Leave a Reply

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