OSGi Connects the World

Posted by Kai Kreuzer on December 17, 2012
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!