R-Pi Tellstick core

This document shows how to setup the Telldus core software for controlling remote switches using a Tellstick USB device on a Raspberry PI.

The distribution used is Raspbian &quot;Wheezy&quot; 3.1.9+.

Information sources
The information in this document is compiled from these sources, with some testing & googling for myself.

Installation: http://developer.telldus.com/wiki/TellStickInstallationSource

Confuration: http://developer.telldus.com/wiki/TellStick_conf

Download software
Download the source code for Tellstick software.

wget http://download.telldus.se/TellStick/Software/telldus-core/telldus-core-2.1.1.tar.gz

Install prerequisites
Install the required software to build the source code.

sudo apt-get install libftdi1 libftdi-dev libconfuse0 libconfuse-dev cmake

Unpack source code
Unpack the downloaded source into the /usr/src folder.

cd /usr/src sudo tar xzf ~/download/telldus-core-2.1.1.tar.gz

Build the software
Enter the newly extracted directory and execute the build commands from there.

cd telldus-core-2.1.1

Configure
Configure the source code for the hardware.

sudo cmake. Example output:

-- The C compiler identification is GNU 4.6.3 -- The CXX compiler identification is GNU 4.6.3 -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found. -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Found PkgConfig: /usr/bin/pkg-config (found version &quot;0.26&quot;) -- checking for one of the modules 'libftdi' -- Configuring done -- Generating done -- Build files have been written to: /usr/src/telldus-core-2.1.1

Compile
Compile the source code.

sudo make Example output:

Scanning dependencies of target TelldusCommon [ 2%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Event.cpp.o [  4%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Message.cpp.o [  6%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Mutex.cpp.o [  8%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Strings.cpp.o /usr/src/telldus-core-2.1.1/common/Strings.cpp:222:13: note: the mangling of 'va_list' has changed in GCC 4.4 [ 10%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Thread.cpp.o [ 12%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Event_unix.cpp.o [ 14%] Building CXX object common/CMakeFiles/TelldusCommon.dir/EventHandler_unix.cpp.o [ 16%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Socket_unix.cpp.o Linking CXX static library libTelldusCommon.a [ 16%] Built target TelldusCommon Scanning dependencies of target telldusd [ 18%] Building CXX object service/CMakeFiles/telldusd.dir/ClientCommunicationHandler.cpp.o [ 20%] Building CXX object service/CMakeFiles/telldusd.dir/Controller.cpp.o [ 22%] Building CXX object service/CMakeFiles/telldusd.dir/ControllerManager.cpp.o [ 24%] Building CXX object service/CMakeFiles/telldusd.dir/ControllerMessage.cpp.o [ 26%] Building CXX object service/CMakeFiles/telldusd.dir/Device.cpp.o [ 28%] Building CXX object service/CMakeFiles/telldusd.dir/DeviceManager.cpp.o [ 30%] Building CXX object service/CMakeFiles/telldusd.dir/Log.cpp.o /usr/src/telldus-core-2.1.1/service/Log.cpp: In member function 'void Log::message(Log::LogLevel, const char*, va_list) const': /usr/src/telldus-core-2.1.1/service/Log.cpp:125:6: note: the mangling of 'va_list' has changed in GCC 4.4 [ 32%] Building CXX object service/CMakeFiles/telldusd.dir/Sensor.cpp.o [ 34%] Building CXX object service/CMakeFiles/telldusd.dir/Settings.cpp.o [ 36%] Building CXX object service/CMakeFiles/telldusd.dir/TelldusMain.cpp.o [ 38%] Building CXX object service/CMakeFiles/telldusd.dir/TellStick.cpp.o [ 40%] Building CXX object service/CMakeFiles/telldusd.dir/Timer.cpp.o [ 42%] Building CXX object service/CMakeFiles/telldusd.dir/EventUpdateManager.cpp.o [ 44%] Building CXX object service/CMakeFiles/telldusd.dir/ConnectionListener_unix.cpp.o [ 46%] Building CXX object service/CMakeFiles/telldusd.dir/main_unix.cpp.o [ 48%] Building CXX object service/CMakeFiles/telldusd.dir/SettingsConfuse.cpp.o [ 50%] Building CXX object service/CMakeFiles/telldusd.dir/TellStick_libftdi.cpp.o [ 52%] Building CXX object service/CMakeFiles/telldusd.dir/Protocol.cpp.o [ 54%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolBrateck.cpp.o [ 56%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolComen.cpp.o [ 58%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolEverflourish.cpp.o [ 60%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolFineoffset.cpp.o [ 62%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolFuhaote.cpp.o [ 64%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolGroup.cpp.o [ 66%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolHasta.cpp.o [ 68%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolIkea.cpp.o [ 70%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolMandolyn.cpp.o [ 72%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolNexa.cpp.o [ 74%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolOregon.cpp.o [ 76%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolRisingSun.cpp.o [ 78%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolSartano.cpp.o [ 80%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolScene.cpp.o [ 82%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolSilvanChip.cpp.o [ 84%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolUpm.cpp.o [ 86%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolWaveman.cpp.o [ 88%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolX10.cpp.o [ 90%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolYidong.cpp.o Linking CXX executable telldusd [ 90%] Built target telldusd Scanning dependencies of target telldus-core [ 92%] Building CXX object client/CMakeFiles/telldus-core.dir/CallbackDispatcher.cpp.o [ 94%] Building CXX object client/CMakeFiles/telldus-core.dir/Client.cpp.o [ 96%] Building CXX object client/CMakeFiles/telldus-core.dir/telldus-core.cpp.o Linking CXX shared library libtelldus-core.so [ 96%] Built target telldus-core Scanning dependencies of target tdtool [ 98%] Building CXX object tdtool/CMakeFiles/tdtool.dir/main.cpp.o Linking CXX executable tdtool [ 98%] Built target tdtool Scanning dependencies of target tdadmin [100%] Building CXX object tdadmin/CMakeFiles/tdadmin.dir/main.cpp.o Linking CXX executable tdadmin [100%] Built target tdadmin

Install
Install the software (it will be installed into /usr/local).

sudo make install Example output:

[ 16%] Built target TelldusCommon [ 90%] Built target telldusd [ 96%] Built target telldus-core [ 98%] Built target tdtool [100%] Built target tdadmin Install the project... -- Install configuration: &quot;&quot; -- Installing: /usr/local/sbin/telldusd -- Installing: /etc/tellstick.conf -- Installing: /var/state/telldus-core.conf -- Installing: /usr/local/lib/libtelldus-core.so.2.1.1 -- Installing: /usr/local/lib/libtelldus-core.so.2 -- Installing: /usr/local/lib/libtelldus-core.so -- Installing: /usr/local/include/telldus-core.h -- Installing: /usr/local/bin/tdtool -- Removed runtime path from &quot;/usr/local/bin/tdtool&quot; -- Installing: /usr/local/sbin/tdadmin -- Removed runtime path from &quot;/usr/local/sbin/tdadmin&quot; -- Installing: /etc/udev/rules.d/05-tellstick.rules -- Installing: /usr/local/share/telldus-core/helpers/udev.sh After installation, update the system's library cache.

sudo ldconfig

Install service
Before the switches can be used, the telldusd service daemon must be running (and the Tellstick must be connected to your Raspberry PI).

Create an init-script for the service by copying and modifying the /etc/init.d/skeleton file.

cd /etc/init.d sudo cp skeleton telldusd Open the newly created file in your favorite editor (as root with sudo) and do these changes:

Line 3, change:

into:
 * 1) Provides:          skeleton

Line 8-10, change:
 * 1) Provides:          telldusd

into:
 * 1) Short-Description: Example initscript
 * 2) Description:       This file should be used to construct scripts to be
 * 3)                    placed in /etc/init.d.

Line 20-24, change:
 * 1) Short-Description: Tellstick service daemon
 * 2) Description:       Tellstick service daemon controlling remote switches.

PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC=&quot;Description of the service&quot; NAME=daemonexecutablename DAEMON=/usr/sbin/$NAME DAEMON_ARGS=&quot;--options args&quot; into:

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin DESC=&quot;Tellsick service daemon&quot; NAME=telldusd DAEMON=/usr/local/sbin/$NAME DAEMON_ARGS=&quot;&quot; Make the script executable.

sudo chmod +x telldusd Test the init-script by starting the service and checking its status.

sudo service telldusd start sudo service telldusd status Install the script to start at boot.

sudo update-rc.d telldusd defaults

Configure receivers
The software is configured with the /etc/tellstick.conf file. Since there are many types of receivers supported by Tellstick this document will not cover configuration options. For more information on configuration, please see http://developer.telldus.com/wiki/TellStick_conf.

Here is an example configuration using one Waveman receiver. The house and unit parameters is where you setup different switches.

user = &quot;nobody&quot; group = &quot;plugdev&quot; ignoreControllerConfirmation = &quot;false&quot; device { id = 1 name = &quot;Livingroom lights&quot; protocol = &quot;waveman&quot; model = &quot;codeswitch&quot; parameters { house = &quot;A&quot; unit = &quot;1&quot; } }

Each time you change the configuration, you also need to restart the service daemon.

sudo service telldusd restart

Test
To turn on a switch (the number is the device id for the switch in the configuration file).

tdtool --on 1 To turn off a switch.

tdtool --off 1

Done!
You have now the core software for controlling remote receivers using a Tellstick installed. Now you can go ahead and do more amazing things!

For example:


 * install a web server and create a web page where you can control switches
 * schedule switching on and off lights using cron
 * and much more...

=References=