Several months ago I blogged about compiling open-zwave for Home Assistant 0.45 on Docker. There were two reasons I did this:
- I had a Linear Z-Wave Garage Door opener - this feature was only available in the development branch of openzwave.
- I wanted up-to-date device configurations for newer Z-Wave devices.
Unfortunately, the development branch was less stable than I liked and the opener never worked quite right. So #1 was no longer a reason to compile the library myself.
In fact, it turns out that #2 can be accomplished without compiling the library either - you can simply update the XML files that openzwave uses! I've therefore stopped managing/creating custom images and simply update the official Home Assistant Docker image with updated device config files.
I'm automating the process of apply updated XML files by using this custom
FROM homeassistant/home-assistant:latest RUN set -e && \ apt update && \ apt install -y unzip && \ wget -O /tmp/ozw.zip https://github.com/OpenZWave/open-zwave/archive/master.zip && \ cd /tmp && \ unzip /tmp/ozw.zip && \ cp -R /tmp/open-zwave-master/config/* /usr/local/lib/python3.6/site-packages/python_openzwave/ozw_config/ && \ rm -rf /tmp/ozw.zip /tmp/open-zwave-master && \ apt remove -y unzip && \ rm -rf /var/cache/apt/*
It uses the official Docker image, downloads the latest config files, and unzips them into the proper directory.
You can easily build the image yourself by saving the above
Dockerfile and running a single command:
docker build -t homeassistant .
You can then run that, push it up to your registry, or do whatever you want.
Personally, I like using
docker-compose to manage my containers. I have a
docker-compose.yml file like this:
version: '2' services: home-assistant: build: path/to/wherever/Dockerfile/is/saved container_name: home-assistant restart: always network_mode: host devices: - /dev/ttyACM0 volumes: - /srv/docker/homeassistant:/config - /etc/localtime:/etc/localtime:ro
And then I simply run:
docker-compose build --pull docker-compose up -d