Difficulty getting ZHA installed (Linux newbie)

Hi, I’m about as green as one could get when it comes to working with Linux, but somehow, by following directions and scraping the internet for answers to roadblocks, I’ve managed to get docker installed with Home Assistant and Jellyfin running. I purchased a ConBee II stick so that I could integrate cheap Ikea lightbulbs with my installation, and I went through the setup process for a deCONZ docker container, only to be met with a lot of stubborn issues.

By default, deconz listens at ports 80 and 443, but during installation, I kept getting messages back from the terminal that they were already in use. Neither HASS or Jellyfin use them, to my knowledge. In the attempts where I was able to tell the container to listen at different ports, I would get the error message that the serial device /dev/ttyACM0—which is meant to be the ConBee II—didn’t exist. But it did, in fact, exist.

Is there anyone with the patience to help walk me through this?

Hi there,
I have been through this as well. Could you first specify the hardware you are running HA on?

First of all: I started myself with using deConz but then abandoned it to use the ZHA integration in HA directly. Much easier device management in HA directly and no additional container needed.

I guess the key to get it working is to make the serial device of the Conbee available in the docker container. If you stay with using deConz then the network between the HA and the deConz container has to be set up correctly within docker. Maybe this gives a hint into the right direction.

If you use docker compose you have to edit compose.yaml accordingly.

1 Like

Honestly, don’t use deCONZ.

For ease of use pick ZHA. No external dependency, and much more actively developed that deCONZ.

Do put that stick on a USB extension cable, away from other electronics.

Then all you have to do is expose that device. My recommendation would be (assuming you’re being sensible and using Docker Compose) something like:

version: '3'
services:
  homeassistant:
    ...
    devices:
      - /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DEXXXXXX-if00:/dev/ttyUSB0

(with the actual device path)

2 Likes

Thanks for the docker compose file. I was unsure about the syntax.

And I agree to use ZHA instead of deconz.

Hi, and thanks for the response!

I’m running my home server off a Dell Optiplex I saved from the trash. It’s got an i5 3470 CPU, 4G of RAM, and a Quadro P400 that I added recently to help with hardware transcoding in Jellyfin. I’m running Ubuntu off an SSD.

I do have docker compose yaml files set up for both Jellyfin and HASS, though I ran into a bit of confusion with where to even put the compose file for deconz. This may be me showing my inexperience, but I did set up the directories for both containers in the Home directory, and it took some time, but I figured out how to permanently mount a secondary drive for media storage.

Based on @Tinkerer’s advice, I think I will switch over to ZHA. I was even looking at zigbee2MQTT, but considering I don’t yet fully grasp what MQTT even is, maybe ZHA is the best route.

Does ZHA work with Home Assistant Container? And any opinions on best practice for setting up a container’s directory? Or does it not really matter where the directory is on the drive, as long as everything is working?

Well, to answer my own question, ZHA works with HASS Container and appears WAY easier to setup. However, I am running into a snag at Serial Port Settings. I keep getting a Failed to connect result.

I appended my HASS docker compose with

devices:
-/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2692724-if00:/dev/ttyACM0

I tried setting the serial device path to /dev/ttys0 (the default), /dev/ttyACM0 (where the ConBee II should be accodring to documentation), and /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2692724-if00, but none of them seem to work. I’m running out to grab a usb extension cable, to see if that helps at all.

Update: Unfortunately, it didn’t work.

I can confirm ttyACM0 is the ConBee II. After unplugging it and plugging it back in, I checked with sudo dmesg | grep, and it was the only device that changed.

Also, I checked my permissions at /dev and this came back:

crw-rw---- 1 root dialout 166, 0 May 21 21:03 ttyACM0

I had already added myself to the dialout group, prior to this.

You should check your /dev/serial/by-id/ folder to see if that’s valid for your stick, the numbers may differ.

You can also test the port to check that the stick works:

test -w PORT && echo success || echo failure

Replace PORT with the correct path.

Can confirm that is the path for my ConBee in the /dev/by-id folder.

I will test the port, next. Do I replace it with the whole /dev/by-id… path?

Also, I suspect that my attempted installations of deCONZ and Z2M may have changed some of the default settings or derailed the standard setup for ZHA. If that is the case, what would be a good way to wipe the slate clean short of a full reinstallation of Ubuntu or Docker?

Welp, new development: failure for ACM0 and USB0.

Sorry, I failed to type in the full name of the port (/dev/ttyACM0), and it is a success!

docker compose down, checked my yaml file, docker compose up and I get:

Error response from daemon: error gathering device information while adding custom device “/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2692724-if00”: no such file or directory

And how did you pass that into the container?

Earlier you said:

devices:
-/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2692724-if00:/dev/ttyACM0

which means it show as /dev/ttyACM0 inside the container.

That error message comes up when I try to run docker compose up through Terminal. I have this in my docker compose yaml:

devices:
-/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2692724-if00:/dev/ttyACM0

Docker won’t finish spinning up the home assistant container because of this error. That was the path you recommended I use in my compose file, right?

Just a small addition the user running the container should be in the dialout group.

Yeah, I had added myself to the dialout group when I had originally been setting up deCONZ.

You are developing to a Linux Pro! It is often a permission or a firewall problem.

You are making progress! keep pushing

It feels like trying to navigate a maze in the dark. Sometimes, I’ll make progress and I won’t totally understand why, but I’m terrified of backtracking for fear of losing my progress.

Unfortunately you didn’t use code markup, so we can’t tell if there’s a problem

Sorry, here’s the code.

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    ports:
      - 8123:8123
    volumes:
      - /home/USER/hass/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
    devices:
      - /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2692724-if00:/dev/ttyACM0
    restart: unless-stopped
    privileged: true

Unrelated, but that’s wrong - you’re supposed to be using host networking as shown in the docs. Many integrations won’t work unless you do that.

And what do you see when you run:

ls -al /dev/serial/by-id/

?

I think that came about in some attempt to get HASS to work. I remember running into constant issues with it, and that was the only fix that worked. When I change it back to network_mode: host it stops working.

ls -al /dev/serial/by-id/

From this, I get:

total 0
drwxr-xr-x 2 root root 60 May 23 12:22 .
drwxr-xr-x 4 root root 80 May 22 21:45 ..
lrwxrwxrwx 1 root root 13 May 23 12:22 usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2692724-if00 -> ../../ttyACM0