Running Home Assistant In Docker With ZWave

Running Home Assistant in Docker with ZWave


I recently converted my instance on Home Assistant from running in a Python VEnv on bare metal to running in a docker container. While this is a supported configuration, I did make a few changes to the recommended setup. My primary deviation is running the Home Assistant process as a non-root user. That is, specifying --user xxxx:xxxx on docker run, or the equivalent Compose configuration.

For a Home Assistant setup without ZWave this isn’t a problem, but since I run a ZWave network, Home Assistant needs to be able to read and write to the ZWave USB Modem. (In my case, this is /dev/ttyACM0) By default, only root and members of the dialout group can use modems, and my Home Assistant instance was no longer running as root, as the instructions assumed.
Note: This is also applicable to ZigBee sticks as well.


Thankfully, this problem has an easy solution. Rather than running as --user $ArbitraryUID:$ArbitraryGID, I changed the GID to the GID for the dialout group, which is 20 on my system. You can find the GID of the dialout group by running getent group dialout and looking at the third datapoint. (delineated by a colon)