openHAB on Raspberry Pi 2

I hope I can save someone some grief getting openHAB with MiOS bindings to work on a Raspberry Pi 2. After hours of frustration trying to get it working I decided to copy my openHAB directory over to my Mac Book Pro. Hey, it worked right away! Wow this so cool! :slight_smile:

So back to the Pi. Thinking it must be the environment and suspecting Java, I did this:

root@zippy:/home/chris/OH# java -version
java version “1.6.0_34”
OpenJDK Runtime Environment (IcedTea6 1.13.6) (6b34-1.13.6-1~deb7u1+rpi1)
OpenJDK Zero VM (build 23.25-b01, mixed mode)

Doing some googling I tried a couple of commands to remove OpenJDK and install Oracle’s version. Tried this:

apt-get remove openjdk-6-jre default-jre default-jre-headless

OpenJava was still there. Then this:

apt-get purge openjdk*

Now OpenJava is gone so now install Oracle’s Java

apt-get update && sudo apt-get install oracle-java7-jdk

That did the trick, now openHAB is talking to my Vera Lite. So cool. Anyway, I hope this will help someone get it right the first time.

Also a big thanks to all that made this possible. :slight_smile:

Chris

I am not sure now because I setup my RPI several months ago but I think I had no JRE to install. I started from a raspbian install and JRE was probably already there.
I even don’t know what JRE I have. Here is the result of the command “java -version”:

java version “1.8.0”
Java™ SE Runtime Environment (build 1.8.0-b132)
Java HotSpot™ Client VM (build 25.0-b70, mixed mode)

It is the Oracle JRE ?
I believed I was running 1.7…

Did you start from raspbian ?
That is interesting because I will probably swith to a RPI2 one day.

Thanks for posting Chris, hope you enjoy your new environment!!

What version of the OS are you running on the RPi 2? Raspbian is supposed to ship with other Oracle JDK, but perhaps something has changed there.

PS: if you haven’t already, try out the MiOS Item generator in order to get an initial OH Items file. It’ll save you a bunch of work. Also, after doing that, if you get any Items that are bound to something with :serviceId: in them then let me know… I want to create appropriate aliases for all types of device/service combinations, not just the common ones…

@lolodomp,
You’re running Oracle’s JVM, since it has HotSpot etc. I imagine if you did an apt-get update/upgrade that you’d likely get moved to Java8 instead of Java7.

Given you’re pending move to RPi2, I’d hold off on doing that on your current environment 8)

Why ?
Are there known problems with RPI 2 ?

Currently, my RPI is working well for openHAB but openHAB startup is just very slow.

My comment was in relation to not changing your working RPi 1/Oracle JDK 7 environment (“Ain’t broke, so don’t fix it”)… And instead switching to RPi 2/Oracle JDK 8 when you’re ready…

I use Oracle JDK 8, and it’s fine, but the earlier revs were rough around the edges.

So this is the OS;
root@zippy:/etc# more os-release
PRETTY_NAME=“Raspbian GNU/Linux 7 (wheezy)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“7”
VERSION=“7 (wheezy)”

@guessed, I did run the items generator. Thank you for the amazing work that you have done! Without it I would have been lost.

I have a very simple site.map so that via the browser I can control things. Tomorrow I am going to tackle some rules.

Ok, I’ve ordered an RPi 2 to test this out. I’ll use the Raspbian image from:
Raspberry Pi OS – Raspberry Pi

as my reference. I’ve seen comments from the Rasbian site (https://www.raspbian.org/) that there are differences in the distro, so maybe it’s related to where it’s sourced from… I’m not sure why OpenJDK would be installed, if Oracle’s is already in the rel-notes (http://downloads.raspberrypi.org/raspbian/release_notes.txt)

Anyhow, let us know how you get on, and thanks again for posting the heads-up for others!

Thank you for this. I tried to get this working on my RPI2 2 weeks ago and gave up.
admittedly i didn’t try very hard, but it didn’t work straight way.
so i’m sure this will help. thanks for posting it.

a few questions.
i’m using the ubuntu image for rpi2, i noticed you issued apt-get
does that work on raspbian image?

also I purchased this zwave stick
Aeotec by Aeon Labs Z-Stick Z-Wave Plus Gen5 ZW090-A
anyone know if i can expect it to work with rpi2?

I installed OpenJDK, probably when I was trying HomeGenie some time ago.

My work on OpenHAB is in test mode for now. So far so good. MQTT is talking to a XBee gateway on another Pi. I have a couple of simple rules working. So much to do and not enough time. It is very promising though.

@mvader, yes apt-get works with Raspbian. Also, I think your Z-Stick will work, but Vera solves so many problems, especially with MiOS bindings from guessed, I wouldn’t bother.

[quote=“guessed, post:8, topic:187676”]Ok, I’ve ordered an RPi 2 to test this out. I’ll use the Raspbian image from:
Raspberry Pi OS – Raspberry Pi

as my reference. I’ve seen comments from the Rasbian site (https://www.raspbian.org/) that there are differences in the distro, so maybe it’s related to where it’s sourced from… I’m not sure why OpenJDK would be installed, if Oracle’s is already in the rel-notes (http://downloads.raspberrypi.org/raspbian/release_notes.txt)[/quote]

For a quick validation, I downloaded the Raspbian img (from Raspberry Pi OS – Raspberry Pi), imaged it to a new SD Card and booted in into an older RaspberryPi Model B.

It looks like it comes with an Oracle version of Java already:

java version "1.8.0" Java (TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot (TM) Client VM (build 25.0-b70, mixed mode)

so I think the trick is to get the Raspbian img file directly from the RaspberyPi.org site, as it sounds like the other images may not have this component pre-installed.

As a side-note, I’d forgotten how slow the 700Mhz single-core RaspPi B’s are :wink:

[quote=“mvader, post:9, topic:187676”]also I purchased this zwave stick
Aeotec by Aeon Labs Z-Stick Z-Wave Plus Gen5 ZW090-A
anyone know if i can expect it to work with rpi2?[/quote]

Just curious if you got the Z-Stick to work. I received one today and not having any luck.

[quote=“ChrisK, post:12, topic:187676”][quote=“mvader, post:9, topic:187676”]also I purchased this zwave stick
Aeotec by Aeon Labs Z-Stick Z-Wave Plus Gen5 ZW090-A
anyone know if i can expect it to work with rpi2?[/quote]

Just curious if you got the Z-Stick to work. I received one today and not having any luck.[/quote]

i have not gone back and tried (other projects) but i have read that it does. so i’m going to give it a go again here in the near future.
i’m working on mysensors and openluup projects at the moment. but plan to give openhab another try

I’ve had it now with my Vera 3. So I’m looking to jump into OpenHAB set up on a Pi. Can someone point me to what hardware exactly I need to do this? Raspberry comes in many flavors (Pi2 B, PI2 B+, etc). So what do I need and what SD card is best? How about the power USB cord?

I’m travelling to the US in a few weeks and need a list to pick up.

Thanks for your help…

You’ll want to keep the vera3 to use as your zwave device; it’s a great zwave only machine. Openhab will be a great logic controller for it and the two combined make a perfect combo.

[ul][li]Definitely get a Raspberry PI 2. It’s the most powerful available right now: Buy a Raspberry Pi 2 Model B – Raspberry Pi.
[/li]
[li]For microsd, get one of the good 90MB/s cards that are available these days such as this one: Amazon.com
[li]For power, any stable USB power supply with decent quality cable should be fine.[/li]
[li]Don’t forget a case[/li][/ul]

Raspberry Pis are still considered a fairly niche thing. You won’t find them in most retail stores in the US unless they’re very well-stocked, but it’s possible they’re available in person depending on where you are. Most people here would purchase them online.

Thank you for the info silencery.

I just ran accross an Odroid XU4 and was looking at it’s specs. Would you think this is a step up from the PI? How do you think it would work?

Oh yes, definitely a step up. Guessed and I are both on odroid. I can’t speak for him, but I love mine. I’m running openhab, mysql, and a few other services on it, and it’s rock solid.

I ran a real world comparison between RP2 and the XU4 by putting both into production in our house for 2 weeks each. The XU4 seemed to be slighly faster in processing rules. It was a small difference; maybe too minute for most people, but noticeable to me, especially when triggering latency sensitive tasks such as operating lights via motion sensors. The extra speed and overhead made me decide to go with the XU4.

If you do wind up going with odroid, going with the excellent emmc storage option is highly advised.

I either bought my Pi 2 from Adafruit or Sparkfun. In any case, the power supply is critical. Make sure you get one from a reputable supplier and that it meets or exceeds the specs for the Pi 2.

I have a Odroid C1+, with 32G eMMC. It’s liquid-fast for this type of device, and there’s a ton of headroom. I bought another C1+ as a spare recently, and considered the XU4, but didn’t like the idea of a Fan - all my gear is located in my Structured Wiring closet and airflow isn’t great.

I have it running the following services, and you’d never know:

[ul][li]openHAB (http://openhab.org)[/li]
[li]mosquitto/MQTT (http://mosquitto.org)[/li]
[li]emonCMS (http://emoncms.org)[/li][/ul]

The cores are fast, but the real differences from a RPi are the eMMC module, the on-board RTC and Gigabit Ethernet (not shared with USB). The main gain for the XU4 is the memory increase, the extra cores and USB 3.0, but at US$75ea I opted instead to have a spare C1 on hand instead :wink:

I have RPi’s as well, but they’re for my Log Archiver (RPi B+) and my Brultech/btmon energy collector (RPi B), where IOPS aren’t as important.

I also have a RPi 2 B, but have never put it into service. I recently backed this project to see how much better I can make it, without having to use an external device:

https://www.kickstarter.com/projects/1815752970/multi-function-ssd-shield-for-the-raspberry-pi-2

No affiliation, etc, other than as a backer. Worse case, I’ll move emonCMS components (mysql, php, apache) to it, and put it next to the Brultech GEM in the garage. I have a 128G SSD itching for it to arrive :wink:

For the most part, I get my RPi gear from MCM Electronics (http://www.mcmelectronics.com) but I’m also able to source locally as I’m in the Bay Area.

For the ODroids, I buy them from http://ameridroid.com/, and they typically arrive in 1-2 days.

PS: I’m waiting for the NUC6i5’s to be available (32G RAM support), and then I’ll probably cutover to virtualizing it all, along with a bunch of other boxes (Windows, etc)

WOW that’s some good information there. Thanks to you all for taking the time.

I have been fighting my Vera 3 now for over a week since it destabilized. I am totally fed up with it’s performance now and realize I am wasting too much time on it.

I don’t know squat about Openhab or Odroid for that matter, but I think it’s time to get my feet wet. I initially wanted to wait for the Vera Pro, but at this point that seems like a pipe dream and the nightmare of UI7 really puts me off.