Deploy Deconz zigbee control software via docker
Ubuntu provides a server (headless) version that also is available for ARM devices - this is a great option if you want a 64bit OS on your Raspberry 3 (of course it works equally well on 4th-gen Raspberry boards). This motivated me to move my home automation Raspi over onto Ubuntu - and led to the discovery that there aren’t any arm-architecture deconz1 packages available for Ubuntu. I need deconz because I’m running a ZigBee shield with my Pi homeassistant setup. This is where Docker comes to the rescue, with the images provided by marthoc!
To get dockerized deconz running, we need to prevent the kernel from allocating a serial console on the Raspis’s GPIO ports - because we need that serial port to connect to the RaspBee shield. Running Ubuntu, we do not have the raspi-config tool available to perform this configuration (as described in marthoc’s Readme).
So to prepare Ubuntu for running dockerized deconz, these are the configuration steps to follow:
Turn off linux kernel serial console
/boot/firmware/cmdline.txt and remove these two parameters:
console=serial0,115200 console=tty1. My cmdline.txt looks like this afterwards:
dwc_otg.lpm_enable=0 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc quiet splash
Tell the kernel device tree which UART to use
We can either map the Raspi’s mini UART device for communication with the RaspBee, or the first PL011 device - this page is a good resource to learn about the Raspberry’s serial interfaces. Configuration happens in
To drive the RaspBee board via mini UART, we add this line to config.txt:
After a reboot, the RaspBee will be available on /dev/ttyS0
To make RaspBee available via PL011, we would add this to config.txt:
After a reboot, the RaspBee will be available on /dev/ttyAMA0
Information about the differences between these two UART options can be found on the raspberrypi documentation page referenced above. Once decided on the setup, putting in these configuration changes and rebooting the Raspberry, we are good to go.
Next steps are to
- install the wiringpi package
- add the docker-deconz user account to the dialout group
- set the docker cmdline (or docker-compose file) to use /dev/ttyS0 or /dev/ttyAMA0, depending on which option you chose above (these steps are also described in marthoc’s documentation).
My docker-compose file for deconz looks like this:
version: "3" services: deconz: image: marthoc/deconz:stable container_name: deconz network_mode: host restart: always volumes: - /opt/deconz:/root/.local/share/dresden-elektronik/deCONZ devices: - /dev/ttyAMA0 # - /dev/ttyS0 environment: - TZ=Europe/Berlin - DECONZ_DEVICE=/dev/ttyAMA0 # - DECONZ_DEVICE=/dev/ttyS0 - DECONZ_WEB_PORT=8090 - DECONZ_WS_PORT=8443 - DECONZ_VNC_PORT=5900 - DECONZ_NOVNC_PORT=0 - DEBUG_INFO=1 - DEBUG_APS=0 - DEBUG_ZCL=0 - DEBUG_ZDP=0 - DEBUG_OTAU=0 healthcheck: test: curl --fail http://localhost:8090 &>/dev/null || exit 1 interval: 1m01s timeout: 10s retries: 3
Note that I’m mapping the deconz configuration directory to a location in the host file system, because I like to be able to directly work with some of these files (for backups etc).
Ubuntu Server is a great OS for Raspberries!
- Running deconz in docker is a huge improvement wrt reproducibility and manageability of your setup
- Took me a while to figure out the dtoverlay settings to make this work - thanks to he guys in the deconz github community for giving me the crucial idea
- Original post, plus some more info on the dtoverlay settings
deconz is the Zigbee control software provided by Dresden Elektronik, managing their ZigBee USB and Raspi Shield devices. ↩