2014-09-27

Give your home a REST

OpenNetHome have always had a TCP/IP interface for integration in the TCPCommandPort-Item. But it is time to add a more modern interface to my home. I have now implemented a REST-interface with json encoding to OpenNetHome which exposes HomeItems as REST-resources. Since basically everything in OpenNetHome is HomeItems (lamps, thermometers, timers, web-server and so on) this means that most of the features in the server can be reached via this interface. The URL to turn off the lamp in my bedroom window is for example:

POST http://ssgserver2:8020/rest/items/108/actions/off/invoke

and to get the temperature on the balcony i do a get on the URL:

GET http://ssgserver2:8020/rest/items/52

The "108" and "52" are the identities of the corresponding HomeItems, and you can get the identities by listing all HomeItems in the server with:

GET http://ssgserver2:8020/rest/items

This kind of interface works well with modern WEB-frameworks like ember.js and AngularJS but also for integration with phone apps and other home control systems.

The full documentation of the interface is available here on the OpenNethome-site. The implementation is as usual available in the nightly build. Note that details of the interface my still change and feedback on the interface is welcome!

2014-09-13

Raspberry Pi Installation

Since the majority of the OpenNetHome users are using raspberry pi as platform, I have made it easier to install and upgrade on that platform.
I have now added a plug&play installation script for Raspberry Pi which installs the files in the appropriate locations in the file system, configures serial drivers and installs the OpenNetHome server as a daemon that runs in the background with its own user account. All you have to do is to run this script and then you can plug in a TellstickDuo and start controlling your home!

A complete installation instruction including download of the release is:

wget http://wiki.nethome.nu/lib/exe/fetch.php/nethomeservernightly.zip
unzip nethomeservernightly.zip
cd nethomeservernightly/install/raspbian/
chmod +x *.sh
sudo ./install.sh

Included is also an automated upgrade script, which will download the current nightly build and upgrade the installation to that. This script should be copied to your home directory and run whenever you want to upgrade your installation:

sudo ./upgrade_nethome_nightly.sh

The daemon installation is built on the earlier nhs installation contributed by Peter Lagerhem, but is modified quite a bit, so if you are using that you have to uninstall it according to the instructions in the readme-file before you can do this installation.

The installation scripts are available in the nightly build