Turris omnia deconz in the lxc container

Home Assistant there are several ways to connect Zigbee devices. On the one hand there is ZHA (Zigbee Home Automation) as native integration, where a compatible Zigbee stick can be connected without further software installation. With Zigbee2MQTT the Zigbee devices are connected to Home Assistant via MQTT. As a third option, with a ConBee, ConBee II or RaspBee module, the software can also be deCONZ or. Phoscon from Dresden Elektronik to be connected to Home Assistant. All solutions have their advantages and disadvantages, as a comparably detailed .

Above all the representation of the Zigbee network and the stability emphasized again and again were for me the crucial points in a first attempt to set on deCONZ and Phoscon.

Used software and hardware

The steps mentioned here were done with the following software and hardware:

– TurrisOS 4.X
– Debian Buster (OS in LXC container)
– deCONZ 2.05.74-raspbian-buster-stable
– ConBee stick
How to create the LXC container is not explained here. I assume that the container has already been basically set up.

Notice: I use the old version of the ConBee stick. With the new version of the stick (ConBee II) the integration of the stick must be done if necessary. Adapted. This is especially true for the drivers and device IDs to be installed (see also [2]).

Disclaimer: As immar I can not give any guarantee. Everything you do on your devices is your responsibility. Especially updating the stick firmware can make the stick unusable.

On the Turris Omnia

First, some items need to be prepared on the Turris Omnia as host. When the ConBee stick is connected, lsusb can be used to check if the stick is basically recognized:

Install kernel module

The ID (in the example above line 2, ID 0403:6015) can be used to determine which kernel module must be installed. For the ConBee accordingly the package kmod-usb-serial-ftdi is to be installed in the TurrisOS. The USB utilities should also be installed:

If the correct driver was installed, a new device /dev/ttyUSB0 should be created for the ConBee stick. If in doubt, plug in the stick again.

Adjust the permissions of the device

Now the device is recognized and created correctly, but the access is only allowed for the root user by default. Therefore, the file /etc/plugdev.D/usb/20-conbee should be created with the following content:

If a USB device with the product ID of the ConBee stick (see line 1) is connected, the permissions are adjusted and additionally a symbolic link /dev/conbee to the corresponding device is created. This makes it easy to track which device belongs to the stick. In addition, a file is created in the udev directory in the file system of the LXC container, which deCONZ needs to recognize the device correctly. When removing the stick the symlink. Deleted the udev file again.

Device initialization on reboot

To ensure that the USB device is initialized correctly not only when the device is plugged in but also at system startup, the following script must be executed at boot time (z.B. In the file rc.Local) must be executed:

Device passthrough for LXC container

If the ConBee is recognized and created correctly, the device must be made available by the following lines in the configuration file of the LXC container:

Extended rights for LXC container

Attention: This change assigns wide-ranging permissions to the container, which may affect the secure operation of the container.

So that with me the Phoscon resp. Deconz starts later in the container without errors, I still had to remove some restrictions for the LXC container. The following entries have to be added to the end of the configuration file:

After that you can (re)start the LXC container and connect to it:

In the LXC container

In the LXC container the Phoscon/deCONZ software has to be installed. It has to be taken into account that the package provided by Dresden Elektronik was developed for the RaspberryPi. Unfortunately, there is a dependency to the RaspberryPi specific package wiringpi, which cannot be installed automatically in the Debian Buster of the LXC container.

Install dependencies (wiringpi)

However, the wiringpi package can be downloaded and installed manually:

Add and install repository

The installation of the deconz package is then only Debian standard:

Enable access to ConBee for deCONZ

Internally deCONZ uses functions of the library libqt5serial to determine the correct device in the udev database under /run/udev/data/. But this is not available in the LXC container. Therefore the entry has to be created manually:

Hint: The VENDOR_ID and MODEL_ID are determined with the command lsusb. The filename (188:0) depends on the attributes of the device, which can be determined with ls -la /dev/ttyUSB0.

For a user with root rights the stick should be available now:

Create user and adjust autostart

By default the deCONZ service is started with the user ID 1000. However, it is recommended to create a dedicated user for deCONZ:

Afterwards the following adjustments must be made in the file deconz.Services by making the following adjustments to ensure that the new user is used and that access to the stick is enabled at system startup:

Hint: Lines 10 – 13 are somewhat redundant, since the permissions on the device should already be set correctly by the hotplug script on the host. But I also adjust the permissions on the device in the startup script to make sure that everything is set correctly when deCONZ is started.

After a reboot of the LXC container the deCONZ service should be started automatically, which can be easily checked with netstat -tulpen:

If the Phoscon page is reachable via HTTP, the following entries should be made under Menu> Settings> Gateway also the stick will appear:

Turris omnia deconz in the lxc container

Update Firmware

Unfortunately, a firmware update via the just set up Phoscon page does not work. This is because the GCFFlasher tries to reload the kernel modules. Of course this does not work in a LXC container, so the flash process is not executed. Even if the web interface suggests that the update was successful, you will notice that the firmware version of the stick has not changed.

Therefore a firmware update must be done manually. I simply use my Windows 10 laptop and the Windows version of GCFFLasher, which can be downloaded from the homepage of Dresden Elektronik. The appropriate firmware can also be downloaded from Dresden Elektronik (see [5]). The filename for a ConBee firmware must correspond to the following pattern deCONZ_Rpi_*.Am.GCF. The files deCONZ_ConBeeII_*.Am.GCF only work for the newer version ConBee II (see also [6]).

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: