Automating your home – it’s easy!

Ever thought about how nice it would be to be able to power on, or off, everything in your home via your cell phone, or the internet? Just imagine one click on a button on your Android or iPhone and voila; you dimmed the lights in the living room, turned on the projector, lowered the projector screen, turned on the receiver, the subwoofer and the HTPC, all at once.
Or lets say you want to turn of all the lights in your home when you go to bed with the touch of one button.

Well, its rather simple nowadays to make that happen that easily. And cheap, too.

I based my setup on the TellStick(an USB dongle) from, which is available in Sweden at Kjell&Co, Clas Ohlsson and a bunch other retail stores and webshops. I chose to try it with Kjell&co’s 50219 remote power plugs which sell for 99 sek for a set of 3. Dirt cheap IMO, and they work pretty well. The TellStick does work with a lot of other manufacturers too though.

Since I have a FreeBSD server that’s running 24/7 that’s what I plugged the TellStick to, but it should work just as well on a Linux, Windows or OSX machine.
If using FreeBSD you need to compile the software yourself, as there is nothing prepackaged. It’s pretty straight forward though.
First we’ll download telldus-core at
Then we’ll install a few packages to make it compile, and finally build the thing.

# cd ~ ; wget
# tar -zxvf telldus-core-2.1.0.tar.gz ; cd telldus-core-2.1.0
# pkg_add -r argp-standalone libconfuse libftdi cmake
# cmake .
# make
# su -c "make install"

Now, replace the content of /etc/tellstick.conf with something like this(for the kjell&co 50219 power plugs) using your favorite editor.

deviceNode = "LIBUSB"
user = "root"
group = "wheel"
device {
id = 1
name = "lamp1"
protocol = "fuhaote"
model = "codeswitch"
parameters {
code = "1000010000"

Now try it with one of the power plugs, the code part above translates to the dip switches on the plug where a 1 means on/up and a 0 off/down. So in this case you should set the first and sixth dip switch on the plug to up/on. Try plugging it in and hook up a lamp or something to it, then see if you can power it on/off via the command line. First start the telldusd daemon, and then use tdtool to control it.

# telldusd
# tdtool -n lamp1
# tdtool -f lamp1

This should make the lamp switch on, and then off again, hopefully. As I’m sure you understand, this just shows the basics. It can be extended to anything that the TellStick can control, and you can use it with more advanced self learning power plugs and dimmers etc, where you can have more than 1 code per plug(so that you can control all of the plugs individually, as well as have another code thats shared among them to control all the plugs in a specific room or such with one button/entry).

Now lets move on to installing the webgui and mobile phone integration, remotestick.
First we’ll download the zip package and unzip it.

# cd ~ ; wget
# unzip
# cd remotestick-server

Then, since this is FreeBSD we need to change some of the code in the python script.
Using your favorite editor replace:

elif platform == "linux2":


elif platform == "linux2" or platform == "freebsd8":

Now run it:

# ./ -h [ipofyourserver] -u [pickausername] -p [pickapassword]

Now connect to it with a browser and surf to http://[ipofyourserver]:8422/s/
You should see a web interface similar to this(except it would obviously at this stage only contain “lamp1”):
Remotestick Webgui

If you setup a port forward in your router to this port on the machine running remotestick-server, then you could access this from the internet and not just locally. Obviously there are many kinds of routers, so how you do that depends on what router you have. Read the manual or use google..
Anyhow, if you have an iPhone or iPod touch you could easily surf to this website and put it on your home screen, so you can access it with one click. If you have an Android device you can install the remotestick app(yes, its free!) from Android Market, just search for remotestick. It’ll look something like this:
Remotestick Android

Remember that you need to keep both telldusd and remotestick-server running on your server to be able to manage your setup via the web or your mobile device. If you dont want to start them manually each time you reboot your server, make sure you automate their startup via for example cron(such as @reboot) or a startup script.

Good luck!





This entry was posted in Automation, FreeBSD, OSX, Tellstick and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.