Giter VIP home page Giter VIP logo

licht's Introduction

licht

A Python library for managing and controlling smart lights.

Supported Lights

Currently only Lifx is supported but support for Philips Hue is planned.

Requirements

  • Python 3.4 or higher

Getting Started

If you want to see what this library can do just run the demo:

$ git clone https://github.com/MoritzS/licht.git
$ cd licht
$ ./demo.py
Discovering lights:
Discovered "My Light 1"
Discovered "My Light 2"

Running demo on "My Light 1":

ping: success
power: LightPower.OFF
color: LightWhite(brightness=0.8499885557335775, kelvin=3500)
power off: success
power on: success
bright white: success
warm white: success
color red: success
color green: success
color blue: success

Running demo on "My Light 2":

ping: success
power: LightPower.OFF
color: LightColor(hue=239.87914854657816, saturation=0.0009918364232852674, brightness=0.2030212863355459)
power off: success
power on: success
bright white: success
warm white: success
color red: success
color green: success
color blue: success

Here are some examples on how to work with licht:

  • Turn of all Lifx lights in your network:

    backend = LifxBackend()
    for light in backend.discover_lights():
        light.poweroff()
  • Turn on a light with a specific IP address:

    backend = LifxBackend()
    light = backend.get_light('192.168.123.123')
    light.poweron()
  • Set the color of a light to red:

    light.set_color(LightColor(hue=0, saturation=1, brightness=1))
  • Fade the color of a light to blue over 5 seconds:

    light.fade_color(LightColor(hue=240, saturation=1, brightness=1), 5)
  • Dim a light that is currently white:

    white = light.get_color()
    assert isinstance(white, LightWhite)
    light.set_color(LightWhite(white.brightness / 2, white.kelvin))

licht's People

Contributors

moritzs avatar

Stargazers

 avatar  avatar

Watchers

 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.