Project

tellstickr

0.0
No commit activity in last 3 years
No release in over 3 years
FFI wrapper for the telldus-core C library, and classes for easy communication with various devices and sensors.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

TellStickR

This is a Gem for communicating with the Telldus TellStick and TellStick Duo through the official telldus-core C library in Ruby.

It also includes device and sensor helper classes for easy communication with various devices and sensors.

If you didn't know, TellSticks are USB radio frequency transmitters which turns any computer into a wireless home automation center (switch on/off electronic devices, read values from sensors, etc).

So far, version 2.1.0 of the telldus-core API is supported.

If you would like to contribute to this code, you are more than welcome to do so!

Installation

gem install tellstickr

Usage

TellStickR::Core

This is the binding to the telldus-core C library, with all functions and statics defined. Documentation on these can be found here: http://developer.telldus.se/doxygen/group__core.html

TellStickR::Device

Class for easy discovery and manipulation of devices.

devices = TellStickR::Device.discover
device = devices.first
# Turn it on
device.on
# Turn if off
device.off
# Make it ring (if supported)
device.bell

TellStickR::Sensor

Class for easy discovery and reading sensors.

sensors = TellStickR::Sensor.discover
sensor = sensors.first

# Poll temperature
sensor.temperature

# Poll humidity
sensor.humidtity 

# Register a callback that will be called when the sensor receives new data:
callback_id = sensor.register_callback(lambda{|data| puts data.inspect})

# Unregister a spesific callback:
sensor.unregister_callback(callback_id)

# Unregister all callbacks:
sensor.unregister_callbacks

# If you know the make and sensor id, you can do this
# (as long as it's defined in TellStickR::Sensor::PREDEFINED_SENSORS):
sensor = TellStickR::Sensor.from_predefined(:wt450h, 11)

Links

Yos and tnx:

  • Virus84 for the nice telldus-core on Raspberry Pi guide (https://blogg.itslav.nu/?p=875) which led to this project.
  • Hallvar Helleseth for pointing out the Ruby FFI route.
  • Kristoffer Sivertsen for introducing me to Tellsticks in the first place :)
  • Telldus for a awesome, cheap and trouble-free product!

Legal

Copyright (c) 2013 Per-Kristian Nordnes. Released under the MIT license. See the file LICENSE.