ZBT-2 with Home Assistant on docker


Identify the device-name

ls -l /dev/serial/by-id

Identify the LAN connection interface

Typically eth0 (ethernet cable) or wlan0 (wireless).

ip link show | grep 'state UP'

docker-compose.yml

services:
  homeassistant:
    image: "ghcr.io/home-assistant/home-assistant:stable"
    container_name: homeassistant
    restart: unless-stopped
    volumes:
      - home-assistant-config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
    devices:
      - /dev/serial/by-id/usb-Nabu_Casa_ZBT-2_<your-device-name>-if00:/dev/ttyACM0
    privileged: true
    network_mode: host

  otbr:
    image: "openthread/border-router"
    container_name: otbr
    restart: unless-stopped
    volumes:
      - otbr-data:/data
    devices:
      - /dev/serial/by-id/usb-Nabu_Casa_ZBT-2_<your-device-name>-if00:/dev/ttyACM0
      - /dev/net/tun
    network_mode: host
    environment:
      - OT_RCP_DEVICE=spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=460800
      - OT_INFRA_IF=<lan-connection-interface>
      - OT_THREAD_IF=wpan0
      - OT_LOG_LEVEL=7
      - OT_REST_LISTEN_PORT=8981
      - OT_REST_PORT=8981
    cap_add:
      - NET_ADMIN

  matter-server:
    image: ghcr.io/matter-js/python-matter-server:stable
    container_name: matter-server
    restart: unless-stopped
    network_mode: host
    volumes:
      - matter-server-data:/data/

volumes:
  home-assistant-config:
  otbr-data:
  matter-server-data:

Setup Home Assistant and flash the antenna

docker compose up -d home-assistant

Follow the Home Assistant onboarding process and set it up as desired.

Then, follow the setup guide up to step 5 (Selecting the Thread firmware). This will flash the Matter firmware to the antenna.

Setup Thread

Follow this guide to enable IP forwarding.

Note: Read the script carefully before running it with curl | bash.

curl -sSL
https://raw.githubusercontent.com/openthread/ot-br-posix/refs/heads/main/etc/docker/border-router/setup-host | bash
docker compose up -d otbr

Add the Thread and Open Thread Border Router integrations and follow the instructions. The border router handled by the otbr container should then be automatically detected and configured.

Setup Matter

docker compose up -d matter-server

Add the Matter integration and follow the instructions.

Then, follow the standard process for adding Matter devices to the network.

Sources