smart home circle
Smart Home Circle

Setup Home Assistant Connect ZBT-2 With Home Assistant Container And Zigbee2MQTT Container — Step By Step Guide

5 min read
Setup Home Assistant Connect ZBT-2 With Home Assistant Container And Zigbee2MQTT Container — Step By Step Guide

Written by

Amrut Prabhu avatar
Amrut Prabhu
@smarthomecircle

Featured Video

Table of Contents

home-assistant-connect-zbt-2

I run home assistant using docker and I want to share with you how we can use the new Home Assistant Connect ZBT-2 with Home Assistant running as a docker container. We will also look at using the ZBT-2 with Zigbee2MQTT running as docker container.

Install Zigbee Firmware

Firstly, we have to install the Zigbee firmware on the Home Assistant Connect ZBT-2.

  1. Open this link to flash the Zigbee firmware.

  2. Connect you ZBT-2 to your comupter and click on install firmware

flash-firmware

  1. Select the ZBT-2 and wait till it shows this screen.

change-firmware

  1. Click on change firmware and select the Zigbee option and click on install.

select-zigbee

With this the Zigbee firmware will be installed on the Home Assistant Connect ZBT-2.

Setup Home Assistant Connect ZBT-2 With Home Assistant Docker Container.

Once you connect the ZBT-2 to the machine running Home Assistant as a docker container, we need to find the device path of the ZBT-2.

  1. Create the following script as find-usb.sh.
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
    (
        syspath="${sysdevpath%/dev}"
        devname="$(udevadm info -q name -p $syspath)"
        [[ "$devname" == "bus/"* ]] && exit
        eval "$(udevadm info -q property --export -p $syspath)"
        [[ -z "$ID_SERIAL" ]] && exit
        echo "/dev/$devname - $ID_SERIAL"
    )
done
  1. Make the script executable and execute it.
chmod +x find-usb.sh
./find-usb.sh
  1. You should see the device path the ZBT-2. e.g in this case it is /dev/ttyACM1

find-usb

  1. Update the docker compose file of your Home Assistant to include the device path under the devices section.
services:
  home-assistant:
    image: ghcr.io/home-assistant/home-assistant:stable
    pull_policy: always
    volumes:
      - /dev:/dev
      - ./config/:/config/
    devices:
      - /dev/ttyACM1:/dev/ttyACM1  #this is the place where you need to specify the device path.
    container_name: assistant
    network_mode: host
    restart: always
  1. Save the docker compose file and restart Home Assistant. You should be able to see the device pop up in the devices section in Home Assistant.

device in home assistant

Setup Home Assistant Connect ZBT-2 with Zigbee2MQTT Docker Container

  1. Find the device path using the find-usb.sh script specified above.

  2. Update Zigbee2MQTT docker compose file to include the path under the devices section.

services:
  zigbee2mqtt:
    container_name: zigbee2mqtt
    restart: unless-stopped
    devices:
      - /dev/ttyACM1:/dev/ttyACM1
    ports:
      - "8080:8080"
    volumes:
      - ./data:/app/data
      - /run/udev:/run/udev:ro
    environment:
      - TZ=Europe/Amsterdam
    image: ghcr.io/koenkk/zigbee2mqtt

Pay attension to the volumes section, where we are mounting a local directory. We will create a configuration.yaml file in this directory for Zigbee2MQTT to use it.

  1. Create a file with the name configuration.yaml under the data folder in the current directory and add the path as shown below.
mqtt:
  server: mqtt://192.168.0.43:1883 # these should be your mqtt url
  serial:
    port: /dev/ttyACM1  # specify the path here
frontend:
  enabled: true
advanced: {}
homeassistant:
  enabled: true
serial:
  adapter: ember 
  port: /dev/ttyACM1  # specify the path here
  baudrate: 460800
  1. Restart your Zigbee2MQTT container and it should start using the new Home Assistant Connect ZBT-2.

Share this article: