[QPKG] openHAB - The open Home Automation Bus

This is the best place for community developers to publish their genius work. Your Apps enrich the QNAP Turbo NAS.
Post Reply
cwempe
Getting the hang of things
Posts: 60
Joined: Tue Apr 27, 2010 9:37 pm

[QPKG] openHAB - The open Home Automation Bus

Post by cwempe »

I created my first QPKG for the home automation solution openHAB.

Website: http://www.openhab.org/
What is openHAB?
openHAB is a software for integrating different home automation systems and technologies into one single solution that allows over-arching automation rules and that offers uniform user interfaces.

This means openHAB
  • is designed to be absolutely vendor-neutral as well as hardware/protocol-agnostic
  • can run on any device that is capable of running a JVM (Linux, Mac, Windows)
  • lets you integrate an abundance of different home automation technologies into one
  • has a powerful rule engine to fulfill all your automation needs
  • comes with different web-based UIs as well as native UIs for iOS and Android
  • is fully open source
  • is maintained by a passionate and growing community
  • is easily extensible to integrate with new systems and devices
  • provides APIs for being integrated in other systems

Download (v1.7.1 and older):
https://drive.google.com/folderview?id= ... aring#list



openHAB on Google Groups:
https://groups.google.com/d/msg/openhab ... N1kHT6POsJ


Any kind of feedback is welcome. :)

btw: I still don't know how to provide additional information (like description and screenshot) in the App Center.
http://forum.qnap.com/viewtopic.php?f=128&t=95233
Last edited by cwempe on Mon Oct 12, 2015 2:23 am, edited 5 times in total.
teilmeier
New here
Posts: 5
Joined: Thu Apr 04, 2013 3:35 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by teilmeier »

Hi Christoph,

thanks for your work until now. I've been struggling around with a startup routine for openHAB since days.

To provide you further help it would be nice if you could change the following line in your qpkg.cfg file:

Code: Select all

QPKG_REQUIRE="JRE | JRE_ARM"
This will enable me to install the package on my ARM-based QNAP.

To add additional information like description, screenshot, forum and download link you have to add the plugin information to the following files:

Code: Select all

/mnt/HDA_ROOT/.config/rssdoc/qpkgcenter_ger.xml
/mnt/HDA_ROOT/.config/rssdoc/qpkgcenter_eng.xml


(Depending on your HDDs and QNAP model you have to replace "HDA_ROOT" with your active HDD mount point for example "MD0_DATA")

As far as I know there is no automatic step in the routine to maintain this information because the file is provided by QNAP containing only plugins which are available in the App Center.
Last edited by teilmeier on Tue Jul 22, 2014 3:18 pm, edited 1 time in total.
teilmeier
New here
Posts: 5
Joined: Thu Apr 04, 2013 3:35 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by teilmeier »

To support file system structures of other QNAP models I modified the variables section of your openHAB.sh file as follows:

Code: Select all

# Variables
CONF=/etc/config/qpkg.conf
QPKG_NAME="openHAB"
BASE=
publicdir=`/sbin/getcfg Public path -f /etc/config/smb.conf`
if [ ! -z $publicdir ] && [ -d $publicdir ];then
	publicdirp1=`/bin/echo $publicdir | /bin/cut -d "/" -f 2`
	publicdirp2=`/bin/echo $publicdir | /bin/cut -d "/" -f 3`
	publicdirp3=`/bin/echo $publicdir | /bin/cut -d "/" -f 4`
	if [ ! -z $publicdirp1 ] && [ ! -z $publicdirp2 ] && [ ! -z $publicdirp3 ]; then
		[ -d "/${publicdirp1}/${publicdirp2}/Public" ] && BASE="/${publicdirp1}/${publicdirp2}"
	fi
fi
QPKG_PATH="$BASE/.qpkg"
HOME_PATH="$QPKG_PATH/$QPKG_NAME"
PID_PATH="/var/run"
PID_FILE="$PID_PATH/$QPKG_NAME.pid"

if [ -f "$QPKG_PATH/JRE_ARM/jre/bin/java" ];
then
  JAVA_BIN="$QPKG_PATH/JRE_ARM/jre/bin/java"
elif [ -f "$QPKG_PATH/JRE/jre/bin/java" ]; 
then
  JAVA_BIN="$QPKG_PATH/JRE/jre/bin/java"
else
  echo "Java executable not found."
fi

ECLIPSE_HOME="$HOME_PATH/server"
The first modification finds the .qpkg folder by determinating where the public folder is. The second change I made is on the path to the java executable (not sure if the full path is required or simply "java ... -jar" is enough). The last change is on the relative paths. I modified them to absolute ones.

Does openHAB automatically start when your QNAP is starting? On my QNAP it doesn't. I always have to run the openHAB.sh script via shell. Maybe it's because I only added a dummy QPKG package which points to the startup script.

It would be nice if you could integrate my modifications into your package. As far as I can see this should make the package ARM-compatible.
cwempe
Getting the hang of things
Posts: 60
Joined: Tue Apr 27, 2010 9:37 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by cwempe »

Thanks for your feedback and suggestions.
In my opinion it is to complicated to edit the qpkgcenter_eng.xml.
It is not worth it, I think.

Regarding the JRE path: I tried that.
Unfortunately the JRE path is not listed in the environment variable $PATH if the App Center runs the deamon.
It works however if you manually execute the start script.
This kept me clueless for a couple of days, actually. ;)

I updated the package with your code and uploaded it again.


Download: https://drive.google.com/file/d/0B88Qoo ... sp=sharing
Changelog of build from 2014/07/22 22:13
  • [new] more command line parameters
    mow available: start|startdebug|forcestart|forcestartdebug|restart|restartdebug|stop|status
    *debug starts the debug mode of openHAB
    force* starts the deamon even the qpkg is diabled in the App Center
  • [new] service ports (http, htpps, telnet, debug) can be configured in ../configurations/openhab.ports
    so customized ports wont be overwritten when the start script gets updated
  • [new] support for ARM devices
    by adding "JRE_ARM" as optional requirement and looking for the actual JRE path (thanks to teilmeier)
Not tested on ARM device, yet!

EDIT: Yes, openHAB starts after a reboot.
cwempe
Getting the hang of things
Posts: 60
Joined: Tue Apr 27, 2010 9:37 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by cwempe »

I just realized there is another issue.

OpenHAB shows a wrong timezone.

All my logs and persitened data are -2 hours off.
In germany we have UTC+2.

Executing "date" in CLI and the QNAP web interface show the right time.
cwempe
Getting the hang of things
Posts: 60
Joined: Tue Apr 27, 2010 9:37 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by cwempe »

Found the problem and fixed it.
source: http://forum.qnap.com/viewtopic.php?f=2 ... 65#p233325
CHangelog for build from 2014/07/22 23:31
  • [fix]did not use correct time zone
Download updated.
teilmeier
New here
Posts: 5
Joined: Thu Apr 04, 2013 3:35 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by teilmeier »

Thanks for the update. The package runs fine on my ARM-based QNAP.
cwempe
Getting the hang of things
Posts: 60
Joined: Tue Apr 27, 2010 9:37 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by cwempe »

Updated to v1.5.1.
Download in first post.
pcoenen
First post
Posts: 1
Joined: Thu Sep 25, 2014 5:29 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by pcoenen »

Hi Christoph,

Looks like you did a nice job and I can't wait to try it out. Unfortunately I can't seem to access the file:

"Sorry, you can't view or download this file at this time.

Too many users have viewed or downloaded this file recently. Please try accessing the file again later. If the file you are trying to access is particularly large or is shared with many people, it may take up to 24 hours to be able to view or download the file. If you still can't access a file after 24 hours, contact your domain administrator."

Any hope for me you could make the file available somewhere else, or email it to me directly?

Thanks!
cwempe
Getting the hang of things
Posts: 60
Joined: Tue Apr 27, 2010 9:37 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by cwempe »

I wonder what the limit of Google Drive is.

But I added a mirror in the first post.
gruijter
Starting out
Posts: 10
Joined: Wed May 25, 2011 4:16 am

Re: [QPKG] openHAB - The open Home Automation Bus

Post by gruijter »

On my Qnap TS119plus I have installed JRE_ARM (v8.0.1), and openHAB v1.5.1 using your qpkg. When clicking on the "open" button in the QNAP app center a new tab opens in my browser: http://[ip-address]:8082/openhab.app?sitemap=demo

I however get an error as pasted below. I do not know how to proceed from here. Can you please help?

Thanks!

******************************

HTTP ERROR 500

Problem accessing /openhab.app. Reason:

Sitemap 'demo' could not be found

Caused by:

org.openhab.ui.webapp.render.RenderException: Sitemap 'demo' could not be found
at org.openhab.ui.webapp.internal.servlet.WebAppServlet.service(WebAppServlet.java:114)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:350)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
at java.lang.Thread.run(Thread.java:744)

Powered by Jetty://
cwempe
Getting the hang of things
Posts: 60
Joined: Tue Apr 27, 2010 9:37 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by cwempe »

It is ok.
There is no sitemap available in the pakage.

You need to manually install the demo pakage from openhab or brows to an existing sitemap (see the url) you already configured.

Since I cannot know what sitemaps the users will have I used the demo one.
It is the most likely working URL. Even the demo pakage is not provided here.
gruijter
Starting out
Posts: 10
Joined: Wed May 25, 2011 4:16 am

Re: [QPKG] openHAB - The open Home Automation Bus

Post by gruijter »

Thanks for the quick reply. Sorry for being a complete noob, but how do I install the demo package on the Qnap?

:)
cwempe
Getting the hang of things
Posts: 60
Joined: Tue Apr 27, 2010 9:37 pm

Re: [QPKG] openHAB - The open Home Automation Bus

Post by cwempe »

Download the demo pakage: http://www.openhab.org/downloads.html
Unpack and copy to: /share/MD0_DATA/.qpkg/openHAB

This path may varie for different QNAPs.
gruijter
Starting out
Posts: 10
Joined: Wed May 25, 2011 4:16 am

Re: [QPKG] openHAB - The open Home Automation Bus

Post by gruijter »

Yes, I got the demo to work on my TS119P+ and can connect to it using my Android phone. It took me some time to find out how to upload to the Qnap using Putty over SSH and the CommandLineInterface. I'm still not sure if this is indeed the most efficient way of doing it, but it works!

The location of the files on my Qnap is: /share/HDA_DATA/.qpkg/openHAB

I will now try to activate the Dropbox sync, so that I do not have to use Putty and CLI anymore to further configure openHAB, but can "drag-and-drop" into my dropbox folder.

@cwempe: Thanks for your work on the qpkg, and your support. I hope you continue to work on future qpkg's for new releases of openHAB.
Post Reply

Return to “Community Apps”