Home Automation (part 2)

Note: Part 1 is here

Electrical setup for living room light

Our new place doesn't have any ceiling lights in the living room, but one switch activated wall plug. It is driven by a 2 way setup of 2 switches, and I decided to put the fibaro dimmer in one of them, and replace the standard switch by a push button.

The fibaro dimmer2 has 2 switch inputs, so I took a 2 button ones, and set it up in place of one of the switches, and use a single for the other one.

Currently it works like this:

  • entrance: single switch
  • near tv: double switch
  • single push: light on, same level of dimming as last use, another push to power off
  • double push: light on, full brightness
  • long press: starts at lower power, and slowly rise to allow control of dimming

Using the z-wave grouping, the second switch controls the dimming plug, where I have a floor lamp plugged for now.

Software

First thing first, the usb z-wave dongles are generally seen simplay as usb serial ports, so it will work on almost any system, as long as the software you wan to use runs on it too.

Current setup

I currently plugged the dongle on my NAS, running FreeNAS, in a jail, this caused some issues I'll explain later when detailing the softwares I tested. The computer is an AMD-E350 which is a dual core 1.6GHz, with 8GB of ram.

Likely futur setup

I will probably move the home automation to a separate machine, a lot of people use raspberrypi for this, but I will probably take an odroid-c2, The reason being I do plan on adding voice control, and latency will play a big part in the feeling of it, faster cores will ilkely help a lot in this. We will see.

Testing the softwares

There are various open source options out there to setup your own home automation box:

  • OpenHAB: v1 and v2 (in beta), a pretty huge beast, in java, but very powerful, with a lot of features
  • Domoticz: written in C, it was pretty appealing to me at first (see below)
  • Home-Assistant: written in python, pretty easy to start with
  • Jeedom: opensource but limited if you don't subscribe

I didn't try Jeedom as I wasn't fond of the subscription thing but I did try, or at least try to try, the others.

NOTE: There are other options, I didn't search everything, and didn't had time to try them all, so I only mention the ones I planned to test at first.

OpenHAB

OpenHAB is kinda the go to home automation software, it is well known, well supported, have a lot of features, the version2 has better way to handle things from the UI instead of fiddling with the configuration file, but the issue was that I run FreeBSD/FreeNAS: it comes with packages lib/modules/whatever the java world called them, including the one that handles talking to the serial port.

Unfortunately, there is a bug on FreeBSD with the shipped version, and I didn't dare rebuild everything myself just to patch this lib, so after a while I gave up for now. I still plan to give it a shot if things get easier to get it to work.

If you happen to have more motivation than I and want to try, there is a page about making openhab working on FreeBSD.

Domoticz

Domoticz was the second one I tried, mostly because it is written in C and I felt like it would be easier to fiddle inside it if needed. And I did. I had to fiddle in the code almost straight away, as the USB serial port showed up as /dev/ttyU0 but also as /dev/cuaU0. For some reason, the ifdefs in domoticz code are choosing ttyU for FreeBSD, but on my setup, this one wasn't working, wehereas the cuauU one worked, so I patched it and went with this.

I did set it up, and started using it. One nice thing it had too, is the z-wave network tools, monitongi, inclusion mode etc. That is pretty nice.

I was pretty happy until about 24h later, when for some reason it became pretty slow, like it took about 30 seconds to turn the lights on. So after a quick search, and not finding anything obvious, I went to try another one.

Home Assistant

Home Assistant (HA) is the one I still run today, it is pretty slick, setting it up was fairly easy and I didn't had to patch it. But it requires that you install the python-OpenZWave pacakge, but everything is explained on the getting-started/z-wave page, and it wasn't too hard to do. It has some services about the z-wave network that you can call, but it isn't as integrated as it is in domoticz, I actually didn't had to play with it, as the z-wave itself was already setup at this stage, I simply enable the z-wave component in HA, configured the serial port, and fire it up, and it detected the devices and they worked like a charm.

At first, it is a bit hard to understand what goes where in the configuration, or what the services/stats things in the web-ui are, but once you get a grasp of the basic principles, it is pretty easy to understand, and quite powerful.

Python-lovers will be confortable with the yaml configuration and the use of templates (as in jinja-templates) for some advanced usage.

Let's stop here for this part, the third one will talk about my current HA configuration.