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?
- Because the controller, sensors and devices are very cheap.
- It is Open Source.
- 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
Telldus TSP200 – Startpaket Basic: http://www.webhallen.com/dk-da/bolig/231233-telldus_tsp200-startpaket_basic&atcl=search:result
Telldus TSS320 Termo/Hydro Sensor: http://www.webhallen.com/dk-da/bolig/231242-telldus_tss320_termo-hygro_sensor&atcl=search:result
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
Telldus – Movement sensor: http://www.webhallen.com/dk-da/bolig/231245-telldus-rorelsesensor&atcl=search:result
Purpose of this reference guide
- With a reference guide, you can quickly search for and find commands and functionality, that you need, but don’t know about.
- The original documentation / reference guide is ‘long’, if you only need to find a single command.
- 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.
- Connect Tellstick to your Raspberry pi / Ubuntu device.
- Start a terminal.
- $ sudo apt-get install gedit (gedit is a text editor, use any text editor that you want)
- $ sudo gedit /etc/apt/sources.list
- add “deb http://download.telldus.com/debian/ stable main” into the file.
- Save and close gedit
- $wget -q http://download.telldus.se/debian/telldus-public.key -O- | sudo apt-key add –
- $ sudo apt-get update
- $ sudo apt-get install telldus-core
- $ pip3 install tellcore-py
- Reboot
- $ sudo apt-get install libtelldus-gui2
- $ sudo apt-get install tellduscenter
Download and installation (Windows)
Haven’t tested this one.
- Download and install Telldus Center: http://old.telldus.com/products/nativesoftware
- Connect Tellstick to your Windows Device.
- 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
- Add a new device.
- Select Remote Switches >> Nexa >> Self Learning On/Off
- Give it a Name (Room name)
- Give it a Unicode 1-16
- Give it a remote code: 1-10.000.
- Save
- Click the black button on the TSP200 Outlet, so it starts blinking (Learning mode enabled)
- Turn on your device in the Telldus Center (Your TSP200 Outlet will learn the unicode and remote code.
- Your device is ready to use.
To unlearn:
- Click the black button on the TSP200 Outlet, so it starts blinking (Learning mode enabled)
- 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")