Zigbee Config - Docker Access to USB Stick

Alright - I admit - I made a dumb mistake. I am posting this solely because when I looked I couldn’t find the answer I was looking for (which was simple). Maybe this will help someone else.

I run HA on an Ubuntu PC insider a Docker container, and use Docker Compose. I recently purchased a Nortek Gocontrol HUSBZB-1 stick to add a zigbee and z-wave networks to my HA. But like many people, I could not get HA to find the zigbee stick. There are lots of pages out there with sample docker-compose files for this scenario. I tried them, restarted my pc, but no matter what I did HA could not find the USB stick.

Finally, it dawned on me: maybe instead of restarting my PC, I needed to rebuild my docker container. I tried that and … Presto! No problem. All works. For anyone who is interested, Here is the docker-compose file that worked:

version: '3'
services:
  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant:stable
    volumes:
      - /hass/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /dev/serial/by-id:/dev/serial/by-id
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
      - /dev/ttyUSB1:/dev/ttyUSB1
    environment:
      - TZ=America/Los_Angeles
    restart: always
    network_mode: host

After saving that file, I ran the following (which updates HA and rebuilds);

sudo docker-compose pull
sudo docker-compose up -d --build homeassistant

Hope that helps someone else.

27 Likes

You saved my day!

Fantastic. Absolutely useful information.

Adding the following commands to help identify locations.

  • Details of USB devices: sudo usb-devices
  • Summary of USB devices: sudo lsusb
  • Show USB devices by ID: sudo ls -la /dev/serial/by-id
4 Likes

Helped me today!

I know this is old, but it’s still helpful (and the top google result on this question). I just wanted to add a bit more details to be sure anyone can follow.

Run this in the terminal: find /dev/serial/by-id -iregex ".*zig.?bee.*"
For a Z-Wave dongle, it would be find /dev/serial/by-id -iregex ".*z.?wave.*"

That will give you the path to your dongle, assuming the ID contains “zigbee”. And this will not change if you plug the dongle into a different USB port.
(I used find over ls, because find has a case-insensitive option.)

The instructions to add it to docker are here (if that link ever breaks, try this)

To summarize:
If using docker compose, edit the compose.yaml to look like this:

services:
  homeassistant:
    devices:
      - OUTPUT:/dev/ttyUSB0

(Make the devices line if it doesn’t exist. If the devices line already exists with a similar line, add yours below that, making sure the dash aligns with the previous line.)

If just using docker cli, add --device OUTPUT:/dev/ttyUSB0 to your docker run command.
In both cases, replace “OUTPUT” with the output of the find command from above.
You can replace the “0” at the end of “ttyUSB0” with any number if you are already mapping a device to that.

Hope this may help someone in the future.

1 Like