Giter Site home page Giter Site logo

kalfa / python-rfxcom Goto Github PK

View Code? Open in Web Editor NEW

This project forked from d0ugal/python-rfxcom

0.0 1.0 0.0 380 KB

A Python 3.3+ library for working with your RFXTrx and automating your home.

License: BSD 3-Clause "New" or "Revised" License

Shell 9.87% Python 90.13%

python-rfxcom's Introduction

RFXCOM

Build Status Coverage PyPI Version PyPI Downloads

A Python library for working with your RFXTrx for automation projects.

This library is designed to work with Python 3.3+ [1] and asyncio (but other transports can be implemented). Currently it is primarily used by the home project, a dashboard for managing and visualising your home automation devices.

This library is relatively new and thus the number of devices are limited to those that @d0ugal owns. This means, that the current list of fully supported protocols are:

  1. Status Packets from the RFXTrx itself.
  2. Energy usage sensors (such as the Owl CM119/160 and Owl CM180)
  3. Temperature and humidity sensors (such as the Oregon THGN132)
  4. Lighting and power control devices from LightwaveRF

If you want to use a device and you don't think its supported or you are unsure then please open an issue.

Installation

It is recommended that you get the latest version from PyPI with pip:

pip install rfxcom

However, if you want to grab the latest development version you can download the repository directly from github and run python setup.py install in the root of the repository.

Documentation

View the documentation on Read The Docs.

Quick Example

The following example shows some basic usage of this library, it sets up the asyncio event loop, points the library to the serial device path and attaches a simple handler function which prints out information about all the packets it receives. For example, see what it will output for energy usage sensors.:

from asyncio import get_event_loop
from rfxcom.transport import AsyncioTransport

dev_name = '/dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1WYT9NA-if00-port0'
loop = get_event_loop()

def handler(packet):
    # Print out the packet - the string representation will show us the type.
    print(packet)

    # Each packet will have a dictionary which contains parsed data.
    print(packet.data)

    # You can access the raw bytes from the packet too.
    print(packet.raw)

try:
    rfxcom = AsyncioTransport(dev_name, loop, callback=handler)
    loop.run_forever()
finally:
    loop.close()

Contributing

If you would like to contribute to python-rfxcom, you will need to use tox to run the tests. This will test against Python 3.3, Python 3.4, pyflakes for code linting and build the documentation. To do this, you simply need to install tox and then call tox from the root of the python-rfxcom git repository.

pip install tox
tox

Don't worry if you can't test against Python 3.3 and Python 3.4 locally, many people will only have one installed. We use the brilliant Travis CI to verify all pull requests.

[1]However, given enough interest previous versions can be supported: d0ugal#1

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.