Get started with heimcontrol.js on your Raspberry Pi
heimcontrol.js has two dependencies: Node.js and MongoDB. Unfortunately, neither are currently available in the Raspbian repositories.
This can be dealt with in several ways, each of which has benefits and trade-offs:
- Compiling the programs yourself is a safe, clean solution, but takes many hours on the Pi. Cross compilation alleviates this, but is beyond the scope of this guide (see rpi-cross if interested).
- Installing a third party package is extremely convenient, but it puts you at the mercy of the packager, who may be neither trustworthy nor competent. In practise, using these packages for a hobby project like this is almost certainly going to be fine; but the security risk should be noted.
- Finally, if you’re not attached to Raspbian, you could just install a distro that does supply Node and MongoDB. Archlinux fits the bill — with the obvious consequence of needing to install and configure Archlinux.
The first two options are described below.
Install build prerequisites
First, install the following packages, which are required for the compilation.
You may also want to use tmux:
Now, if your SSH connection is interrupted, you can reconnect and use
tmux attach to continue the shell session.
The next step is to compile and install Node.js on your Raspberry Pi from the official sources:
node --version — it should of course output the version.
If you are using a Raspberry Pi with 256MB RAM, then you have to edit the file
/etc/dphys-swapfile and change the value of
You can find a Raspberry Pi version of MongoDB on GitHub: Rick Pannen’s mongopi has been working well, despite having been last updated in 2012.
With the following command you can build an install it:
Now add the MongoDB binary directory to the
PATH, for example by adding the following to
Finally you have to create a MongoDB user, the MongoDB database directory, and an init script:
If the service starts successfully, you can move on to installing heimcontrol.js.
Once again the disclaimer: You should be aware that installing packages from untrusted third parties is dangerous. The sources listed below do work and appear safe at the time of this writing, but the contents could change anytime.
So if you’re using heimcontrol.js for something mission-critical, a) tell us what — because that sounds cool! — and b) compile everything yourself from official sources.
With that out of the way, the actual installation is really easy: Simply download and install node_arm by Nathaniel Johnson and mongodb-armhf-deb by Tom Janson as follows:
If the node binary is present (and returns the expected version) and the MongoDB service starts successfully, you’re all set. (If not, please file an issue.)
You only have to clone the GitHub repository and run
npm install to install homecontrol.js:
(If you have Python 3 installed, run
npm config set python python2.7 to make node-gyp play along.)
Now you can run heimcontrol.js by typing
Generation of the API description and the gh-pages.
The source code documentation is automatically generated using YUIDoc. You can find the latest documentation here: /heimcontrol.js/api/index.html
Or you can generate the documentation from the source code.This will generate the documention in the
docs directory of the project.
The gh-pages that you are currently reading can be found in the
gh-pages branch of the project. They are generated from Jade-Templates using http://jnordberg.github.com/wintersmith/. To regenerate the documentation cd in your heimcontrol.js repository and type: