Difference between revisions of "R-Pi Tellstick core"
(→Configure receivers: Added note about restarting the service daemon after changing configuration.) |
m (Fixed minor typo) |
||
(One intermediate revision by one other user not shown) | |||
Line 10: | Line 10: | ||
Installation: http://developer.telldus.com/wiki/TellStickInstallationSource<br /> | Installation: http://developer.telldus.com/wiki/TellStickInstallationSource<br /> | ||
− | + | Configuration: http://developer.telldus.com/wiki/TellStick_conf | |
== Download software == | == Download software == | ||
Line 16: | Line 16: | ||
Download the source code for Tellstick software. | Download the source code for Tellstick software. | ||
− | <pre>wget http://download.telldus.se/TellStick/Software/telldus-core/telldus-core-2.1.1.tar.gz</pre> | + | <pre>mkdir ~/download |
+ | cd ~/download | ||
+ | wget http://download.telldus.se/TellStick/Software/telldus-core/telldus-core-2.1.1.tar.gz</pre> | ||
+ | |||
== Install prerequisites == | == Install prerequisites == | ||
Latest revision as of 23:43, 6 April 2014
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 "Wheezy" 3.1.9+.
Contents
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
Configuration: http://developer.telldus.com/wiki/TellStick_conf
Download software
Download the source code for Tellstick software.
mkdir ~/download cd ~/download 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 "0.26") -- 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: "" -- 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 "/usr/local/bin/tdtool" -- Installing: /usr/local/sbin/tdadmin -- Removed runtime path from "/usr/local/sbin/tdadmin" -- 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:
# Provides: skeleton
into:
# Provides: telldusd
Line 8-10, change:
# Short-Description: Example initscript # Description: This file should be used to construct scripts to be # placed in /etc/init.d.
into:
# Short-Description: Tellstick service daemon # Description: Tellstick service daemon controlling remote switches. #
Line 20-24, change:
PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Description of the service" NAME=daemonexecutablename DAEMON=/usr/sbin/$NAME DAEMON_ARGS="--options args"
into:
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin DESC="Tellsick service daemon" NAME=telldusd DAEMON=/usr/local/sbin/$NAME DAEMON_ARGS=""
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 = "nobody" group = "plugdev" ignoreControllerConfirmation = "false" device { id = 1 name = "Livingroom lights" protocol = "waveman" model = "codeswitch" parameters { house = "A" unit = "1" } }
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...