Adding Tellstick Support

From Domoticz
Jump to navigation Jump to search

Under development

This is not finnished; I write structure and even commands before I test them; So as long as this segment is in the Wiki, this guide should not be used.

Adding Tellstick Support

Telldus AB is a swedish company with several products. Domoticz have basic support for two ; Tellstick, and Tellstick Duo. Tellstick is a USB connected serial RF433 sender. Tellstick Duo is basically the same, but also abel to receive. The current level of direct support for Tellstick in Domoticz, is sending only, which means support for switches and dimmers.
This guide is heavily based on this excelent blogpost and adapted to the latest version of the Domoticz SD Image. So while you probably can use this to install Tellstick on your homebuilt raspberry pi setup, some issues may arise.

Preparation

These instructions does not require any real experience with Linux and the command line, you can more or less copy command for command to your SSH session. But there are going to be a LOT of information flashing past, and sometimes details are important. The point I'm trying to make is that YMMV and I'm unable to guarantee this will work.

And we will be doing everything from the command line. I will assume that you came here from the "setting up Domoticz SD image", and therefore know the IP to your Raspberry Pi, and how to log on.

So lets log on.

Testing the hardware

As this is a procedure to add Tellstick support to Raspberry Pi, I assume you have a Tellstick or Tellstick Duo. As a first test, we will plug the tellstick to one of the usb ports and issue the command :

 lsusb

the result should be something like :

pi@raspberrypi:~$ lsusb
 Bus 001 Device 004: ID 1781:0c31 Multiple Vendors Telldus TellStick Duo
 Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
 Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This tells us that it is good chance that our power supply is big enough to support our Tellstick. If no line makes reference to Tellstick or Telldus, you might have a hardware issue you have to solve first.

Preparing for the install

We will be installing this from source, using debian stable repository. This version is reasonable up to date and more feature complete than we need.

Its a good idea to keep things tidy when we install from source. The following command makes a structure and put us at the right place

 cd;mkdir Src;cd Src;mkdir telldus-core;cd telldus-core

We are gonna add Telldus as a source for code to the distribution. So we make a new file :

 sudo nano /etc/apt/sources.list.d/telldus.list

Add the line:

deb-src http://download.telldus.com/debian/ stable main

Save and close the file

And since we have installed telldus as source, we need to add their public key

 wget http://download.telldus.se/debian/telldus-public.key
 sudo apt-key add telldus-public.key
 rm telldus-public.key

Lets update our total available repositories after these changes

 sudo apt-get update

Compile and Install

sudo apt-get install build-essential   
sudo apt-get build-dep telldus-core

These two makes sure that we have anything telldus_core needs. This fetched the following packages debhelper gettext html2text intltool-debian libgettextpo0 libunisting0 po-debconf

Install other needed packages:

sudo apt-get install cmake libconfuse-dev libftdi-dev help2man

Download sources and compile:

sudo apt-get --compile source telldus-core

Install our three newly compiled packages: libtelldus-core2 telldus-core libtelldus-core-dev :

sudo dpkg --install *.deb

Remove our sourcefiles etc:

cd ..;sudo rm -Rf telldus-core

Hardware and core api-test

We will do this the simple way:

sudo reboot

This way, we make sure that everything is properly installed and that Domoticz start up with the connection to the telldus daemon.
Log on again, and issue :

tdtool -help

You should get a helptext that tells us that the software is sucessfully compiled and installed.
The next command will get different result based on which Tellstick you have, and what is within radio range. If you have a ordinary Tellstick, you will only get the two first lines.
The following is the output from a Tellstick Duo, and interesting enough, I only know one of the sensors. The bogus sensor data is due to the Tellstick Duo running an old firmware that does not validate the checksum of fineoffset packets, thus detecting random radio noise as a temperature sensor.


tdtool -l
pi@raspberrypi:~$ tdtool -l
Number of devices: 1
1	Example device	OFF

SENSORS:

PROTOCOL            	MODEL               	ID   	TEMP 	HUMIDITY	RAIN                	WIND                	LAST UPDATED        
fineoffset          	temperature         	255  	-204.7°	        	                    	                    	2016-03-07 21:20:13 
fineoffset          	temperaturehumidity 	135  	22.9°	53%     	                    	                    	2016-03-07 21:20:18

<Adding and testing Tellstick in Domoticz>

Configuring switches

Now is the time to add switches to the tellstick. The switches are configured in a file at the moment, and has to be present and configured before Domoticz can utilize them. There are a wide variation of units and lot of documentation around this, but we will present a very common setup as an example : The Telldus smart home package, consisting of a Tellstick and several Proove switches and one Proove dimmer. Based on this instructions and the documentation, you should be able to utilize the full range of units the tellstick support.

So lets start :

sudo nano /etc/tellstick.conf

The file is already present and includes an example (its the Example device from tdtool -l)

The part we will change in this file is the part called device{ }. I'll change the name to reflect something I can use to identify it. The model and the parameter House and

user = "nobody"

group = "plugdev"
deviceNode = "/dev/tellstick"
ignoreControllerConfirmation = "false"
device {
  id = 1
  name = "Example device"
  controller = 0
  protocol = "arctech"
  model = "codeswitch"
  parameters {
    # devices = ""
    house = "A"
    unit = "1"
    # code = ""
    # system = ""
    # units = ""
    # fade = ""
  }

Our Proove switches uses the same protocol, but the model is self learning, and if we follow the documentation, we will change some of the parameters "house" and "unit" :

user = "nobody"
group = "plugdev"
deviceNode = "/dev/tellstick"
ignoreControllerConfirmation = "false"
device {
  id = 1
  name = "Contact"
  controller = 0
  protocol = "arctech"
  model = "selflearning-switch:proove"
  parameters {
    house = "16"
    unit = "1"
    code = "0000000000"
    system = "1"
    # units = ""
   fade = "false"
  }
}

EVERYTIME you change the tellstick.conf, you need to restart the tells daemon :

sudo service telldusd restart

Issue the following command, but do not press enter yet.

tdtool -e 1

follow instructions for your switch to put it in learning mode. And THEN press enter.

Lets add another one.


Domoticz integration