HA Docker with OTBR docker

It works fine with the DNS line in my experience. Without mapping /var/lib/thread as a volume your otbr will not survive reboots. Thread/Matter devices will lose connection and have to be recommissioned.

1 Like

Do I understand correctly that this issue still hasn’t been resolved? I’m facing the same challenge with SkyConnect. I’m considering buying a Nuki Bridge to achieve Nuki integration in Home Assistant. However, I’d prefer to accomplish this using SkyConnect to save space in my wall power sockets. I don’t like having extra devices plugged in all the time… and I do not want to migrate all hard work confs to HAOS from the standalone HA docker…

It’s possible to get it working, but it’s not straightforward. The way commissioning new devices works in HA is by first commissioning using google/apple and then sharing with HA. A decision I don’t necessarily agree with, but that’s the way it is.

This may work with your phone or it may not. There doesn’t seem to be any effort to troubleshoot why it doesn’t work in some cases, but there is an alternate method to commission devices directly to HA if you have Bluetooth available.

This thread was of good help trying to setup OTBR in a container. Got stuck on the wifi connection issue as well during commissioning but eventually got though it.

Got it working using the hass addon container with some modifications. Documented my success in a github repo to maybe help others and for my own future reference:

3 Likes

I was able to change my otbr container to use this image and still use my existing thread data without having to recreate the network. I haven’t tried to pair any new devices yet, but that is next on the list.

Thanks to your discussion, I was able to get my Thread & Matter setup going. As it wasn’t that easy, I wanted to share my findings as well.

First of all, after you changed your docker compose file, restart your OS/Hardware. Don’t know why this helps, but it did for me. With the following configuration and a restart of my Mini-PC/Homeserver, I was able to pair 3 different smart plugs using the HA-companion App on my iPhone.

  # ===============
  # Home Assistant
  # smart home automation service
  # ===============
  homeassistant:
    container_name: homeassistant
    image: ghcr.io/home-assistant/home-assistant:stable
    volumes:
      - ${PWD}/hass-config:/config
      - /etc/localtime:/etc/localtime:ro # read-only
      - /run/dbus:/run/dbus:ro # for bluetooth; read-only
      - /media/external/Home_Assistant_external_data:/media
      - ${PWD}/scripts/:/config/scripts
    restart: unless-stopped
    privileged: true
    devices:
      - /dev/serial/by-id/usb-Nabu_Casa_Home_Assistant_Connect_ZBT-1_7a02b1286b39ef119de25bf454516304-if00-port0:/dev/ttyUSB1 # Home Assistant ZBT-1 USB Dongle
    network_mode: host

  # ===============
  # Matter controller/server
  # for Home Assistant
  # ===============
  matter-server:
    container_name: matter-server
    image: ghcr.io/home-assistant-libs/python-matter-server:stable
    network_mode: host
    privileged: true
    restart: unless-stopped
    security_opt:
      - apparmor=unconfined # necessary for Bluetooth via dbus
    volumes:
      - ${PWD}/volumes/matter-server:/data
      - /run/dbus:/run/dbus:ro
      - /etc/localtime:/etc/localtime:ro
      - /dev/ttyUSB1
    command: >
      --storage-path /data
      --paa-root-cert-dir /data/credentials
      --bluetooth-adapter 0
    # "bluetooth-adapter 0" refers to hci0, this is very important when bluetooth is needed for paring

  # ===============
  # OTBR - Open Thread Border Router
  # for Home Assistant
  # necessary for Matter support!
  # ===============
  otbr:
    image: openthread/otbr
    container_name: otbr
    network_mode: host
    tty: true
    restart: unless-stopped
    privileged: true
    volumes:
      # - ${PWD}/OTBR/otbr-web:/etc/default/otbr-web:ro # custom frontend config
      - ${PWD}/OTBR/thread:/var/lib/thread
      - /etc/localtime:/etc/localtime:ro
      - /dev/serial/by-id/usb-Nabu_Casa_Home_Assistant_Connect_ZBT-1_7a02b1286b39ef119de25bf454516304-if00-port0:/dev/ttyUSB1 # HA ZBT-1 USB Dongle
    environment:
      - BACKBONE_INTERFACE=enp1s0 # check OTBR logs for interface
      - DEVICE=/dev/ttyUSB1
      - NAT64=1
      - BAUDRATE=460800
      - FIREWALL=0
      - FLOW_CONTROL=0
      - AUTOFLASH_FIRMWARE=0 # disable auto update of ZBT-1 USB Dongle firmware
      - OTBR_ENABLE=1
      - OTBR_LOG_LEVEL=info
      - OTBR_REST_PORT=8081
      - OTBR_REST_LISTEN_PORT=8081
      - OTBR_WEB_PORT=8080
      - RADIO_URL=spinel+hdlc+uart:///dev/ttyUSB1?uart-baudrate=460800
    devices:
      - /dev/serial/by-id/usb-Nabu_Casa_Home_Assistant_Connect_ZBT-1_7a02b1286b39ef119de25bf454516304-if00-port0:/dev/ttyUSB1 # HA ZBT-1 USB Dongle
    command: >
      sysctl net.ipv6.conf.all.disable_ipv6 = 0 net.ipv4.conf.all.forwarding = 1 net.ipv6.conf.all.forwarding = 1 net.ipv6.conf.all.accept_ra_rt_info_max_plen = 64 net.ipv6.conf.all.accept_ra = 2

Can’t connect to the OTBR frontend, but everything else works fine.
I use a FRITZ!Box and did NOT change any settings for Matter to function properly.

Hope this helps!