Setup HomeAssistant with Z-Wave on QNAP Container using Docker
Lets begin by making the initial Home Assistant installation, find it on QNAP Container Station. Look for homeassistant/home-assistant.
Add a new “TZ” environment to set your TimeZone, check out the List of tz database time zones
Set a static volume for the container to use, I just use QNAP “New Volume” directory. You can make your own volume using “Volume from host”, though I find permissions being a problem on some docker.
Telnet or SSH into your QNAP, check out what’s USB is currently available to the system
Install the cdc-acm kernel module
Check list again, you will find the “/dev/ttyACM0”
Let’s recreate the home-assistant docker using the newly found device, QNAP does not allow to connect a device to the docker with the GUI you have to do this by command line. First we need the directory of the config folder, by going into Settings > Advanced Settings > Shared Folder.
Stop the home-assistant-1 docker and remove
You can either use a docker compose or run a command to re-create the docker.
Go to Create and ‘+ Create Application’, provide a name for this Application and enter this YAML:
version: '3' services: home-assistant: container_name: [NAME] volumes: - 'config:/config:rw' environment: - [TIMEZONE] devices: - [DEVICE LOCATION ON QNAP]:/dev/ttyACM0 command: --privileged image: homeassistant/home-assistant:[VERSION] ports: - [EXTERNAL PORT]:[INTERNAL PORT: 8123] volumes: config:
For this example use this:
version: '3' services: home-assistant: container_name: homeassistant volumes: - 'config:/config:rw' environment: - TZ=Europe/London devices: - /dev/ttyACM0:/dev/ttyACM0 command: --privileged image: homeassistant/home-assistant:2021.1.1 ports: - 8123:8123 volumes: config:
You will have to redo this every time when there is a homeassistant update.
docker run --name [NAME] --net=bridge --privileged -itd -v [CONFIG_DIRECTORY]:/config -e TZ=[TIMEZONE] --device [USB] homeassistant/home-assistant:[VERSION]
For this example use this command
docker run --name home-assistant --net=bridge --privileged -itd -v /share/CE_CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/homeassistant-config/_data:/config -e TZ=Europe/London --device /dev/ttyACM0 homeassistant/home-assistant:2021.1.1
You should have your Z-Wave USB available within your docker.
To double check if the USB is available you can access the docker
docker exec -it [DOCKER_ID] bash
Check the list if ‘/dev/ttyACM0’ is available
Please note that the installed module setting is lost upon restarting or shutdown on older QNAP firmware, to enable it just run this command. The docker should continue to use the same USB “/dev/ttyACM0” without making the docker again.