snap up your home

Recently I had some fun with playing with Ubuntu on the Orange Matchbox, a Raspberry PI2 in a pretty Ubuntu case, preloaded with Snappy Ubuntu Core.

… and what would be better suited for that as having a try with guh on it. If you haven’t heard about guh (gear up you home) yet, it’s basically an open source plugin-based home automation server with a sophisticated if-this-than-that framework. For more details check out the guh wiki and the guh tune website.

So far guh has been targeting Ubuntu and I felt like it’s about time to give it a try on Ubuntu Snappy. With the Orange Matchbox running the latest Ubuntu Snappy release, it was much easier than expected to get all the things up and running on it. The short story is that I used the Ubuntu SDK and a 15.04 click chroot to cross compile things. After all click and snappy seemed similar enough to me. When it failed building the click package I went to the build directory and called “snappy build” on it instead of the “click build” command that the Ubuntu SDK usually runs. Here’s the diff that was required to completely cross-build and deploy guh-core to a folder that can be packaged up: github link. On top of guh-core there’s a webserver providing a RESTful API. As it’s written in go it was similarly easy to get a cross-built armhf binary and copy that to the package directory. Python seems to be preinstalled on the snappy core, so the guh-cli tool could also just be copied into that folder and everything was in place. While much of this is quite hacky and surely not the final solution, it also shows how easy it can be to create snaps of somethings.

We’ll try to get the guh package into the snappy store. Before that we still need to figure how to deal with permissions. Given that guh can interact with different hardware but snappy apps/services are confined we might hit some obstacles. Also we want to get a multiarch package ready which seems to be really easy at this point as compiling for x86 is easier than cross-compiling and the snappy magic is mostly in place already. For now you can try the unconfined armhf based snap package for guh here. Even though this are first steps with snappy, it should be quite functional already.

After installing, the guh.guhd service should autostart and you can immediately use guh.guh-cli to configure your system. You can also have a glance at the webinterface, which will be running on port 3000, but keep in mind that it is quite limited for now. An app for Android is on the way too and will be published soon. It is written with cordova and I have already given it a try to port it to the Ubuntu phone, but I failed so far. If you have some experience with cordova, it would be great if you could try your luck on this repository.

After I’ve been bootstrapping guh on snappy, by now, Simon, the upstream guh developer has taken the lead already and went ahead to clean up things, preparing a snappy tools repository for guh. In there you should find the latest and greatest to build guh for snappy yourself.

Please join us in IRC channel #guh on freenode to give feedback and if you have questions or would like to help out with snappifying it and or porting the cordova control app to Ubuntu. If you think guh would be perfectly suited for your home, but doesn’t yet support some hardware you need, check out the plugin developer and other guh api docs.

This entry was posted in Ubuntu, Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *