Skip to main content

API for local communication with LIFX devices over a LAN with asyncio.

Project description

AioLifxC

https://img.shields.io/pypi/v/aiolifxc.svg https://img.shields.io/travis/brianmay/aiolifxc.svg Documentation Status Updates

AioLifxC is a Python 3/asyncio library to control Lifx LED lightbulbs over your LAN.

Most of it was originally taken from the Meghan Clarkk lifxlan package and adapted to Python 3 (and asyncio obviously)

This is a fork from François Wautier’s package. It uses coroutines as opposed to callbacks. If you prefer callbacks, please see his implementation instead. This was forked from version 0.5.0.

This should be considered Alpha status. While it works, and seems to work well, there are still changes I wish to make that may break the API.

Installation

We are on PyPi so:

pip3 install aiolifxc

or:

python3 -m pip install aiolifxc

How to use

In essence, the test program is this:

def readin():
"""Reading from stdin and displaying menu"""

    selection = sys.stdin.readline().strip("\n")
    DoSomething()

loop = aio.get_event_loop()
devices = Devices(loop=loop)

loop.add_reader(sys.stdin, readin)

server = devices.start_discover()

try:
    loop.run_forever()
except Exception as e:
    print("Got exception %s" % e)
finally:
    server.cancel()
    loop.remove_reader(sys.stdin)
    loop.close()

Other things worth noting:

  • Whilst LifxDiscover uses UDP broadcast, the bulbs are connected with Unicast UDP

  • The socket connecting to a bulb is not closed unless the bulb is deemed to have gone the way of the Dodo. I’ve been using that for days with no problem

  • You can select to used IPv6 connection to the bulbs by passing an IPv6 prefix to LifxDiscover. It’s only been tried with /64 prefix. If you want to use a /48 prefix, add “:” (colon) at the end of the prefix and pray. (This means 2 colons at the end!)

  • I only have Original 1000, so I could not test with other types of bulbs

  • Unlike in lifxlan, set_waveform takes a dictionary with the right keys instead of all those parameters

History

0.5.2 (2017-07-02)

Changed

  • Significant changes. Improvements to the API. Type hints, doc strings, etc.

0.5.1 (2017-06-26)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiolifxc-0.5.2.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

aiolifxc-0.5.2-py2.py3-none-any.whl (28.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file aiolifxc-0.5.2.tar.gz.

File metadata

  • Download URL: aiolifxc-0.5.2.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aiolifxc-0.5.2.tar.gz
Algorithm Hash digest
SHA256 a5623d1b5cc941dc8a2c63d8bc6000704f9a619d751796dfc0bba5b38ce29562
MD5 be383a668ba2dfd79db18a13784020f6
BLAKE2b-256 46f5a755cdb040f6e391f45fdac653a0ca709ba7df9585c946bb26cc2f7ce7dc

See more details on using hashes here.

Provenance

File details

Details for the file aiolifxc-0.5.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for aiolifxc-0.5.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1c05eee7bc27c4ed5d9b21e9b4b521007d16ac965dbbd6646b4e7bbae70fe156
MD5 a1b38ace1ea43309a517e468da70cca7
BLAKE2b-256 7b028bf6450fa3e1b48e4028309f87cd95330096691ea6cdd348fc13151a7e24

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page