A new chapter in my life

Recently a lot is going on in my life. Two things stand out:

My son is born!

Finally on Dec 2nd 2016 my son Mattis was born. The last weeks were tiring, but it’s totally worth it! I’m so looking forward to all the things I’ll be doing with him. He’s currently in a phase where he’s sleeping in a baby carrier every evening, so it’s perfect for me to carry him around and do all the things with him.

Writing a blog post while carrying your son? – Check!

I’m changing jobs!

After 10 years working for Rheinmetall I felt that a change was more than overdue. In the last 2 years I got the chance to lead a very talented team of junior and senior developers – which was great. The only problem was that as soon as we wanted to do something outside of our small team we were restricted by all the downsides that come with large, unflexible companies: Legacy code, complex processes, office politics and more. It was very frustrating to have such a great progress and collaboration, just to get stopped every time by outside factors.

Timing’s everything, and somehow a small company from Bremen got it all right. After another very frustrating day in the office I got contacted by the CEO of Ubimax and from the first moment on it sounded very interesting. The technical side is very interesting and the working environment sounds awesome.

I’ll start by April, but I’m already working on learning everything I can. They’re mostly working on a Java-based technology stack – A thing I do not have a lot of experience with. So far it’s great, it’s much easier to write good quality code with an interpreted language.

Outlook

I’m planning on being more active in the blog, hope this time it works out. I think that plotting down the things I’m learning is a good read for every reader, but also a good reminder for myself. I also hope that ta Ubimax I can be a bit more open with what I’m doing – in the defence sector everything is regulated and I had to be very careful on what information I share. We’ll see how this works out.

Quote of the day:

C++ is a very good language for writing efficient software, but not for writing software efficiently. – Jendrik Kretschmann (though I do not know where he picked it up)

 

Advertisements

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:

easy_Deployment

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 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.