mercoledì 15 ottobre 2014

Google at Home installation [#1 Howto]

The first post of a series that will guide you to install and configure your domotic environment with [email protected] (following updates)


I'm starting in the blog a new series of posts illustrating the features of [email protected] as they are being developed, and how you can start to play with it.

This time we are going to see how to install it correctly, how to handle the basic configuration needed to start and we will install the Wikipedia plugin to allow to query wikipedia with our voice (you can lookup stuff on wikipedia just saying "wikipedia house").

Plugin system

There are other plugins available as well here and there is also an Android application but it is out of scope for this article to guide you through them.

Plugins helps to scale the system even further and add new functionalities to your boards placed in different spots in your home (or whatever environment you plan to use it).

In this tutorial we are installing the master node and the client in the same machine. Basically we distinguish here 2 kind of nodes:
masters (that represent the most capable hardware machine)
agents or basics nodes. A basic node can either be an agent or a master.

The master takes the requests of agent's nodes, process them in a unique interface and send a reply back, so you will talk to the same Entity but you can ask things in parallel in different places on the house/infrastructure.

The Agents can be a PC or an embedded device and we plan to give also a display interface.

1) Prerequisites

You can check if sqlite it's already installed issuing the following command: sqlite3

Same applies to git and sox.

2) Preparation

Let's fire up our terminal, and prepare a directory that will contain all the configuration files:
mkdir ~/google_at_home cd ~/google_at_home

3) Installing App::cpanminus

Let's be sure that we have installed also App::cpanminus

a) debian

in debian we can just do:

apt-get install cpanminus

b) general install

otherwise, if your vendor doesn't ship it and you have cpan (you have it, trust me):

cpan App::cpanminus

c) script install

You can also install cpanminus by issuing that command in your terminal:

curl -L | perl - --sudo App::cpanminus

4) Installing IntelliHome libraries

Now let's install the libraries in the system (you can install it on the same user, if you intend to run google-at-home from there)

cpanm [email protected]:IntelliHome/Google-at-Home.git

5) Clone the repository

Now we need to clone the repo as well locally to grab the configuration files
git clone [email protected]:IntelliHome/Google-at-Home.git cd Google-at-Home

6) Basic configuration (optional)

By default, the database would be installed on /var/tmp/intellihome.db, to change it you just need to edit the config/database.yml. Here you can also set your language (e.g. for english language: 'en').

7) Plugin installation

Now let's procede to install the Wikipedia plugin (that allows querying with voice wikipedia) and the Relay plugin (that enables to commands remote relay attached to your RaspberryPis)
cpanm [email protected]:IntelliHome/IntelliHome-Plugin-Wikipedia.git
cpanm [email protected]:IntelliHome/IntelliHome-Plugin-Relay.git

In this article, we are just showing how to install them, since the relay plugin should be configured to work (such as registering the relays on the boards).

8) Database deploy

The database will keep record of the nodes on your network and the plugin installed on your system.

Now let's prepare the SQLite backend:

perl intellihome-deployer -b SQLite -c prepare

And deploy it:

perl intellihome-deployer -b SQLite -c install

9) Enable your plugins

Now the master node is ready, we just need to register the plugins that we intend to use:
perl intellihome-master -i Wikipedia
perl intellihome-master -i Relay
(to remove them use -r)

10) Start the software

a) Start the server

Let's start the master process now:

perl intellihome-master

This will spawn also the web interface, avaible now on http://localhost:8080. It's under development, so you can just add/delete the nodes/gpio and tagging them for further use.

b) Start the local node

Since this tutorial aim is just to work on the local machine, now you can spawn the node process

perl intellihome-node

You are now ready to go, try to speak at your microphone and say "wikipedia house" to have your answer.

If you encounter issues or bugs, please fill a bug request here

A big thank you to Vytas and dgikiller for the help and the contributions to the project.