Giter VIP home page Giter VIP logo

python-yeelightbt's Introduction

Python library for Yeelight Bedside lamp

This is an ongoing effort to create a python library for Yeelight's bedside lamp.

Patches are very welcome, if you intent to contribute, please do note that quite a lot of the protocol is already figured out but lacking an interfaces.

Currently supported features:

  • State
  • color mode (white, color, flow)
  • Temperature
  • Brightness

TBD:

  • Sleep mode, wakeup mode, scheduling
  • Flow mode
  • Other features?

Installation

pip install git+https://github.com/rytilahti/python-yeelightbt/

In case you are getting "No such file or directory" error for bluepy-helper, you have to go into bluepy's directory and run make there. It is also a good idea to let the helper to have capabilities for accessing the bluetooth devices without being root, e.g., by doing the following:

setcap cap_net_admin,cap_net_raw+eip bluepy-helper

And then simply try if the scanning works.

Usage

Try

$ yeelight --help

and

$ yeelight [command] --help

For debugging you can pass -d/--debug, adding it second time will also print out the debug from bluepy.

Finding supported devices

$ yeelightbt scan
Scanning for 5 seconds
Devices found:
  f8:24:41:xx:xx:xx (XMCTD_XXXX), rssi=-83

Reading status & states

To avoid passing --mac for every call, set the following environment variable:

export YEELIGHTBT_MAC=AA:BB:CC:11:22:33
$ yeelightbt

MAC: f8:24:41:xx:xx:xx
  Mode: LampMode.White
  Color: (0, 0, 0)
  Temperature: 5000
  Brightness: 50
$ yeelightbt temperature

Temperature: 5000
$ yeelightbt color 255 0 0
Setting color: 255 0 0

Homeassistant support

There is also a WIP Home Assistant component stored inside custom_components. Just copy the file over to ~/.homeassistant/custom_components/light/ and add the following into your config:

light:
  - platform: yeelight_bt
    devices:
      Bedside:
        mac: 'f8:24:41:xx:xx:xx'

python-yeelightbt's People

Contributors

rytilahti 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.