Connect ZBT-2 Thread to Home Assistant Container

hey all. here is my check-in. i finally got it working again after weeks of battling.

my docker compose setup -

  • the network_mode and privileged for each containers seems important
  • i went back to openthread/border-router:latest because it worked for me when i first got the ZBT-2.
  • obtr, set it to listen on 0.0.0.0 OT_REST_LISTEN_ADDR: 0.0.0.0 and default port 8081 (feel free to change)

on the host, you need avahi-daemon AND radvd. it wouldnt pair (failed to pair) if radvd is not installed/stopped. afterward. i suggest a reboot of the machine. it MIGHT update some iptables rules. not 100% sure since the following were updated after a reboot even though i dont save my firewall rules -

net.ipv4.conf.all.forwarding = 1
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.all.accept_ra_rt_info_max_plen = 64
net.ipv6.conf.all.accept_ra = 2
net.ipv6.conf.br0.forwarding = 1
net.ipv6.conf.br0.accept_ra = 2
net.ipv6.conf.br0.accept_ra_rt_info_max_plen = 64

when you pair your accessories. run this on the host. this will do a browse/scan. it also shows the list of matter devices.

──── avahi-browse -rt _matter._tcp; avahi-browse -rt _meshcop._udp; avahi-browse -a -t

avahi config -

──── cat /etc/avahi/avahi-daemon.conf
# MANAGED BY ANSIBLE
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
[server]
use-ipv4=yes
use-ipv6=yes
allow-interfaces=br0
deny-interfaces=docker0,veth*,br-*
ratelimit-interval-usec=1000000
ratelimit-burst=1000

[wide-area]
enable-wide-area=yes

[publish]
publish-addresses=yes
publish-hinfo=no
publish-workstation=no
publish-domain=yes

[reflector]

[rlimits]

radvd.conf (chatgpt gave me this. i dont know what the ipv6 mean) -

──── cat /etc/radvd.conf
# MANAGED BY ANSIBLE
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
interface br0
{
    AdvSendAdvert on;
    MinRtrAdvInterval 3;
    MaxRtrAdvInterval 10;

    prefix fd15:9ef4:1f7f:9c18::/64
    {
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr on;
    };

    route fd15:9ef4:1f7f:9c18::/64
    {
    };
};

docker-compose -

  home-assistant:
    container_name: home-assistant
    image: ghcr.io/home-assistant/home-assistant:stable
    environment:
      TZ: America/Los_Angeles
    network_mode: host
    privileged: true
    restart: unless-stopped
    volumes:
      - './home-assistant/config:/config'
      - '/etc/localtime:/etc/localtime:ro'
      - '/run/dbus:/run/dbus:ro'

  matter-server:
    container_name: matter-server
    image: ghcr.io/matter-js/python-matter-server:stable
    network_mode: host
    restart: unless-stopped
    security_opt:
      - apparmor:unconfined
    volumes:
      - './matter-server/data:/data'
      - '/run/dbus:/run/dbus:ro'

  otbr:
    container_name: otbr
    image: openthread/border-router:latest
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/serial/by-id/usb-Nabu_Casa_ZBT-2_9C139EAC8D34-if00:/dev/ttyACM0
      - /dev/net/tun:/dev/net/tun
    environment:
      OT_RCP_DEVICE: spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=460800
      OT_INFRA_IF: br0
      OT_THREAD_IF: wpan0
      OT_LOG_LEVEL: 7
      OT_REST_LISTEN_ADDR: 0.0.0.0
      OT_REST_LISTEN_PORT: 8081
      OT_WEB_LISTEN_ADDR: 0.0.0.0
      OT_WEB_LISTEN_PORT: 8981
    network_mode: host
    privileged: true
    restart: unless-stopped
    volumes:
      - './otbr/data:/data'