Introduction: HABmin on Raspberry Pi, (An OpenHAB Admin Console)

HABmin is a nifty little (point and click, drag and drop) interface for performing openHAB administrative tasks. In order to work it requires version 1.4 or above of openHAB. HABmin is constantly being updated and new features have been added frequently It supports multiple languages and currently at the time of this writing it can do the following:



• General configuration (openHAB.cfg)
• Configure bindings
• Configure items
• Configure mapping
• Configure sitemaps
• Configure ZWave network
• Configure rules and notifications
• Query and graph data from persistence stores
• View OSGi binding status
• View log files


As stated on the wiki, "HABmin is an open source project. It makes use of a number of libraries under GPL license. Business users can take a piece of open source software and tweak it to suit their needs. Since the code is open, it's simply a matter of modifying it to add the functionality they want. Don't try that with proprietary software!"


Step 1: Issues

There are two methods for installing HABmin on your Pi. I followed both installation methods in order to understand each process. The recommended process (Step 3) was extremely fast but yielded some issues. The alternative method (Step 4) was a bit more taxing but worked like a charm.

The issue I had with the recommended install was that my status did not want to change from offline to online.The alternative method simply took a few seconds longer to load after accessing the interface home page.

Take your pick and feel free to ask any questions. If you need to remove openhab you can follow the next instructions, otherwise proceed to the next step

****READ THE FOLLOWING ONLY IF YOU ARE REMOVING HABMIN****

You can easily remove any files in order to try a different install approach. You can erase the entire habmin folder by doing the following:

rm -rf /opt/openhab/webapps/habmin

Then you will need to remove the two .jar files. Go to the "addons" folder.

cd /opt/openhab/addons

Open the folder to look for the two SNAPSHOT .jar files. Copy the name of the zwave-snapshot.jar file then remove it.

rm name_of_zwave_snapshot.jar (replace with the name of your jar file)

Scroll back up to the addons list and copy the name of the habmin-snapshot.jar file then remove it.

rm name_of_habmin_snapshot.jar (replace with the name of your jar file)

Step 2: Installation Option #1 (recommended)

In case you are interested in getting the latest release you con go here and copy the link address for the zip file.

https://github.com/cdjackson/HABmin/releases/lates...

Using this method your Pi will put the addons in the correct "addons" folder. As for the remaining files, it will create a "habmin" folder in the "`webapps" folder and dump the files there

Let begin by stopping openHAB. Assuming you followed my previews ible on how to automatically start openHAB on boot , you should have a file called openhab in your /etc/init.d directory. If not no worries, you do not ave to stop openHAB you will simply have to restart openHAB after completing this step.(find it here)


/etc/init.d/openhab stop

Go to the openHAB main directory to download the release there.

cd /opt/openhab

wget https://github.com/cdjackson/HABmin/releases/download/0.1.3-snapshot/habmin.zip

Unzip the file


unzip habmin.zip

Go ahead an restart openHAB


/etc/init.d/openhab start

Thats it. Pretty simple.


However for those of you that have problems with this install you can go the alternative route. For those instruction please proceed to the next step otherwise skip step 4.

Step 3: Installation Option #2 (alternative)

This is the process I ultimately took for installing HABmin. The other method was much faster, but for some reason my status remained offline.

First you will want to stop openHAB from running. Assuming you followed my previews ible (find it here) on how to automatically start openHAB on boot, you should have a file called openhab in your /etc/init.d directory. If not no worries, you do not ave to stop openHAB you will simply have to restart openHAB after completing this step.

/etc/init.d/openhab stop

Then go to your openHAB folder

cd /opt/openhab

Download the HABmin master zip file

wget https://github.com/cdjackson/HABmin/archive/master.zip

Unzip the file. This will create a new file called HABmin-master in your openHAB folder.

sudo unzip master.zip

Remove/erase the zip file as you will no longer need it.

rm master.zip

You will need to make a file called habmin. This file should be located inside the "webapps" folder. If you are already in the openhab folder it should look like this:

mkdir webapps/habmin

You will want to relocate the contents of the HABmin-master folder to the webapps folder. Assuing you are in the openhab folder...

mv HABmin-master/* webapps/habmin/

This will move the contents of the HABmin-master folder into the webapps/habmin folder, but it will leave the original folder (empty) in your openhab folder. You should erase it it.

rm -rf HABmin-master

Go to your "habmin" folder to be sure all the files are there.

cd webapps/habmin

Upon moving the contents of the HABmin-master folder to your webapps/habmin folder you should notice that there is an "addons" folder that was moved there as well. We should put the contents of that folder in its proper location which should be /opt/openhab/addons.

mv addons/* ../../addons/

Erase the now empty "addons" folder

rm -rf addons

You are done! Start openHAB and check out the next step for accessing the interface.

/etc/init.d/openhab start

Step 4: Accessing the Control Panel

Now you are ready to access the HABmin control panel. As long as you did not modify the server port for your openHAB and you are running it locally then you should simply be able to go to your localhost and provide the port openHAB is running on along with "/habmin/index.html" to access the control panel.

i.e. http://localhost:8080/habmin/index.html

After accessing the home page you will notice that your status is registered as "offline". If you wait a moment it should change to "online". You should see a little popup appear as in the image provided.

Have fun!

Step 5: Backing Up Your Files (optional)

The rsync utility is used to keep copies of a file on two computer systems the same for the purpose of synchronizing files and directories. We are simply going to use it for making a back up of our files located in the www, opt and root folders. This will come in handy in the event that we really mess things up while trying to configure our openHAB program.

This will make a copy every night and place them in your "mnt/sd" folder.

rsync -avzO /var/www/* /mnt/sd/backup_www
rsync -avzO /opt/* /mnt/sd/backup_opt
rsync -avzO /root/* /mnt/sd/userhome


You should be able to rest easy knowing that you hav backups of all the important folders. This applies not only to openHAB but to all the files and folders located inside of the www, opt and root folder. Now go and have some fun with openHAB and your new HABmin control panel. :)

Comments

author
jvan zuijlen made it! (author)2016-11-10

Great! Works like a charm =) (used the alternative method)

screen.png
author
scook3142 (author)2016-01-28

For people who are having issues with the stock github /etc/init.d/openhab script on a raspi I found a number of oddities but of note if you're using a "best practices" of a non-root user (generally people use 'openhab') you can actually end up with one of the less obvious directories having it's ownership set back to root if you do a manual "sudo ./startup.sh". This causes problems then when the init.d script tries to run as the non-root user. To get around fighting this a year from now when I've long forgotten the details I just added "chown $NAME:$NAME -R $ECLIPSEHOME" near the top of the init.d script after the variable statements. That way everything gets straightened out every time the service is cycled. Also, if you're using a zstick and running the service as non-root OpenHab won't have access to it. Sticking "chown $NAME:$NAME /dev/ttyUSB0" near the top of the init.d script fixes that as well. I leave it up to you to decide if that's the best practice security wise. But since my test raspi does nothing but run OpenHab I'm not too concerned about it.

Cheers!

author
PetervdPol (author)2015-11-08

Depending on your Linux setup you may have to add sudo when starting/stopping Openhab:

sudo /etc/init.d/openhab stop

and,

sudo /etc/init.d/openhab start

Obviously using "sudo" may require typing the root password :-) and using sudo without password is never a very smart idea...

author
ubergeekseven (author)2015-03-03

I have an issue with the auto start. works every time on bout up and u can use the start stop commands fine. but habmin will not connect even though openhab is running fine.
if I rename my openhab file in init.d and then reboot and run the start.sh script, openhab runs correctly still and habmin connects. I started this on pi and then built a mint setup and tried again. same results.
my user name is not openhab, but I have an openhab user and have granted permissions for every user of openhab. but I use sudo to execute start.sh and on boot the init.d file executes as root. that's the only difference I can think of.
any suggestions by chance? it's the only quirk I have with my setup so far.

author
rfmdelgado made it! (author)2014-12-07

I didn't managed to get the openhab start/stop command to work properly but it works

Dibujo.bmp
author
Arizno (author)rfmdelgado2014-12-08

You Made It, great! I see you followed my recommendation on inputting the code that will allow your Pi to load openHAB at boot. Do you think you can reboot your Pi and wait a few minutes for openHAB to load. Then you should go to your command line and try stopping it again (/etc/init.d/openhab stop). It may have been that your openHAB was not loaded all the way. I just want to be sure that you Pi will load openHAB at boot. It should look like the image below.

commandline.jpg
author
rfmdelgado (author)Arizno2014-12-10

The installation I have on my Rasp and the OpenHAB in my first experiment and it was pretty goggle and cross my fingers and I don't remember how but my OpenHAB is starting on boot secuence, nevertherless I didn't manage to get start/stop command to work I send you the image with the error I have.

Dibujo.bmp
author
rfmdelgado (author)2014-12-04

in /etc/init.d folder I don't have any openhab command, is this normal?? I'm new to rasp and opnHAB

Dibujo.bmp
author
Arizno (author)rfmdelgado2014-12-04

you do have openHAB installed correct?

author
rfmdelgado (author)Arizno2014-12-04

It's working OK for more than one month... I have an arduino sending data and is all correct, until now I didn't notice nothing unsual, this weekend problably have to re-install.

author
Arizno (author)rfmdelgado2014-12-05

I figured it out. Its my mistake, in my instructable I am assuming that you added the appropriate file to the init.d directory for automatic boot of openHAB upon start. It is step 2 of my previous instructable. You can find it here.

https://www.instructables.com/id/OpenHAB-on-Raspber...

It is the only way that I know how to stop and start openHAB. You do not have to stop openHAB if you don't want to, but you may have to do a reboot in order to restart openHAB. I will correct my ible.

About This Instructable

80,372views

58favorites

Bio: I am a life long biz owner. I've been fortunate enough to have a successful business and a fun life.
More by Arizno:HABmin on Raspberry Pi, (An openHAB Admin Console)OpenHAB on Raspberry PiPhoto Sensor Controlled Outlet (turns on or off at daylight or nightime)
Add instructable to: