"Shipments are a little delayed" -- this is a mail I got a few days ago from e14. Okay...but waiting until my rPi arrives to start working on the project is not a good idea.
So I decided to test openHAB with my laptop itself. My laptop is running Ubuntu14.04 64bit on an i5 2.4GHz with 4GB RAM. So the performance of openHAB in my laptop cannot be compared to raspberry pi by any standards. But installing and working with openHAB in more powerful system is always good -- it gives a good understanding of all the powers we have in our hand and play around with a few blocks.
Please note that this blog is not about setting up openHAB in raspberry Pi. We all ready have a handful of good posts on the topics. In this post, I would rather explain how I installed openHAB in my laptop and the main issues I faced. For setting up raspberry Pi- openHAB system I found these two blogs most useful
1. HOW-TO: First steps with the Raspberry Pi by tekmeister : This posts neatly explains how to setup your raspberry pi in a headless way. It will be useful if you are not having an HDMI monitor.
2. IP Post 4: Obligatory Install Tutorial For RPi and OpenHAB by ipv1 : In this post, he explains how to install openHAB in your raspberry pi. He also came up with a script which can be used to automate the entire process. Great, thanks IP!!! He also mentions how you can install and setup samba share if you want to use your windows machine to develop.
Let's start with a little theory. openHAB mainly consists of three parts,
1. openHAB runtime
2. openHAB addons
3. openHAB designer
If you want to setup an openHAB server, you don't need any thing more than openHAB runtime. But it will be like installing gcc compiler without any libraries( not even stdio ). Runtime alone cannot do anything much. It is engine that can parse through all your openHAB configurations and take decisions. Nothing more!! Alone, it just sits there and blinks. Then comes the openHAB addons. These addons can be considered as libraries in C/C++. If runtime needs any input data, mostly runtime will access the data via an addon. In openHAB world, each addon is called a bundle. So if your openHAB runtime wants to talk to your enocean sensors, it can do it via enocean binding. And once runtime takes a decision based on the input, it may again require an addon to execute that decision. Suppose the decision is to turn of a light which is connected to via a relay to a GPIO pin. To switch the relay, runtime uses GPIO bundle. What now you have to do is to put the configurations files in correct places and start your openHAB. That pretty much completes your openHAB automation server -- unless you are some one who always asks for more and don't care about breaking a few things to check how they really works. Now comes the openHAB Designer. Designer can be considered as an IDE for openHAB. It is based on our beloved eclipse and has a inbuilt on-flight syntax checking mechanism which will never let you type something runtime can understand. Designer is very useful when you want modify your system. You can theoretically use any text editor with suitable encoding to modify openHAB. But what more can be attractive than an editor with syntax highlighting, realtime syntax checking, auto code completion and much more. That's what openHAB-Designer is. So that's the whole theory you want to kickstart -- we'll learn as we go.
Now back to the topic of installing openHAB in your laptop. To set up a working system you need to download the runtime and the addons and setup your on configurations. To make it more easy, openHAB developers has already created a demo configuration which can give you a very good insight about the woking of openHAB system. Download them and set them up as mentioned in Inderpreet Signh's blog( above ). All the latest downloads are available at openHAB - empowering the smart home.
First you have to setup Java in your PC. Run "java -version" in your command line and check whether you have it already. This was the output I got from my laptop
vish@u1404:~$ java -version java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
I'm using the Oracle JDK in my laptop. You may get a different output if you are using openjdk. As long as you are getting an output about the installed version, you are good to go( Ofcourse you need a recent java installation). If you are getting an error, you probably have to install java from java.com: Java + You.
Now download the openHAB runtime and unzipped it into some convenient folder ( I uses "/opt/openHAB/' ) in your laptop. Now you have to copy the "openhab_default.cfg" file under "configurations" folder and rename it to "openhab.cfg". Now my openHAB is ready to go. Make "start.sh" at the root of your openHAB installation an executable by
chmod +x start.sh
and start openHAB by
./start.sh
Hopefully everything should work.
But now we don't have anything useful. You could download and unzip openHAB-addons to "addons" directory of openHAB installation if you want. But I proceeded without that.
Now download the demo configuration they provided and unzip it over the root of openHAB installation and....woi, we have our first first openHAB site running. It may take 10secs for openHAB to update your configuration to runtime by default, but you can decrease this by editing your "openhab.cfg" file.
# Configuration folders (must exist as a subdirectory of "configurations"; the value # tells the number of seconds for the next scan of the directory for changes. A # value of -1 deactivates the scan). # A comma separated list can follow after the refresh value. This list defines a filter # for valid file extensions for the models. folder:items=10,items folder:sitemaps=10,sitemap folder:rules=10,rules folder:scripts=10,script folder:persistence=10,persist
and replacing those "10"s with the refresh rate you want in seconds.
And that's it. Finish. Lets test our demo site by going to webrowser and entering
http://localhost:8080/openhab.app?sitemap=demo
And remember to use a webkit based browser( chrome/safari ). If you use firefox, you'll be presented with a clunky UI.
These are a few screenshots from Google Chrome( Version 36.0.1985.125 )
and the same screenshots from Firefox 31.0
So it's pretty much clear -- Firefox messes up the UI.
Now download and unzip openHAB-Designer to some directory. Open the directory and start "openHAB-Designer". Now browse to "configurations" folder in your openHAB-runtime. You will get a window very similar to this.
And hurray....we have our installation working.
Problems I faced and suggested solutions
The first one I faced was when I installed openHAB-runtime and started openHAB, after a hundred lines of debug data, it stopped with this error :
05:03:23.619 [org.openhab.core.internal.logging.OSGILogListener$NLogListener@1ab6eb7a] INFO OSGi - ServiceEvent REGISTERED 05:03:23.623 [org.openhab.core.internal.logging.OSGILogListener$NLogListener@1ab6eb7a] INFO OSGi - BundleEvent STARTED 05:03:23.664 [org.openhab.core.internal.logging.OSGILogListener$NLogListener@1ab6eb7a] INFO OSGi - BundleEvent STARTED # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fd6ca5c52a1, pid=5571, tid=140563376162560 # # JRE version: Java(TM) SE Runtime Environment (8.0_11-b12) (build 1.8.0_11-b12) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.11-b03 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libsoup-2.4.so.1+0x6c2a1] soup_session_feature_detach+0x11 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /opt/openHAB/1_5/distribution-1.5.0-designer-linux64bit/hs_err_pid5571.log # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. #
Solution :
To solve this issue, try to put this line (slightly different from -Dorg...)
org.eclipse.swt.browser.DefaultType=mozilla
at the end of this file
eclipse/configuration/config.ini
The next one I faced was while trying to start openHAB designer it stopped with this message :
An error occurred while opening the configuration folder
Cannot create linked resource '/config/config'. The parent resource is not accessible.
Solution :
Deleting the whole folder "workspace" and restarting the designer worked for me.
No idea what went wrong in the first place
Source : https://groups.google.com/forum/#!msg/openhab/vQbnDFCXjLE/gVxovi8WaQQJ
But still I'm not able to use my XUL runner in openHAB-designer. It shows
No more handles [Could not detect registered XULRunner to use]
org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
With that I wind up this post. In next post, we'll look into how to develop models in openHAB.
<< Prev | Table of Contents | Next >>