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 my.openhab.com. 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:

heizung_pc.rules

rule "heizung_pc"
when
    Item Wall_Plug_Power changed
then
    if(Wall_Plug_Power.state > 30.0)
    {
        sendCommand(Thermo_TempSet, 21)
    }
    else
    {
        sendCommand(Thermo_TempSet, 18)
    }
end

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.

Avast 2015 blocks Qt-based executables

I just ran into a very strange problem that almost caused me to reinstall my OS:

I installed QtCreator with a MinGW toolset fresh from the Qt-Homepage. Everything worked as expected and I created an empty Hello World project to test things out. From then on it got ugly: When starting the project QtCreator froze and I wasn’t able to delete the generated .exe file.

I did some research and found nothing of help. There were some issues with early Windows 10 builds or some users having incorrect runtime environments. In the end it turned out that the issue was caused by Avast 2015 – It blocked all Qt-based executables, whether they’re started by QtCreator or directly.

I turned off active filesystem search and was able to use my executable. Hope this helps someone out there experiencing the same issue.

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:

Danfoss_Valve.items

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" }

Fibaro_Wallplug.items

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:

default.sitemap

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.

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.

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.