Home automation using TellStick and Linux

I got a Tellstick for Christmas together with some Nexa remote controllers for the lighting at home.

I knew that this type of project needed to be started immediately or else it would just loose it self in a drawer somewhere. So I added some tasks to Track and Shuffle and got to it.

I wanted to stick installed in my Linux server that sits in my closet and acts as my home’s central information system. So I was natural to install it there.

Tellstick has more software available for Mac and Windows, but they do have software for Linux as well.

Install the tell stick software on the Linux machine according to the following guide: http://developer.telldus.se/wiki/TellStickInstallationUbuntu

Configuration of devices can be found here: http://developer.telldus.se/wiki/TellStick_conf

Software page seems promising: http://developer.telldus.se/wiki/Software

The install for Linux is just a C library, so I’ll have to set up some services to use the stick, but first. How to set up a device?

Apparently all you have to do is edit the configuration in /etc/tellstick.conf. This is how I did it.

deviceNode = "/dev/tellstick"

device {
	id = 1
    name = "Spotligh bokhylla"
	protocol = "arctech"
    model = "selflearning-switch"
    parameters {
    	house = "1" unit = "1"

device {
	id = 2
    name = "Taklampor bokhylla"
    protocol = "arctech"
    model = "selflearning-switch"
    parameters {
    	house = "1"
        unit = "2"

I spent a long time to figure out how to find out which house code to use. It turned out that all you do is select on and teach it to the Nexa receiver.

Now for the services?

I want to have it as a webpage, and some way I’m used to programming against. a Rest service comes to mind since I enjoy that model. So I need to create a wrapper for the C library. So what to use: Python? NodeJS?

Bingo, Apparently there is a restful web service already available.



I even has a Android app for the server.

With this setup all I had to do was to write a little JavaScript page that turns the lights on or off.

So I did just that, here is the result of the first version.


It has support for dimmers, however I haven’t been able to try that out fully due to lack of well… dimmers.

I tried to get it contributed to the remotestick repro, however the author pointed out that it was better to have this as an add-on to the remotestick-server. So the end result is that you can find the GUI here: https://github.com/morkeleb/remotestick-webgui

The all you need to set it up is to download a release available under downloads, and then extract the static directory to the static directory under remotestick-server.

Now I wanted the webpage to be accessible through port 80 without interrupting any of the services already running on my box, luckily this holiday I configured my Linux box to run with NGINX to front all the different services available through HTTP on my box.

Configuring NGINX to run proxy remotestick and handle my JavaScript page

location /remotestick/
	proxy_pass http://localhost:8422/;
    proxy_redirect off;
	proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

There is a problem with hosting it under NGINX since it changes the url and the Android app for Remotestick currently only works with IP-addresses, however I haven’t tried the latest version which was released just a few days ago. It should be able to handle more general addresses to the server.

I hope to add a simple guide for adding new devices trough the web interface, since it would greatly improve the setup experience of adding receivers to my home.

Currently the greatest problem with the TellStick is that it’s not quite easy to install and setup, however I hear that TellStick is working on a service called TellStick Live! that is in beta for Windows and Mac users.

We’ll see how this evolves !