Having received all the remaining stuff this week (the EOP350 programmer, a second RaspBerry Pi and the TBS1052B-EDU scope) I started installing RaspBerry Pi and OpenHAB.

RasPi installation

Since I work completely headless with my RaspBerry, I needed a Linux version that doesn't need a monitor for initial setup (I could have bought a HDMI-to-DVI adapter cable, but I don't need it in the end). First I did look at the Rasbian server edition, that should have been what I needed. It a<lso comes in a version that only needs a single 1Gb memory card, which would have been nice. But after installation it the RaspBarrey didn't aquire a network address, so I was blocked.

Next I took a larger µSD card (the recommended 8Gb) and installed Raspbian itself on it. This proved to be much more successful. Next steps are for easing the remote access:

  • create a user for openhab itself (and make it member of the 'dialout' group for serial port access)
  • create a SSH keypair (I'm using putty as SSH client)and place the public key into ~/.ssh/authorized_keys2 (don't forget to set the permissions for user-access only, otherwise the SSH server won't accept the file)

openHAB installation

For the openHAB installation there are already several great instructions here in the blog, most helpful for me where the ones from fvan. I installed openHAB designer on my Linux desktop, for now I'm not using it. But I collected some additional notes while doing the installation:

  • since I used the 'systeminfo' binding, I needed to  install the native libraries for Hyperic Sigar. For that, follow the instructions in the openHAB forum
  • I created a service script for openHAB, following the instructions in the openHAB wiki. Don't forget to run the 'update-rc.g openhab defaults' at the end to have it run automatically at boot time
  • to run openHAB on port 80 (as a web server should) without root privileges, I installed the 'authbind' tool ('apt-get install authbind') and changed the start script:
    • use port 80 instead of 8080
    • instead of calling 'java', call 'authbind'. The actual line looks like
      start-stop-daemon --start ...... -exec authbind -- $DAEMON $DAEMON_ARGS || return 2
  • to have authbind really allow the openhab user to use port 80, execute
    • sudo touch /etc/authbind/byport/80
    • sudo chmod 500 /etc/authbind/byport/80
    • sudo chown openhab:openhab /etc/authbind/byport/80
    • sudo touch /etc/authbind/byport/443
    • sudo chmod 500 /etc/authbind/byport/443
    • sudo chown openhab:openhab /etc/authbind/byport/443
  • repeat if needed for other ports (e.g. SNMP)

The configuration of openHAB was OK for the first part, but the persistence configuration was tricky and took a while. I had a small syntax error in my items file (which got parsed by openHAB fine nonetheless). But openHAB refused to write any entries in the Items table, without any error or warning why this might be. In the end I switched over to a generic persistence rule, and several restarts later everything was fine.

Next steps

So I now have a fine setup of openHAB, though I'm tempted to repeat everything from scratch with the second Pi, just to check whether it might work if I stick to the script (many items from the list above were done if random order, so maybe thats why some problems occurred).

While looking at the openHAB documentation, I noticed that there is a REST API available. It also support using long polling and web sockets, so it should be perfect for getting all notifications, without constant polling. In contrast, the iOS and Android apps have a rather long delay in noticing any state changes.

The suggested client library is the Atmosphere framework, for which an Android version is available. So it should not be too complicated.

So for the next week, I will start working on a small prototype involving the REST API. This will a command line application only, so I can concentrate on the actual functionality.

If time permits, I will start writing a review for the scope, which could go in the test and measurements section. Oh, and I need to work on the list of stuff to order from Farnell


Don't forget the windows 01 - an introduction