ZHA with docker

I have HA installed as a docker container on a raspberry.
I tried to add ZHA integration from HA, but when I select my conbee II usb key I’m asked for a serial device path (which is /dev/ttyACM0 on raspberry).
I don’t know how to map the port from raspberry to the container.
I tried inserting these lines in the docker compose file, however it did not work.

What’s wrong ?

services:
home-assistant:
container_name: home-assistant
image: ghcr.io/home-assistant/home-assistant:stable
volumes:
- /home/pi/homeAssistant:/config
devices:
- /dev/bus/usb/001/007:/dev/ttyACM0
environment:
- TZ=Europe/Rome
privileged: true
restart: always
ports:
- “8123:8123”

You’re running the container in privileged mode, so you don’t need to manually pass through any devices; the container already has access to all devices on the host system. That being said, I would recommend using the /dev/serial/by-id path to the stick when setting up ZHA which won’t change on reboot like /dev/ttyACM0 might.

That being said, despite what the HA Container installation instructions show, I would recommend not running the container in privileged mode for security purposes and just pass the devices through manually instead. Using the /dev/serial/by-id path like I mentioned above, that would look like

devices:
- /dev/serial/by-id/whatever-the-conbee-is:/dev/zigbee

/dev/zigbee can be whatever path you want as long as you select that path when setting up ZHA.

I changed the docker.compose file:
services:
home-assistant:
container_name: home-assistant
image: ghcr.io/home-assistant/home-assistant:stable
volumes:
- /home/pi/homeAssistant:/config
devices:
- /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2426528-if00:/dev/conbee
environment:
- TZ=Europe/Rome
restart: always
ports:
- “8123:8123”

But when, from HA, I configure ZHA and it asks me for a serial port I don0t have anything on the list. If I try to input /dev/conbee I get an error

Do you have any suggestion about this issue? I’m not able to map the ttyACM0 serial port from raspberry to docker container

I saw the link, but my problem is not solved

I think something is missing.

This is my docker-compose file (relative to homeassistant)

home-assistant:
container_name: home-assistant
image: ghcr.io/home-assistant/home-assistant:stable
volumes:
- /home/pi/homeassistant:/config
- /run/dbus:/run/dbus:ro
devices:
- /etc/ttyACM0:/etc/ttyACM0
environment:
- TZ=Europe/Rome
network_mode: host
restart: always

I already use a similar configuration for zigbee2mqtt (as docker container) and it worked.
However, I need to try ZHA to see if my Bticino objects are recognized.
But ZHA works only as integration.

My problem is not solved yet.

I think something is missing.

This is my docker-compose file (relative to homeassistant)

home-assistant:
container_name: home-assistant
image: ghcr.io/home-assistant/home-assistant:stable
volumes:
- /home/pi/homeassistant:/config
- /run/dbus:/run/dbus:ro
devices:
- /etc/ttyACM0:/etc/ttyACM0
environment:
- TZ=Europe/Rome
network_mode: host
restart: always

I already used a similar configuration for zigbee2mqtt (as docker container) and it worked.
However, I need to try ZHA to see if my Bticino objects are recognized.
But ZHA works only as integration.

What error? Did you select the right adapter type when setting up ZHA?

Also, did you run docker-compose up -d home-assistant after changing your compose file?

Sorry, I’m new to HA and I just rebooted the raspberry and I didn’t run the docker-compose up -d home-assistant command

Now I see the ZHA conbee ii integration in the integration settings, thanks

No prob. That’s not an HA-specific thing though. When you change something in docker-compose.yaml you need to re-create the container for it to take effect (which is what that command I shared before does)

Now it’s working but I have to change the channel from 15 to 11, I don’t find the option!

Thanks! I will try now!

Hi

I’m having a similar issue with the Conbee II USB stick and HA running as a Docker container. My docker-compose.yml file looks as follows:

   1   │ version: '3'
   2   │ services:
   3   │   home-assistant:
   4   │     container_name: homeassistant
   5   │     image: "ghcr.io/home-assistant/home-assistant:stable"
   6   │     volumes:
   7   │       - /home/johan/ha-config:/config
   8   │       - /etc/localtime:/etc/localtime:ro
   9   │     devices:
  10   │       - /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2684042-if00:/dev/conbee
  11   │     restart: unless-stopped
  12   │     privileged: true
  13   │     network_mode: host

Attempting to add the Zigbee integration with the device path /dev/conbee results in an error. The log is as follows:

2023-09-20 22:07:32.631 DEBUG (MainThread) [zigpy.serial] Opening a serial connection to '/dev/conbee' (38400 baudrate)
2023-09-20 22:07:32.635 DEBUG (MainThread) [zigpy_deconz.api] Command Command.read_parameter (1, <NetworkParameter.protocol_version: 34>, b'')
2023-09-20 22:07:32.639 DEBUG (MainThread) [zigpy_deconz.api] Received command read_parameter[3, 34, b'\x0e\x01']
2023-09-20 22:07:32.641 DEBUG (MainThread) [zigpy_deconz.api] Read parameter protocol_version response: [270]
2023-09-20 22:07:32.641 DEBUG (MainThread) [zigpy_deconz.api] Command Command.version (0,)
2023-09-20 22:07:32.646 DEBUG (MainThread) [zigpy_deconz.api] Received command version[645007104]
2023-09-20 22:07:32.646 DEBUG (MainThread) [zigpy_deconz.api] Version response: 26720700
2023-09-20 22:07:32.647 DEBUG (MainThread) [zigpy_deconz.api] Serial '/dev/conbee' connection lost unexpectedly: None
2023-09-20 22:07:32.655 DEBUG (MainThread) [zigpy.serial] Opening a serial connection to '/dev/conbee' (38400 baudrate)
2023-09-20 22:07:32.657 DEBUG (MainThread) [zigpy_deconz.api] Command Command.read_parameter (1, <NetworkParameter.protocol_version: 34>, b'')
2023-09-20 22:07:32.661 DEBUG (MainThread) [zigpy_deconz.api] Received command read_parameter[3, 34, b'\x0e\x01']
2023-09-20 22:07:32.661 DEBUG (MainThread) [zigpy_deconz.api] Read parameter protocol_version response: [270]
2023-09-20 22:07:32.661 DEBUG (MainThread) [zigpy_deconz.api] Command Command.version (0,)
2023-09-20 22:07:32.670 DEBUG (MainThread) [zigpy_deconz.api] Received command version[645007104]
2023-09-20 22:07:32.670 DEBUG (MainThread) [zigpy_deconz.api] Version response: 26720700
2023-09-20 22:07:32.676 DEBUG (MainThread) [zigpy_deconz.api] Command Command.read_parameter (1, <NetworkParameter.mac_address: 1>, b'')
2023-09-20 22:07:32.680 DEBUG (MainThread) [zigpy_deconz.api] Received command read_parameter[9, 1, b'\xfe\xb6\t\xff\xff.!\x00']
2023-09-20 22:07:32.681 DEBUG (MainThread) [zigpy_deconz.api] Read parameter mac_address response: [00:21:2e:ff:ff:09:b6:fe]
2023-09-20 22:07:32.681 DEBUG (MainThread) [zigpy_deconz.api] Command Command.read_parameter (1, <NetworkParameter.aps_designed_coordinator: 9>, b'')
2023-09-20 22:07:32.689 DEBUG (MainThread) [zigpy_deconz.api] Received command read_parameter[2, 9, b'\x01']
2023-09-20 22:07:32.689 DEBUG (MainThread) [zigpy_deconz.api] Read parameter aps_designed_coordinator response: [1]
2023-09-20 22:07:32.690 DEBUG (MainThread) [zigpy_deconz.api] Command Command.read_parameter (1, <NetworkParameter.nwk_address: 7>, b'')
2023-09-20 22:07:32.694 DEBUG (MainThread) [zigpy_deconz.api] Received command read_parameter[3, 7, b'\x00\x00']
2023-09-20 22:07:32.695 DEBUG (MainThread) [zigpy_deconz.api] Read parameter nwk_address response: [0x0000]
2023-09-20 22:07:32.695 DEBUG (MainThread) [zigpy_deconz.api] Command Command.read_parameter (1, <NetworkParameter.nwk_panid: 5>, b'')
2023-09-20 22:07:33.128 DEBUG (MainThread) [zigpy_deconz.api] Received command mac_poll[13, <DeconzAddress address_mode=AddressMode.NWK address=0x7087>, 255, -37]
2023-09-20 22:07:34.497 WARNING (MainThread) [zigpy_deconz.api] No response to 'Command.read_parameter' command with seq id '0x07'
2023-09-20 22:07:34.501 DEBUG (MainThread) [zigpy_deconz.api] Serial '/dev/conbee' connection lost unexpectedly: None
2023-09-20 22:07:35.502 ERROR (MainThread) [aiohttp.server] Error handling request

Any hints very welcome!

Thanks
Johan

Update

Solved by updating firmware as described here: Update deCONZ manually · dresden-elektronik/deconz-rest-plugin Wiki · GitHub