Telldus reference guide

What is Telldus / Tellstick?

This guide is an intro, to making your own online tool to control your electronic devices (and building a smart home)

Tellstick  and Tellstick Duo can very cheaply transform you home into a smart home.

It sends and receives signals at 433 MHz and can be used to turn on / off your electronics devices.

Read more at: http://old.telldus.com/products/range

Tellstick Net, Tellstick ZNet live and Tellstick Duo can connect to Telldus Live, which is an online tool to control your electronic devices, but this is not something, this guide will cover.

.

Why Telldus Duo?

  1. Because the controller, sensors and devices are very cheap.
  2. It is Open Source.
  3. You can control it with Python any way you desire!

Buy it from:

Telldus Duo: http://www.webhallen.com/dk-da/bolig/217513-telldus-tellstick_duo&atcl=search:result

tellstick_duo2

Telldus TSP200 – Startpaket Basic: http://www.webhallen.com/dk-da/bolig/231233-telldus_tsp200-startpaket_basic&atcl=search:result
outlets

Telldus TSS320 Termo/Hydro Sensor: http://www.webhallen.com/dk-da/bolig/231242-telldus_tss320_termo-hygro_sensor&atcl=search:result

termohydro

Warning: You can max. have 8 Termo/Hydro sensor devices.

Telldus Door & Window Sensor: http://www.webhallen.com/dk-da/bolig/231228-telldus_door__window_sensor_433mhz&atcl=search:result

door-window

Telldus – Movement sensor: http://www.webhallen.com/dk-da/bolig/231245-telldus-rorelsesensor&atcl=search:result

movement

 

Purpose of this reference guide

  1. With a reference guide, you can quickly search for and find commands and functionality, that you need, but don’t know about.
  2. The original documentation / reference guide is ‘long’, if you only need to find a single command.
  3. The original documentation / reference guide don’t give testable code examples, which you can experiment with and learn from.

Installation and configuration

Download and installation (Ubuntu & Raspbarian)

To install Raspbarian, please use: https://www.raspberrypi.org/downloads/

Note: Every sentence that starts with $ … and is in green, is text written in a terminal window.

  1. Connect Tellstick to your Raspberry pi / Ubuntu device.
  2. Start a terminal.
  3. $ sudo apt-get install gedit (gedit is a text editor, use any text editor that you want)
  4. $ sudo gedit /etc/apt/sources.list
  5. add “deb http://download.telldus.com/debian/ stable main” into the file.
  6. Save and close gedit
  7. $wget -q http://download.telldus.se/debian/telldus-public.key -O- | sudo apt-key add – 
  8. $ sudo apt-get update
  9. $ sudo apt-get install telldus-core
  10. $ pip3 install tellcore-py
  11. Reboot
  12. $ sudo apt-get install libtelldus-gui2
  13. $ sudo apt-get install tellduscenter

Download and installation (Windows)

Haven’t tested this one.

  1. Download and install Telldus Center: http://old.telldus.com/products/nativesoftware
  2. Connect Tellstick to your Windows Device.
  3. Download and install Python3: https://www.python.org
    Or if you want some entertainment before downloading: http://www.pythong.org (hint: Click the pyThong to get to python.org)

Setting up the sensors and devices

Sensors

Sensors are automatically registered.
Put batteries in and wait for the Telldus Center to register them.

Devices

The easiest way it to start up Telldus Center and add devices.
For the Telldus TSP200 – Startpaket Basic Outlets

  1. Add a new device.
  2. Select  Remote Switches >> Nexa >> Self Learning On/Off
  3. Give it a Name (Room name)
  4. Give it a Unicode 1-16
  5. Give it a remote code: 1-10.000.
  6. Save
  7. Click the black button on the TSP200 Outlet, so it starts blinking (Learning mode enabled)
  8. Turn on your device in the Telldus Center (Your TSP200 Outlet will learn the unicode and remote code.
  9. Your device is ready to use.

To unlearn:

  1. Click the black button on the TSP200 Outlet, so it starts blinking (Learning mode enabled)
  2. Turn off your device in the Telldus Center (Your TSP200 Outlet will unlearn the unicode and remote code.)

Reference guide

Access to sensordata

from tellcore.telldus import TelldusCore
#from tellcore.library import TelldusLib
core = TelldusCore()
list_sensors = core.sensors()

print(list_sensors[0].model) #modelname
print(list_sensors[0].id) #sensor id
print(list_sensors[0].value(1).value) #temperature value
print(list_sensors[0].value(2).value) #Hydro value
print(list_sensors[0].value(4).value) #Rainrate value
print(list_sensors[0].value(8).value) #Raintotal value
print(list_sensors[0].value(16).value) #Wind direction value
print(list_sensors[0].value(32).value) #Wind average value
print(list_sensors[0].value(64).value) #Wind gust value
print(list_sensors[0].value(1).value).timestamp #when was last value recored for temperature

#Replace the [0] with [1], [2], ... to access the other sensors.

Access to / control of devices (Outlets)

from tellcore.telldus import TelldusCore
#from tellcore.library import TelldusLib
core = TelldusCore()
list_devices = core.devices()

print(list_devices[0].parameters()["unit"]) #unitcode
print(list_devices[0].parameters()["house"]) #remote code

list_device[0].turn_on() #Turns outlet on
list_device[0].turn_off() #Turns outlet off
#Replace the [0] with [1], [2], ... to access the other sensors.


for device in list_devices: #prints all the devices
    device_data = "Unitcode: " + str(device.parameters()["unit"])
    device_data+= chr(9) #This is the symbol for tab
    device_data+= "Remote code: "+ str(device.parameters()["house"])
    print(device_data)

Sending data to server (HTTP Post)

from urllib import parse
from urllib import request

#This sends Post variable "my_var_1" with the balue "my_value_1"
try:
    values = {
        "my_var_1" : "my_value_1"
        }
    data = parse.urlencode(values)
    data = data.encode('ascii')
    req = request.Request("http://<insert your adress here>.php", data)
    with request.urlopen(req) as response:
        html = response.read()
        print(html) #For debugging, outcomment it, if needed.
    print("Data have been sent to server")
except:
    print("data have not been sent, because of an error")

Server getting the data (php)

$my_var_1= $_POST['my_var_1'];
echo $my_var_1;

//Enter your php code here, to use your data.

Getting data from server (read html)

from urllib import parse
from urllib import request

try:
    req = request.Request('http://<insert your adress here>.php')
    with request.urlopen(req) as response:
        html = response.read()
    html = html.decode('utf-8')
    print(html)
    #insert your python code here, to tranform the html data into your variables.
    print("Updated wantedTemps from server")
except:
    print("data couldn't be read from server")

 

Leave a Reply

Your email address will not be published.