Over a million developers have joined DZone.

PiDome: Raspberry Pi Home Automation with NetBeans IDE

DZone 's Guide to

PiDome: Raspberry Pi Home Automation with NetBeans IDE

· IoT Zone ·
Free Resource

PiDome is a platform for home automation based on the Raspberry Pi, consisting of a server and a client.

With PiDome, the intention is to create a platform into which users can plug existing or self designed components, attach these to the server, which is the Raspberry Pi, and control them via a web interface or a custom client.

Here's an example of the server, i.e., Raspberry Pi, in action, with more hardware photos here.

The platform is currently in very early alpha stage and features are still being added.

In this interview, we meet one of PiDome's founders and its lead developer, John Sirach.
Hi John, what's PiDome's history?
PiDome first started as a simple nameless in-house project, as a collection of PHP scripts running on a Raspberry Pi. After a few months, we started to face maintenance and control issues because at least seven daemonized scripts where running simultaneously.

We decided to throw everything out and start over in Java, after we learned about ARM support. After two months, we decided that we shouldn't be the only ones enjoying it, and so PiDome was born.
And what are its unique features?
What we are doing is combining different open source frameworks and libraries into a single coherent solution. Devices controlled via USB and i2c are controlled in exactly the same way, while the server simply acts as a translator.  
We are now building further on this idea, which we think makes PiDome quite unique because we take care of all the libraries (such as JNI and JNA) and all the connection methods, while automating these as much as possible. The basic idea that we have is to take all those exceptionally good open source projects and put them in one place.
For example, we use the USB vendor and product ID to identify devices and load the PiDome Java drivers for them. If an Arduino is connected, we take care of all the settings, so that the user only has to choose the baudrate via the web interface.  

What we think is also quite unique is our approach to utilizing the i2c ports on the Raspberry Pi. With the use of a visual XML editor, a user can attach an i2c device and, using the editor, can create the controls which are then rendered on the web page and in the client. 

Where does NetBeans IDE fit in?
I have always done my programming in Eclipse which, don't get me wrong, is a good editor, but always felt a little bit sluggish.

The PHP scripts we created were written in Eclipse. But our decision to move over to Java got me thinking. Java is not a language I used a lot and there was going to be a learning curve. So I started to look around for an IDE which could help me to get to know the language better.

After trying a couple of editors, NetBeans IDE just, in my opinion, stood out with its default features and ease of use. Now, 8 months later, I don't want to use anything else! 

What are the tools you use in and around NetBeans IDE?

NetBeans IDE is our primary Editor and Profiler. It is connected to a Mercurial DCVS and a Jenkins build instance.

As of this moment, NetBeans IDE stands in the center of our project. We receive Jenkins build statuses and do all our CVS actions in the IDE.  

We also use other languages next to Java. For example, the web interface is XHTML with CSS and JavaScript and some of the pages rely on XSL transformations from XML for creating device controls.

When our project reaches the latest Alpha stages, we will be refactoring the web interface to an HTML 5 project. 

The client is written in JavaFX, using JDK 8, again in NetBeans IDE, which is really great too in that context of course, and enables us to develop the client also for running on the Raspberry Pi.

The client can be used in two modes and with two different performance settings. When the client is started, the user can set performance levels and set the client to be used in full screen mode in an operating system like manner, as shown above, or as a desktop client which is less obstructive, as shown below.

Both modes share exactly the same features. The server does all its communication via JSON to communicate with the client, which is published on the website so others can design their own client. As far as possible, we're developing the client in sync with the server, which is also convenient to do in the same development environment, i.e., NetBeans IDE.

Having all these technologies supported in a single IDE is great.
Also, when our project starts to mature, we will be planning to create a plugin for NetBeans IDE which will make it easier to create and test devices to work with the server, which of course will also be used by us to quickly create new devices, drivers and peripherals to be supported by the server.
Can you describe some of your favorite features in NetBeans IDE?
I have several favorite features and it is not easy to get a top 5 out of them! I will sum up a couple which have been very helpfull for me.

  • Lambda Tools. With the coming of NetBeans IDE 7.4, I really like the early JDK 8 support. Especially, when I started to migrate the client from JDK 7 to JDK 8 and started to change inner listeners to lambda's. This works surprisingly well.

  • Profiler. The profiler is also on the top of my list. The browser in the profiler is a very handy tool where you can jump to the code you are checking. And because i am quite new to java it helped me a lot to find resource leaks, locks and performance bottlenecks and narrow down memory usages. After all, this project is aimed for a memory limited device.

  • Versioning Tools. We decided to use Bitbucket as our repository service and I really like the NetBeans intgration with the Mercurial DCVS integration. You really have a lot of options and features right at your mouse button.

  • Jenkins/Hudson Tools. We have a Hudson build installation and the IDE integration with it is great. When we add new functions and a test fails, the IDE shows a message, and by opening this message you will see the failed test and you can just jump to the code which caused the error. It really speeds up things.

  • Everything Else. The last of the favorite NetBeans IDE features is more of a compilation of features in the IDE itself. Count in the language support, code completion, documentation links, connections to other projects, such as when another project is not yet compiled but you can already write new code referenced to the newly written code in the other project.
There are a lot of features not mentioned above, but I think users have to find them out for themselves!

Finally, do you have a Tweetable message you'd like to share with the world?

"PiDome: not just another home automation project created with just another IDE!"

Thanks John, and all the best with PiDome!


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}