Getting the automation to really be automatic: Home Automation update, Spring 2020

A few years ago I gave a talk with my boyfriend about home automation, and the way we were approaching it in our apartment. At the time, I’d decided to use IKEA’s Tr√•dfri hub for controlling my lights, and Home Assistant for integrations and a dashboard. Over time, I’ve found that that hub was less than reliable for my needs, and in fact at one point discovered that it was no longer able to control my bedroom light, one of the key reasons I wanted to use it in the first place!

After exploring new options and talking to some friends about how they’ve gone about their automation, I ordered some parts and got to rearranging my setup.

The New Setup

I initially opted to try and make my setup as off-the-shelf as possible, but what I’ve learned is that paradoxically, the off-the-shelf parts are less reliable than a more DIY solution! So, having made this discovery, here’s my new home automation control setup:

Hardware

  • Raspberry Pi 3B+
  • RaspBee
  • Z-Wave.me “UZB” dongle

I’ve made some price compromises here that I maybe shouldn’t have made; for one thing, the RaspBee 2 came out basically right after I put this machine together, and if I were buying now that’d absolutely be the one I’d go for. By going for the Z-Wave dongle I did, it’s possible I’ll see instability if there’s power issues with the Pi, but I suspect I’ll be fine.

Software

The Raspbee has control software called deCONZ, which I host in a Docker container on the Pi. That software itself has a web interface, Phoscon, and so far I’ve been using that to set up lights and group them into rooms. This area of my setup is potentially going to change–more on that later.

Now there’s a few options for the Z-Wave network; I’ve opted to host zwave2mqtt in another Docker container on the Pi, and pass-through the serial device that the dongle provides to handle this integration. This way, instead of having Home Assistant drive the Z-Wave network, I have a separate container that can run even when HA is updating. Now, Home Assistant sees all of the Z-Wave devices through its MQTT integration.

For MQTT, I’ve opted to run mosquitto on the Pi directly, since it’s reliable enough. This is where my doubts about using Phoscon creep in; instead of using Phoscon and relying on its integration, I’m starting to consider using another MQTT gateway and switch to having all devices route through MQTT, instead of these different gateways into Home Assistant.

Sensors and Devices

I’m still using IKEA’s lights; they work well, they look great, and they’re way cheaper than other options! I’m actually really unimpressed with Hue, and reconfiguring Hue bulbs. It appears that in order to reconfigure the bulb I have, I’ll need to issue some really specific commands to it, which I just can’t do with my current equipment. This stands in contrast to the IKEA approach of toggling power a few times to reset, which worked fantastically for me.

I’ve also picked up a Zooz multi-sensor, and I’m experimenting with how to use it to best handle lights at night. It’s giving me temperature and humidity readings as well, which are handy–and as I look at ceiling fans, for example, they will become potentially much more useful in time.

Automating the automation

The biggest change from my last setup is my increased reliance on and interest in automating the setup and deployment of updates and new versions, to the point that I’ve built the whole environment into a docker-compose.yml file:

version: '3.6'
services:
  zwave2mqtt:
    container_name: zwave2mqtt
    image: robertslando/zwave2mqtt:latest
    restart: always
    tty: true
    stop_signal: SIGINT
    devices:
      - "/dev/ttyACM0:/dev/ttyACM0"
    volumes:
      - /srv/zwave2mqtt:/usr/src/app/store
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "8091:8091"
  deconz:
    container_name: deconz
    restart: always
    image: marthoc/deconz
    environment:
      DECONZ_WEB_PORT: 8080
      DECONZ_WS_PORT: 8443
    devices:
      - "/dev/ttyAMA0:/dev/ttyAMA0"
    network_mode: "host"
    volumes:
      - /srv/deconz:/root/.local/share/dresden-elektronik/deCONZ
      - /etc/localtime:/etc/localtime:ro
  home-assistant:
    container_name: home-assistant
    restart: always
    depends_on:
      - deconz
      - zwave2mqtt
    image: homeassistant/raspberrypi3-homeassistant:stable
    network_mode: "host"
    volumes:
      - /srv/home-assistant:/config
      - /etc/localtime:/etc/localtime:ro

All of the state is stored under the /srv folder, and reconfiguring is easy! Plus, by keeping this under version control, redeploying is not that difficult either.

And now, when I feel like updating (or, ideally soon, once an automated tracking service identifes an update) I can just run a few commands to ensure the status of my home automation stack:

cd /srv/
sudo docker-compose pull
sudo docker-compose -d --build up

These operations don’t take long–and can be automated, I just haven’t spent the time on that yet. Overall, it works great, and I’m much happier with this setup.

Contents