Giter Site home page Giter Site logo

olof99 / tellcore-py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from erijo/tellcore-py

0.0 2.0 0.0 234 KB

Python wrapper for Telldus' home automation library Telldus Core

License: GNU General Public License v3.0

Makefile 5.88% Python 89.01% Shell 5.11%

tellcore-py's Introduction

Python wrapper for Telldus Core

https://badge.fury.io/py/tellcore-py.png https://secure.travis-ci.org/erijo/tellcore-py.png?branch=master

tellcore-py is a Python wrapper for Telldus' home automation library Telldus Core.

Please report any problem as a GitHub issue report.

Features

  • Wraps the C-interface with a python interface (with classes and exceptions).
  • Automatically frees memory for returned strings.
  • Throws an exception (TelldusError) in case a library function returns an error.
  • Supports python 3 with automatic handling of strings (i.e. converting between bytes used by the C-library and strings as used by python).
  • Takes care of making callbacks from the library thread-safe.
  • Unit tested.
  • Besides being useful with the regular Python implementation (a.k.a. CPython), it also works with pypy.
  • Open source (GPLv3+).
  • Works on Linux, Mac OS X and Windows.

Requirements

Installation

$ pip install tellcore-py

Can also be installed by cloning the GIP repository or downloading the ZIP archive from GitHub and unpacking it. Then change directory to tellcore-py and run:

$ python setup.py install

Users

  • Tellprox - A local server to use in place of Telldus Live
  • tellive-py - A Python wrapper for Telldus Live

Example

A simple example for adding a new "lamp" device, turning it on and then turning all devices off.

from tellcore.telldus import TelldusCore

core = TelldusCore()
lamp = core.add_device("lamp", "arctech", "selflearning-switch", house=12345, unit=1)
lamp.turn_on()

for device in core.devices():
    device.turn_off()

More examples can be found in the bin directory.

Internals

At the bottom there is the Library class which is a ctypes wrapper and closely matches the API of the underlying Telldus Core library. The library class takes care of freeing memory returned from the base library and converts errors returned to TelldusException. The library class is not intended to be used directly.

Instead, the TelldusCore class provides a more python-ish API on top of the library class. This class is used for e.g. adding new devices, or enumerating the existing devices, sensors and/or controllers. E.g. calling the devices() method returns a list of Device instances. The Device class in turn has methods for turning the device on, off, etc.

tellcore-py's People

Contributors

erijo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.