I’ve been using XBMC as my media center of choice for many years, I’ve also been using remote controlled on/off switches and dimmers for almost as long. The day came when it was time to combine the two. I bought a Tellstick from Telldus Technologies and though to myself “there must be a way to make XBMC and the Tellstick work together”. This wasn’t quite as easy as I’d hoped, but I’ll give you a description on how I made it work.
To start with most guides assume you have the Tellstick connected via USB to your media center. I don’t and I don’t want to! Why? For starters, it’s a media center! It shouldn’t have loads of other crap installed imho. I have my Tellstick plugged into my Mac server, this brief guide will probably work just as good if you have it connected to a Linux box aswell. For Windows I have no idea, not touching it.
Setting up the Tellstick in TelldusCenter
Install Telldus Center on your server, here you can see my setup.

Telldus Center on my Mac server
When you’re installing Telldus Center it will install a console program called “tdtool”, this is what we’ll be using to control the dimmer.
Connecting the media center PC and the Tellstick server
I’m using SSH to remote execute commands on the Mac/Tellstick server. I don’t want to enter my password every time I have to execute a command, so I’m relying on public key authentication. Follow these four steps:
- 1. user@mediacenter> ssh-keygen -t rsa
- 2. ssh user@tellstickserver mkdir -p .ssh
- 3. cat .ssh/id_rsa.pub | ssh user@tellstick ‘cat >> .ssh/authorized_keys’
- 4. ssh user@tellstickserver ‘tdtool -l’
The last command should list all the devices associated to the Tellstick.
marcus@eris:~$ ssh amalthea 'tdtool -l'
Number of devices: 9
3 Kök Vattenkokarbänk ON
8 Köksfönster ON
5 Vardagsrum Fönster ON
2 Kök Diskbänk ON
7 Hall Byrå ON
4 Vardagsrum Hörn ON
1 Kök Spots ON
9 Skrivbordslampa ON
6 Vardagsrum Soffa DIMMED:170
Now we’re able to remote control the Tellstick via SSH! Perfect. The next step is to build this into XBMC.
Getting XBMC to remote control the dimmer
I’ve found a script here that I made some small modifications to.
#!/usr/bin/python
# ljus.py
import xbmc,xbmcgui
import subprocess,os
class MyPlayer(xbmc.Player) :
def __init__ (self):
xbmc.Player.__init__(self)
def onPlayBackStarted(self):
if xbmc.Player().isPlayingVideo():
os.system("ssh amalthea 'tdtool -v 100 -d 6'")
def onPlayBackEnded(self):
if (VIDEO == 1):
os.system("ssh amalthea 'tdtool -v 170 -d 6'")
def onPlayBackStopped(self):
if (VIDEO == 1):
os.system("ssh amalthea 'tdtool -v 170 -d 6'")
def onPlayBackPaused(self):
if xbmc.Player().isPlayingVideo():
os.system("ssh amalthea 'tdtool -v 170 -d 6'")
def onPlayBackResumed(self):
if xbmc.Player().isPlayingVideo():
os.system("ssh amalthea 'tdtool -v 100 -d 6'")
player=MyPlayer()
while(1):
if xbmc.Player().isPlayingVideo():
VIDEO = 1
else:
VIDEO = 0
xbmc.sleep(3000)
The script runs the SSH commands to my Mac server to set either dim value 100 when playing something or 170 when not playing. You can modify the dim values to suite your preferences. The last step is to run this script in XBMC.
Create a file in /home/[xbmcuser]/.xbmc/userdata called autoexec.py. This file should contain the full path and file name to the script above, I saved mine as /usr/share/xbmc/scripts/ljus.py:
execfile("/usr/share/xbmc/scripts/ljus.py")
Restart XBMC.
Play a movie and hopefully your dimmer should now be dimming the light. Stop the movie the opposite should happen.