You are currently viewing Setup HomeAssistant with Z-Wave on QNAP Container using Docker

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.

Remember to expose the container 8123 port to any host port, can set it as 8123 if you wish.

You should have the basic installation ready at [I.P Address]:[Port].

Enabling Z-Wave USB Adaptor on QNAP
Plug in your Z-Wave USB to your QNAP, I’ve got the AEON AEOEZW090-C Aeotec Z-Stick Gen5.

Telnet or SSH into your QNAP, check out what’s USB is currently available to the system

 ls /dev/tty* 

Install the cdc-acm kernel module

 insmod /usr/local/modules/cdc-acm.ko 

Check list again, you will find the “/dev/ttyACM0”

 ls /dev/tty* 

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.


Docker Compose

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:

Command Line

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

 ls /dev/tty* 

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.

 insmod /usr/local/modules/cdc-acm.ko 

This Post Has 7 Comments

  1. peelos

    Thank you for this – very helpful. Wondered if you are still able to get this working

    I followed your guide to the letter (ensuring entering the correct paths / names etc) but fail to get the EON AEOEZW090-C Aeotec Z-Stick Gen5 recognized within the docker.

    I ran the command:

    docker run --name home-assistant-zwave --net=bridge --privileged -itd -v /share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/homeassistant-config/_data:/config -e TZ=Europe/Zurich --device /dev/ttyACM0 homeassistant/home-assistant                                                                  
    

    I did have to specify the port mapping in container station again to access the docker and also had to reconfigure the docker setup with integrations.. I now see that the image is set to:

    Image : homeassistant/home-assistant:undefined-data-3

    Any ideas? I will post in the qnap forum aswell if easier

    many thanks –

    1. poyu

      Ah the command need to specify the version of homeassistant/home-assistant image, such as:

      docker run --name home-assistant-zwave --net=bridge --privileged -itd -v /share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/homeassistant-config/_data:/config -e TZ=Europe/Zurich --device /dev/ttyACM0 homeassistant/home-assistant:2021.1.1
      

      Make sure that QNAP can see ttyACM0, otherwise it won’t connect correctly

    2. poyu

      I’ve added a Docker Compose example, which you can assign the USB device via the QNAP GUI. There is no longer a need to link the device with command line.

  2. Guenther

    Just about to buy the same Zwave stick, I have Home Assistant run in a virtual machine. Will it be automatically regocnized by the VM or do I also have to do some Linux command line magic? (which I’m not very fluent with)

    1. poyu

      You just have to enable that USB to the Virtual Machine, so if you can do passthrough then it should work.

  3. TopoTop

    Hello, I know this is an old post. Hoping we can get an update for the new versions of the software.

    I just got the new ZOOZ ZST39 and these instructions are not working for me.

    I have HA running in a docker already and good to go.
    I have portainer running and good.
    I have a QNAP running QTS v4.5

    The instructions are not fully working.

    1. poyu

      There is some features that wouldn’t work with the controller you got ( https://www.home-assistant.io/docs/z-wave/controllers/)…

      To troubleshoot?

      • Can you detect it on your QNAP? (ls /dev/tty*)
      • Have you installed the module to cdc-acm kernel module?
      • Go into your HA docker using docker exec -it home-assistant-1 bash rename home-assistant-1 to the name you set. Can you see the USB? If not then double check the device is named correctly in the docker compose, you would need to reference HA docker after you installed the module

      .

      Other than that there is no other help I can provide, I have stopped using this feature in my HA

Leave a Reply