Setup dockerized deconz in Ubuntu, connecting to a RaspBee board - dresden-elektronik/deconz-rest-plugin GitHub Wiki

source

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, and of course it works equally well on 4th gen Raspberry boards.

There aren't any arm-architecture deconz packages available for Ubuntu - but this is where Docker steps in, with the images provided by marthoc!

If you want to get Docker deconz running on Ubuntu, you will not have the raspi-config tool available to turn off the kernel serial console on the Raspis's GPIO ports, like described in marthoc's Readme. But we still need to 'free up' these GPIO ports for use by the RaspBee board.

To prepare your Ubuntu system for running dockerized deconz, you can follow these steps:

Turn off linux kernel serial console

Edit /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

You can either map the Raspi's mini UART device for communication with the RaspBee, or it's first PL011 device - this page is a good resource to learn about the Raspberry's serial interfaces. Configuration happens in /boot/firmware/config.txt

To drive the RaspBee board via mini UART, add this line to config.txt:

dtoverlay=disable_bt

After a reboot, the RaspBee will be available on /dev/ttyS0

To make RaspBee available via PL011, you should add this to config.txt:

dtoverlay=miniuart-bt

After a reboot, the RaspBee will be available on /dev/ttyAMA0

You will find information about the differences between these two UART options on the raspberrypi documentation page referenced above.

Once you have decided on your setup, put in these configuration changes and rebooted your Raspberry, you should be good to go! Just remember to

  • install the wiringpi package,
  • add your user account to the dialout group,
  • set your docker cmdline (or docker-compose file) to use /dev/ttyS0 or /dev/ttyAMA0, depending on which option you chose above. These steps are described in marthoc's documentation, as referenced above.

More clarification and explanation about dtoverlay and UART source

First of all, the RaspBee (I or II) must be run on the PL011, as only this is fullfeatured while the mini UART is stripped in capabilities. That being said, it of course also matters which type of RPi you have, as PL011 is not automatically the primary UART as the documentation explains. To add more complexity to this, it also matters if you desire/require BT to run or not. If yes, the required configuration might vary as well.

However, there seems to be a savior in form of the overlays. Documentation states:

Primary UART Default state of enable_uart flag
mini UART 0
first PL011 (UART0) 1

As I recall, upon deCONZ installation, enable_uart is always set to 1 in config.txt, which should ensure the primary UART is PL011. However, not sure if that could interfere in any way with the below.

"disable-bt disables the Bluetooth device and makes the first PL011 (UART0) the primary UART. You must also disable the system service that initialises the modem, so it does not connect to the UART, using sudo systemctl disable hciuart."

This is what we want if we don't want BT running in parallel.

"miniuart-bt switches the Bluetooth function to use the mini UART, and makes the first PL011 (UART0) the primary UART. Note that this may reduce the maximum usable baud rate (see mini UART limitations below). You must also set the VPU core clock to a fixed frequency using either force_turbo=1 or core_freq=250."

This is what we want if we want BT running in parallel.

So TLDR, as you might have recognized, it is more the wording in your guide that might need to be amended. For the BT to remain active, it depends on the RPi which additional parameter needs to be added to the configuration.