Bouke van der Bijl

Privacy-conscious Home Automation

I bought an apartment last year and one of the things you immediately start doing is figuring out what you want to change about the place. When I bought it there wasn’t any place to put ceiling lights in the center of the living room—I like a nicely lit place so I knew I wanted to make changes. I got a quote from an electrician for installing potlights, adding switches and wiring it all up but it quickly got in the €1000+ range. Therefore I decided to take matters into my own hands!

Drilling holes and pulling wires went mostly fine, what I spent a lot of time on was the switching and home automation part of it. I had these requirements for whatever system I would set-up.

  1. Not WiFi-based—I don’t want my lightbulbs talking to sketchy servers in China.
  2. Wireless buttons—I want to install light switches where I want without having to pull wires through the wall.
  3. HomeKit support—I want to be able to control the lights with my Apple watch.
  4. Don’t want multiple ‘bridges’ for separate standards.

I quickly converged on a Zigbee-based solution. Zigbee is a wireless communication standard that is used by Philips Hue, IKEA and many other devices. Controlling all your devices requires a ‘gateway’—for that I used a device called the Phoscon Conbee which is a German-produced device that can talk to many devices from many manufacturers while having its own pretty straightforward configuration software and a REST API. The fact that they’re German gives me some confidence that privacy-wise it’s pretty okay since the Germans are obsessed with Datenschutz.

I ended up getting the following hardware to go with the gateway:

EcoDim Rotary Dimmer

This device I installed where I previously had other dimmers, it’s nice since people can use the switch like a regular switch but you can control it remotely.

EcoDim Dimmer Module

At first I tried a Lonsonho dimmer I bought off Aliexpress—it’s $15! Unfortunately I found out that it doesn’t ‘smoothly’ dim, it discretely sets the dim levels. I ended up buying this dimmer module which has been super solid.

I used it to wire up all the potlights that I put into my ceiling. One module is wired to multiple lights that I can then control as one unit.

Silvercrest Smart Plug

I have fairy lights on my balcony that I had to run outside into the cold to turn off an on so I got one of these Lidl smart plugs. It’s cheap and has a button on it for manual switching.

TRÅDFRI Button and Dimmer

IKEA’s home automation products are insanely cheap and work well with Deconz. They’re magnetic and I’ve attached a couple to a radiator next to the door of my living room.

Software

Once I got the hardware I had to set up the software to go with it. For the first couple months I had my Conbee stick plugged into an old Linux laptop I had laying around because of the great Raspberry Pi shortage of 2022. I kept a close eye on rpilocator and did manage get my hands on one.

After installing the Deconz software I recommend you download Hue Essentials for your iPhone/Apple Watch because it’s a decent app, supporting the most basic features like dimming and turning everything off and on at once.

Because getting support for Homekit is the most important thing I decided to go with Homebridge instead of something like Home Assistant which might be more powerful but looked super daunting to get set up properly. Homebridge was easy, I needed the Deconz plugin after which I had all my devices show up in Homekit on my phone.

Nix

Of course I used Nix to set up my Raspberry Pi with the services I needed. This is the config I use:

{ config, ... }: 

{
  services.tailscale.enable = true;
  networking = {
    hostName = "homepi";
    firewall = {
      enable = false;
      allowedUDPPorts = [ config.services.tailscale.port 5353 1900 ];
      allowedTCPPorts = [ 22 80 8443 8581 5353 ];
      trustedInterfaces = [ "tailscale0" ];
      checkReversePath = "loose";
    };
  };
  virtualisation.oci-containers = {
    backend = "podman";
    containers = {
      deconz = {
        image = "deconzcommunity/deconz:latest";
        volumes = [
          "/opt/deconz:/opt/deCONZ"
        ];
        extraOptions = [ "--network=host" "--device=/dev/ttyACM0" ];
        environment = {
          TZ = config.time.timeZone;
          DECONZ_WS_PORT = "8443";
        };
      };
      homebridge = {
        image = "oznu/homebridge:latest";
        extraOptions = [ "--network=host" ];
        volumes = [
          "/home/bouke/.homebridge:/homebridge"
        ];
        environment = {
          HOMEBRIDGE_CONFIG_UI = "1";
          HOMEBRIDGE_CONFIG_UI_PORT = "8581";
          PGID = "100";
          PUID = "1001";
          TZ = config.time.timeZone;
        };
      };
    };
  };
}

Conclusion

I’m happy with how it turned out, I accomplished all the goals I had for the project while not breaking the bank. The system is quite extensible, I created a two Shortcuts: one to turn of all the lights and one to slowly fade them on which I’ve scheduled for the morning. Both are using the REST API which was straightforward. Would do again!

Nov 2022