Concept2, Fitznet and Unity

I tried something new this weekend and created a Unity integration with my C2 ergometer. I was following the approach that I wrote about a few months ago:


For my test-integration I used this script to generate some Bots and (a simulated) player. I then learned the basics of Unity to connect some sort of generic 3D application to show what the boats are doing.

I uploaded the Unity project to Github too, it has some nice features integrated and I’m planning on extending it in the future.

I called the communication layer Fitznet – there’s Fitness and Network in there I guess. The protocol is based on Google Protobuf, I also created a small ZMQ Forwarder to keep the set up easy. Currently the whole thing is in an early development phase and I’m not sure if it will ever leave this state. But there’s some potential in there I think, perhaps if the right people are working on it…

Here’s a video of the current progress:


OpenHAB: Let the washer notify you when it’s finished

Our washing machine is located in the back of the house. This is sometimes a problem when we forget that we turned it on. Unfortunately it’s not one of those models that beep loudly when finished, it just stays there and let’s the wet clothes get stinky.

Thanks to OpenHAB I’m now able to get notified onto my Android phone whenever the washer is finished washing. I previously set up the OpenHAB remote service available via You need to install their addon, create an account and fill in the secret key of your OpenHAB installation. After that you can connect the official Android App with that service and access your OpenHAB on the go.

I also had to set up a Persistence config that stores the values of my items. I used the mysql addon with a local mysql-db. I used this tutorial to get it up and running.

I used a Fibaro wall plug to check the energy consumption of the washer. Find the configs on Pastebin:

Whenever the energy consumption goes up, the rule switches into the “Washer is active” state. If then the washer uses no energy for about 2 minutes, it goes into the “Washer is finished” state. Thanks to the Android App I’m getting notified whenever the state changes.

OpenHAB: Turn on heating whenever someone’s in the home office

Home automation is nothing without automation, so I set up my first rule yesterday.

As previously posted I have a testing environment consisting of a Devolo heat valve and a Fibaro wall plug. The wall plug is connected to my desktop computer which I often use when I’m working in my home office (like now).

Instead of having to manually turn on and of the heating whenever I’m in the home office I wanted to automate that. The following rule was born:


rule "heizung_pc"
    Item Wall_Plug_Power changed
    if(Wall_Plug_Power.state > 30.0)
        sendCommand(Thermo_TempSet, 21)
        sendCommand(Thermo_TempSet, 18)

It’s nothing more than that with OpenHAB.

UPDATE: I reworked the rule and set up a more complex system that is much more flexible. The Sitemap now allows the user to set the temperatures they want for “PC is turned on” and “PC is turned off”. It is also possible to overwrite the temperature until the next time the PC is turned on/off.

I won’t paste the whole config into this post, because it’s a bit bigger. See Pastebin for how I did my setup:

Sorry for the german/english mixup in the files. I usually like to do everything programming-related in plain English, but this is a system used by Germans (me and my wife), so I have to account for that.

Configuring OpenHAB to work with my devices

After installing everything I needed to set up a configuration that allows me to use my devices. I got a Fibaro wall plug and a Devolo valve (which is in fact a Danfoss valve as I learned later on).

Via HABmin I was able to see that the devices were connected to my Aeon Labs Aeotec Z-Stick, and via different forums and newsgroups I was able to find some possible configurations. My current item config looks like the following:


Number	Thermo_TempSet	"Zieltemperatur [%.1f °C]"	    { zwave="2:command=thermostat_setpoint,setpoint_type=1,setpoint_scale=0" }
Number  Thermo_Temp     "Temperatur [%.1f °C]"          { zwave="2:command=sensor_multilevel" }
Number	Thermo_Battery	"Batterie [%.1f %%]"		    { zwave="2:command=battery" }


Switch	Wall_Plug	        "Steckdose"	                { zwave="3:command=switch_binary" }
Number	Wall_Plug_Power	    "PC - Verbrauch [%.1f W]"	{ zwave="3:command=sensor_multilevel" }
Number	Wall_Plug_Energy	"PC - Gesamt [%.2f KWh]"	{ zwave="3:command=meter" }

Defining the items is nothing without a sitemap that shows the values and let me control everything. My corresponding sitemap looks like the following:


sitemap default label="Zuhause"
	Frame label="Home" {
		Group label="Arbeitszimmer" icon="office" {
			Frame label="Heizung" icon="heating" {
				Setpoint item=Thermo_TempSet icon="heating" minValue=4 maxValue=26 step=1
				Text item=Thermo_Temp icon="heating"
				Text item=Thermo_Battery icon="energy"
			Frame label="Steckdose" icon="socket" {
				Text item=Wall_Plug_Power icon="socket"
				Text item=Wall_Plug_Energy icon="socket"
			Frame label="Statistiken" icon="socket" {
				Chart item=Wall_Plug_Power period=3D refresh=10000
				Chart item=Thermo_Temp period=3D refresh=10000


Installing OpenHAB onto the Raspberry Pi 2

Installing OpenHAB onto the Raspberry Pi 2 is quite straight-forward. There was just one little problem I experienced that wasn’t documented anywhere. These are the steps I followed:

  • Install Raspbian Jessie onto the Raspberry Pi 2
  • Configure the system itself: Extend the partition, enable SSL access etc. There’s tons of documentation online for this step.
  • Install OpenHAB. I followed the official documentation and everything worked like expected
  • Attention: Now there was an issue which I do not notice at first: When using the above steps to install OpenHAB the user permissions aren’t set up correctly. I had to configure the openhab user as the file-owner manually:
chown -R openhab: /etc/openhab/
chown -R openhab: /usr/share/openhab/
chown -R openhab: /var/log/openhab

After all these steps I was able to start up OpenHAB and everything worked like expected. However there wasn’t much to see, I hadn’t configured any items or sitemaps yet.

To change this I first install HABmin1 and HABmin2. I’d recommend to install both versions in parallel, as they have very different features that are mostly useful in just one of the versions. I had to install the current source versions as the latest releases were a bit dated. The installed OpenHAB version was 1.7.1, while the latest release for HABMin was meant for 1.5.0.

In addition I used apt-get to install the zwave binding. Pretty straight forward again. I added the address of my ZWave stick (/dev/ttyACM0 on my system) and got it running. With the help of HABmin and some experimenting I then was able to get my components connected and running.

Home automation with OpenHAB and ZWave

Since I bought my own house I had the topic ‘home automation’ on my Todo list. There wasn’t much time during the year to tinker around, so I had to wait until now to do my first steps.


After some research I decided to go with the open source solution OpenHAB. The big advantage is that it runs on practically every hardware and connects to almost anything. The protocol I wanted to use was ZWave. This technology standard is supported by more than 200 companies with around 2000 products.


I ordered a Raspberry Pi 2 as a base to run OpenHAB on. The docs state that the combination of OpenHAB and ZWave on a Raspberry Pi is a bit tricky, but I did not have any problems so far. I guess the issues are more a problem on the RPi1 as it doesn’t provide enough performance. I’m using the Aeon Labs Aeotec Z-Stick, which was at first difficult to get running, but once configured correctly runs like a charm. It registers itself as a modem called /dev/ttyACM0 and is supported out of the box by Raspbian Jessie.

For a first approach I ordered a Devolo valve and a Fibaro wall plug. This allows me to test different usecases. As standalone components these are able to measure electricity or report and control the room temperature. In combination I can turn on the heat whenever my desktop PC runs. My plan was to test the system with these components and if everything runs as expected to buy some more and create a housewide system. Perhaps Santa has some of these in stock too 😉

With the OpenHAB Android application I can now control both components, the current configuration looks like the following:


I’ll post some more information about my setup and how it it set up shortly. There is a good amount of documentation, but having real examples on how to create everything is worth a lot. It’s not a solution that simply runs out of the box.

Decoupling the Concept 2 SDK

After a long summer with a lot of work in the garden and in the office I finally got back to writing code for the rowing machine. My last approaches were to use a rather complicated Python setup with DynRow and a quite successful, though basic integration into the Unreal engine. Both were interesting, but the problems with interfacing the Concept 2 interface had been a big showstopper.

This is why I decided to create a simple application that decouples the C2 SDK from the application that shows the actual data. I used a new high-level C++ API called easy-erg to connect to the ergometer. With the help of ZMQ and Google Protobuf I was able to stream all the rowing data into my WLAN.

As a first test I changed the DynRow interface from using PyRow to using the Zmq-Proto interface. It was a great success and showed that the concept actually works. As a next step I want to create some sort of what DynRow was, but in a very modularized way. It is now possible to have a Playground application showing all the connected boats. There than could be a number of boats connected, created by actual rowers, generated bots or prerecorded workouts. I’ve created a deployment diagram which shows the potential that lies in the concept: