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.

openhab-logo-top

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.

Head-Banner_z-wave-de51

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:

Screenshot_2015-12-06-18-28-26

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.

Advertisements

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:

easy_Deployment

I wrote a book! …kind of…

Today I unexpectedly received a package from Sweden. It contained a copy of the book “Actionable Agile Tools” by Jeff Campbell. What makes the book special is that it uses an open source approach: You can access everything at Github. After Jeff initially put the book up there I made several suggestions to improve it, resulting in multiple Pull Requests.

Jeff promised to send me a copy once the book is released and he delivered. Thanks a lot Jeff, great work!

DynRow for the Unreal Engine: URow

I’ve been binge watching all the Unreal Engine tutorial videos on Youtube for the last days. The concept of the engine gets more clear with every small step I’m taking.

Yesterday I started implementing the ConstPace bot from DynRow into Unreals Blueprint interface. It worked quite well, here’s a screenshot of the layout:

overview

And here’s the curve I’m currently using to create a decent looking rowing dynamic:

curve

It’s working quite well for now, I’ve just uploaded a video to Youtube to show the progress. This however is just a small step, I’ve got a lot of things on my list: Create more complex bots, build the UI, implement a backend to access the ergometer, … The list goes on and on.

Here’s the video:

Unreal Engine is free – and it’s great!

Epic Games recently announced that their Unreal Engine is available for free now. There are certain limitations when using it commercially, but these are far from being a limitation.

During the day I watched a lot of videos on the Epic Youtube-Channel, I also tried a few different things and discovered /r/unrealengine on reddit. I’m very fascinated by how complex, but well-thought the software is. I’ve rarely seen something big like that which also seems to simply work. I’m still working on getting a general overview to see the whole potential.

Perhaps it’d be worth it to remake DynRow in the Unreal Engine? There would be a lot of advantages I could see right now, like being able to support multiplatforms out of the box (Windows, Android, iOS, …) or having all these mighty tools in the background to help me developing it. Of course it would be perfect to have such high fidelity graphics available. What about a rowing simulation with VR support?

I’m hyped, let’s see what’ll be possible.

Just implemented Record & Replay

DynRow now records the users workout-data to a SQLite database during the session. This has several advantages:

  • Ghost Bot: This one is already implemented. There is a new Bot available which is able to read the SQLite data and apply it. The result is an opponent which rows exactly like the user rowed during a previous workout
  • Share workout: This is kind of related to the Ghost Bot. Users are now able to share their saved workouts with others. This means that it is possible to row against your rowing buddies or athletes you want to compete with
  • Better testing: I’m currently just creating data on the fly when no erg is connected. Though this is a good way to test the basic functionality it is always better to have real-life testing data. By being able to integrate previous workouts as a way to test it is now possible to easily reproduce certain bugs
  • Statistics: A workout application without the ability to generate complex statistics is not really exciting. By recording everything the user does during workout the foundation of generating statistics is now laid

One thing is also a bit related, but’ll need a bit more work to get it running: The ability to share the rowing data online during the workout. This would essentially allow to row against others in realtime over the internet. This feature is not planned as of yet, but it won’t be impossible to realize.

Introducing Boomerang Bots

I fixed a lot of different issues with DynRow in the last days, but one feature stands out: I created Boomerang Bots. These bots are rowing with a constant pace until they get out of a certain range. Then they’ll reduce or increase speed to stay near the player.

This way it is possible to have different bots around the player for the entire exercise. This adresses one of the bigger problems I had with the available rowing software: I set up an opponent with a certain speed. In the beginning of the workout the opponent stayed near the boat and was a good motivation to keep going. Sometime during my workout however I was able to row faster than the bot or the bot was rowing away – I was basically rowing on my own for the rest of the time.

Boomerang Bots forgive smaller pauses the player does, they also keep up when the player has a good day and is rowing faster than expected.

Here’s a video I made: Youtube

So what’s next? I started refactoring the inner working and will do that primarily during the next days. I also want to make everything more user-friendly. Currently there’s no starting screen and the user needs to alter the code to set up his workout.