Kai Kreuzer


Software Architect and IoT Professional.
Founder and project lead of openHAB.

openHAB 1.2 - Release Highlights

Only 8 months after our 1.0 release we have reached release 1.2 - what sounds like an unimportant change in the version, mean in reality that openHAB has now spread out to many areas of home automation. This is noticable by looking at the number of bindings: We have reached 30 bindings now (openHAB 1.0 had 14 bindings) - this means a new binding every two weeks!

When somebody asked me last year, what kind of hardware he could use to start with, the answer was difficult. KNX was our focus, but this is not a suitable system for the average user - especially not, if you do not build a new house, but want to retrofit it. By now the question is much easier to answer - let me give you an overview of the new possibilities that the openHAB 1.2 brings:


Homematic Binding

At least for users in Germany, one of the most interesting bindings is the one for Homematic - this is a radio-based (868 MHz) solution with a long list of available sensors and actuators that covers a wide range of home automation needs. openHAB can now integrate with the Homematic CCU, the central gateway of a Homematic installation. You can therefore now make use of all the nice UIs of openHAB and its powerful automation possibilities. But most importantly, you can now very easily integrate your Homematic devices with all others that are supported by openHAB - e.g. you could extend your KNX installation by Homematic devices, where ever you cannot reach out with a KNX bus cable.


Philips Hue Binding


If you are looking for a simple solution for light control, the Philips Hue system is a perfect fit. You can simply replace your existing bulbs and you can instantly switch them, dim them, change their color temperature or change their color altogether. The Hue System can be extended by the Living Whites plug, i.e. you can also include your existing lights or switch other sockets.

Note that a Philips Hue system is not really handy if used standalone. You can only use the features through a smartphone app. And yes, it is very tedious to always grab your phone when you need to switch the light. Luckily Philips encourages developers to integrate it. In combination with openHAB, you can therefore use wall switches (Homematic, KNX, etc.) or NFC tags to enjoy all the power of the Hue bulbs.


DMX Binding


If you prefer a more professional touch, you could go for the DMX binding. DMX is often used for stage lighting and effects. The DMX binding makes use of the Open Lighting Architecture (OLA). You can program it to do fades and loops and many cool things. This is probably the binding of choice for illuminating your house for next Christmas :-)


Koubachi Binding

Want to integrate your plants in your home automation? Have a look at Koubachi! Koubachi offers sensors that you simply stick in your plant pot and which provides information about soil moisture, temperature and brightness. Koubachi then calculates watering instructions and makes sure that you will never forget to take care of your plants. The openHAB Koubachi now gives you access to all sensor values as well as to the calculated instructions. Koubachis' slogan "give your plants a voice" thus becomes reality with openHAB text-to-speech. But instead of picking up the watering-can yourself, you could instead also automate your irrigation system!


Further new bindings include RFXCOM, Samsung TV and PulseAudio.

HABDroid with NFC-Support

The Android native client is now available on Google Play Store! Besides full support of all new runtime features such as the color picker widget, it now comes with a fantastic NFC-support: You can very easily program NFC tags to use them to open a specific page in HABDroid or to directly trigger an action. This makes it possible to have quick access to what you need in a certain context (e.g. room). It can also be used instead of a physical button whereever it is difficult to have one - e.g. at a socket in the garden, at the garage door, etc. I bet you can think of a million other use cases for it!


There are many other new features and enhancements in this release - just check out our release notes to find out about all details.

If you are interested in openHAB, you shouldn't miss our upcoming talks and live demos: On April 24 you will find us at JAX 2013 in Mainz and on May 16 at GeeCON 2013!

Read more...


OSGi Connects the World

Although I keep talking to people about why OSGi is a great technology to do software development especially for modular systems, I today do not want to delve into technical details such as OSGi Declarative Services etc., but rather tell you about the result of building a modular software system, as I did with openHAB (the open Home Automation Bus).

Being fully based on OSGi, openHAB naturally is very modular by design. It has meanwhile grown to the respectable size of about 80 bundles. Many of these are optional parts and that is a crucial feature of an integration platform for the Smart Home. Every home is different and with the abundance of HA protocols, systems and devices, you won't find two setups with the same set of required integration features. As openHAB allows adding support for a new system by implementing a single OSGi bundle (a so-called "binding"), we have seen a great activity in the community during the past months. Many cool contributions were submitted, e.g. bindings for Sonos, Plugwise, Modbus, PLCBus, IHC etc. that we integrated in the openHAB version 1.1, which was released yesterday.

The interesting thing is that many of the contributors did not know about OSGi or at least never used it before. Being able to work on their code in isolation and simply offering it to the project through a pull request made it perfectly easy to implement and contribute. Nobody complained about having to learn OSGi specifics, although openHAB makes heavy use of it (e.g. of the EventAdmin and ConfigurationAdmin service, the Declarative Services, Eclipse target platforms etc.). It seems that the benefits were conceived more valuable than the burden - a good way to win new OSGi users :-)

Besides the bindings, the persistence services are a feature for which many contributions are done. These allow easy integration with the hyped IoT (Internet of Things) platforms and all kinds of databases.

Looking back at this evolution of the project, I am perfectly sure that if I had designed openHAB as a normal Java application instead of an OSGi application, it would not have prospered as it did. It is really the choice of the software architecture that made it happen - and as a nice side effect, the community is not a pure user community as it is the case for many other Open Source projects, but it is full of engaged people who actively contribute to the project.

As a conclusion I must say that OSGi was a wonderful choice - it now not only brings together the isolated HA systems in many homes, but it also connected people from all over the globe with the same passion for home automation!

Read more...


Openhab 1

openHAB 1.0 - Home Automation For Geeks

After 2.5 years of development, openHAB 1.0 has just been released – a big thanks to everybody involved!


What comes to your mind when you hear the term Home Automation?
Turning off your iron at home while you are on the road? 
Automatically closing your rollershutters at night?

Many commercial offerings concentrate on such use cases, which do not sound very exciting at all. Even worse, they constrain you to the use cases the product managers had in mind and do not allow extending the (usually very expensive) system on your own.


The open Home Automation Bus (openHAB)is different – first of all, it is Open Source and comes with a very modular (OSGi-based) architecture, so that it is easy to extend or customize. By connecting it to e.g. your KNX installation, you can of course do the mainstream things like switching lights, sockets and rollershutters. openHAB offers you two different web interfaces as well as native Android and iOS clients for doing so.

But everybody who lives in a Smart Home knows that Home Automation is not so much about controlling things, but rather about monitoring states and handling events. And that is where openHAB shows its strengh – let me give you a few examples:


XMPP (Chatting with your house)– Receive notifications as instant messages through XMPP (e.g. GTalk or Jabber) – on your PC, smartphone or tablet. Just add your house to your buddy list or block it, if you do not want to be disturbed. Alternatively, you can initiate a chat and actively check the situation at home or send commands to your devices.




Google Calendar – Maintain a Google Calendar for your automation tasks (heating control, shutters, alarm clock, etc.) and define them right in the calendar entry („send Shutters DOWN“). If necessary, you can even define complex scripts right in your calendar. openHAB will make sure that they are executed at the right time.




Persistence and Charting – Store your values and states anywhere you like: In a local database (classic or round-robin), in dedicated log files or even in an Internet-of-Things cloud service. Use the persisted data for defining complex automation logic or for dynamic chart generation.





Presence Simulation – Combine Google Calendar and persistence support into the ultimate presence simulation: openHAB uploads events for dedicated devices (e.g. corridor lights and window shutters) to your Google Calendar throughout your daily life – but not for the date they occurred, but e.g. for a week later. If you now leave your house, simply activate the presence simulation; and all devices will be automatically operated through your calendar entries. No need to train or extensively configure the system, and you always have the chance to do manual adjustments by simply accessing your calendar.


Powerful Rules – Easily define even complex logic: Home Automation use cases can be tricky – there is no way around that. Graphical tools for mouse operation and drag&drop support very quickly show their limitations. That is why openHAB counts on textual descriptions for your rules. But it does this in a very comfortable way: The syntax is defined by a tailored domain specific language (DSL) using Eclipse Xtext. As a consequence, it has a very simple and concise syntax and comes with full editor support like syntax highlighting, validation and code completion. This way, you have almost the full power of a programming language at your fingertips, while not exposing it to non-technical users for simple use cases.


iOS Push Notifications – Receive push notifications to your iPhone: There are situations in which you want to be sure that you receive information from your house right away. Apple offers the iOS push notifications for this case. With the help of the Prowl app, openHAB allows sending such messages easily from within any rule.


Dropbox – Use Dropbox to have your openHAB installation always under control. Synchronize log files to your Dropbox to view them from anywhere you are. Conversely, edit your configuration, your rules and your UI declarations directly in your Dropbox and synchronize it back to the openHAB installation.


These are just a few examples of where openHAB provides functionality beyond the ordinary. Many more are in the pipeline for upcoming releases – go and check out the homepage at http://www.openHAB.orgfor more information!


Read more...


Xtext + Xbase + Quartz + Joda Time = Perfect Rule Engine

Half a year ago I sketched my ideas for a new rule engine for the open Home Automation Bus (openHAB). I had presented an initial version at EclipseCon Europe 2011 and it is by now used by most openHAB users - I think Xtext/Xbase has been a great choice for this implementation and I would like to share some information of how this solution looks like.

1. Xtext for the Rule Skeleton

Xtext allows us to freely define the syntax for our rule definitions. An openHAB rule consists out of two sections, the trigger definition and the script to execute. openHAB specific concepts such as items and events can be nicely integrated into the grammar. An example rule would look like this:
rule "Turn light on"
when
Item
Door changed to OPEN
then
Light.postUpdate(ON)
end

2. Xbase for the Execution Code Block

The "then" part of a rule could simply be designed to be a sequence of pre-defined commands to execute. Reality shows that most users quickly require much more than this - they ask for complex calculation possibilities and execution flow constructs. Xbase comes in very handy as a powerful and customizable scripting language that is an integral part of Xtext. The functional programming oriented constructs make it easy to express logic in a few lines, where "classical" object-oriented languages would require much more procedural code:
rule "Initialize light states with random values"
when
System started
then
Lights?.members.forEach(light|
light.postUpdate(if(Math::random > 0.7) ON else OFF)
)
end

3. Quartz as a Scheduler

Many home automation use cases require to execute actions regularly at certain times. openHAB makes use of the Quartz library, which is helpful for scheduling jobs for execution in Java. As the cron syntax is very expressive, openHAB allows to directly use cron strings for time trigger definitions. Alternatively - for very common values - some pre-defined strings such as "noon" and "midnight" can be used:
rule "Time trigger"
when
Time is midnight or
Time cron "0 15 * * * ?"
then
callScript("doSomething")
end

4. Joda Time for Date and Time Calculations

In many cases you might want to refer to a relative point in time, e.g. "one hour ago", or "on the 1st of this month". Joda Time has a wonderful simple and yet very powerful fluent API to do exactly such kind of things. In openHAB, you can use this to access historic information as well as for scheduling code for future execution - in the latter case, the code will be run as a scheduled Quartz job.

rule "Automatically turn off Staircase Lights"
when
Item Light_Staircase received command ON
then
createTimer(now.plusMinutes(10)) [|
Light_Staircase.sendCommand(OFF)
]
end
rule "Turn on irrigation system after two days without rain"
when
Time is midnight
then
if(Rain==OFF && !Rain.changedSince(now.minusDays(2))) {
Irrigation.sendCommand(ON)
}
end

Summary

For most openHAB users this new rule engine is a better choice than the previous Drools-based engine. Although it does not offer as many rule features as Drools does (e.g. conditional triggers, rule grouping, dynamic deactivation, execution order inference etc.), it proves to be strong on other important points:
  • It has a syntax that is easy to read and write and which integrates well with openHAB concepts such as items and events.
  • It has full IDE support in the openHAB Designer such as syntax validation and highlighting, content assist etc.
  • It is much leaner at runtime as the code is interpreted and does not need to be compiled to Java byte code (which in turn requires a Java compiler to be part of the runtime)
  • It has very limited memory requirements at runtime as the code is very compact and it does not require any dedicated rule engine context where item state information would be duplicated.
For these reasons, the new rule engine has been made the default, which is shipped with the core openHAB runtime distribution. For users who require the full power of Drools, a separate Drools-package is still available as an optional download.

Read more...


This Is Not Your Father's House!

To continue the "Not your father's" series (see Sven's blog and Marcel's blog) you can imagine that if even Java and IDEs have evolved over the years, the way that people want to use and operate their houses has tremendously changed as well!

As many EclipseCon attendees are likely to spend more time with their IDE and Java than with their families at home, they might find the idea appealing to also use Eclipse technologies for remotely adjusting the heating, turning off the lights, checking if the latest internet shopping has arrived or telling their spouses "I love you" through XMPP and text-to-speech, while staying late in the office another time ;-)

So if you are a geek and are interested in hardware, do not miss my talk at EclipseCon Europe this Thursday, 11.30am. I am going to demonstrate you how easy it is to add new hardware devices to your home automation infrastructure as well - luckily a few sensors are spread out over the conference venue.

You have not heard about the M2M contest at EclipseCon Europe yet? Go and prepare yourself for your participation then! And no worries - I won't compete with you in the programming contest as I will be a member of the jury :-) Looking forward to your submissions!

Read more...