TellstickDuo with Raspberry

Tellstick Duo

Tellstick Duo from here connected to the USB port of th RPi

Involved products:

  • Raspberry Pi model B
  • Telldus TellStickDuo
  • Remote switch Nexus PE3
  • Remove swich Nexa Pro WRR-1
  • Remote dimmer switch Nexa ECMR-250
  • Motion sensor Nexus LMDT-1

On my list of Raspberry projects is to use it for Home Automation. For that purpose I have purchased a TellStickDuo.

Attached via the USB port, it will allow the RPi to send commands to a range of switches in the home. These include on/off as well as dimmers from different vendors.

The supplier, Telldus, offers a free cloud-based remote control of the TellStickDuo if you leave it connected to a running Mac or PC with  TelldusCenter.

However, since I will instead use a Raspberry Pi as controlling computer I will not utilize that software, so I found this installation of core libraries for the Tellstick unit. Simply follow the step-by-step guide to download, compile and start a service on the RPi that will do the same as the Mac GUI application but via commandline.

Nexa PE3 selflearning switches

Nexa PE3 selflearning switches

Next step is to start to learn and configure recieivers such as these from Nexa. There is a learn command in the core installation: tdtool –learn {device numer}

There is as well a graphical application for Mac/PC   Telldus is good for testing out and configure/learn devices. However, that application stores the configuration in a different place on both a Mac and a PC. As if that is not enough, moving over to the Raspberry, there is yet an other format of the configuration file.

What i have found to be a reasonably process to add new devices is the following steps:

1. Attach the TelldusStick to my Mac and use the TelldusCenter to learn the switches (instructions come with the manual from each supplier). Each switch after this listen to on- or off-signals based based on a specific code.

Note down the house/control and unit code as well as the brand. I haven’t yet investigated where the Mac config file is stored.

2. Update the Raspberry config file located at: /etc/tellstick.conf (with “sudo vi /etc/tellstick.conf” or share a raspberry directory and a more userfriendly editor in your Mac/PC.

Increment the id with one for each new device you add. I think it is a good idea to maintain them in order by id:

user = "nobody"
group = "plugdev"
ignoreControllerConfirmation = "false"
device {
 id = 1
 name = "Vardagsrum - dimmeruttag"
 protocol = "arctech"
 model = "selflearning-dimmer"
 parameters {
 house = "A"
 unit = "1"
device {
 id = 2
 name = "Kök - fönsterlampor"
 protocol = "arctech"
 model = "selflearning-switch"
 parameters {
 house = "42"
 unit = "4"
device {
 id = 3
 name = "Arbetsrum - golvlampa"
 protocol = "arctech"
 model = "selflearning-switch"
 parameters {
 house = "46"
 unit = "4"

Since you have changed the config file, you need to restart the service with:

sudo service telldusd restart

That’s it! Now you can use the commandline tool tdtool like this:

$ tdtool --list
 Number of devices: 7
 2 Kök - fönsterlampor ON
 6 Oscar skrivbord OFF
 3 Arbetsrum - golvlampa ON
 4 Arbetsrum - skrivbord ON
 5 TV fond OFF
 7 Subwoofer OFF
 1 Vardagsrum - dimmeruttag OFF
$ tdtool --on 3
Turning on device 3, Arbetsrum - golvlampa - Success

Please see the Telldus developer wiki for documenation. In my case both id 2 and 3 are set to protocol “arctech” – on is a Nexa and the other an Anslut self learning switch.

One challenge is to find the solution for these situations:

  1. Lightswiches that are setup for “trappkoppling”. Not really supported by any of the switches from Nexta or others.
  2. How to handle low-effect-“lysrör” as I haven’t found any swiches that support them. Only ordinary bulp, LED or low-energy lamps are supported. Update: I have now purchased a Nexa device for this purpose. Will try it out.

Next steps:

– choose and implement a webserver: I think I’m going for nginx and php. Here is an install-guide for nginx for Rasbperry

– create a webapplication to list all devices and allow for manual on/off. I’m currently testing a first version, will be documented later.

php text pase tips – I will use this to parse output from the tdtool –list command to dynamically populate the webpage with all devices.

– implement a scheduling function by one of these alternatives:

1. Use Cron to schedule tdtool commands
2. Install NexaHome  on the RPi. I made some attempts but will not use alternative.

Here is one example where I have scheduled my kitchen lamp to turn on at 6:45 each day, each month, each weekday and then turn off att 08:00. Please note that I had to specify the full path to the tdtool command to get this to work.

crontab -e

## Köket
# Power on 7:00
45 06 * * * /usr/local/bin/tdtool --on 2 > /dev/null>&1
# Power off 8:00
00 08 * * * /usr/local/bin/tdtool --off 2 > /dev/null>&1

For alt 2, here are my findings:

– You need to install a java environment (I used openjdk-7-jdk consuming 119MB)
– It didn’t pick up my configured devices. If I copy that file to the same directory, then they come up
– It didn’t function to turn on/off devices. Reading blogs I get the feeling it may need to be installed (or be directed to) in the same directory as the tellstick core libraries
– The only real advantage this would give over a plain simple cron-job is that it supports geo-position to be able to turn on/off swiches with respect to sunrise/sunset for you location.