Giter VIP home page Giter VIP logo

python-zengge's Introduction

Python control for Zengge-style LED bulbs

A simple Python API for controlling LED bulbs compatible with the Zengge protocol. This covers a wide range of bulbs, including the Flux Bluetooth bulbs.

Example use

This will connect and set the bulb to full red, no green and no blue.

import zengge

bulb = zengge.zengge("00:21:4d:00:00:01")
bulb.connect()
bulb.set_rgb(0xff, 0x00, 0x00)

This will set the intensity of the warm white LEDs to 50%

bulb.set_white(0x80)

This will turn on the white LEDs at the same time as the colour LEDs (note that this may result in a small quantity of flickering during colour changes)

bulb.set_rgbw(0xff, 0x80, 0x10, 0xff)

This will turn the bulb on

bulb.on()

This will turn the bulb off

bulb.off()

Get a list of the current red, green and blue values

(red, green, blue) = bulb.get_colour()

Get the current white intensity

white = bulb.get_white()

Get aboolean describing whether the bulb is on or off

on = bulb.get_on()

Notes

Note that this has been written against a specific bulb, and may misbehave on some other bulbs that speak a similar protocol. Please get in touch if you have a bulb that partially works with this code.

The set_rgbw() mode appears to bypass a great deal of the bulb's normal functionality - for instance, turning the bulb off and then on will not restore the state programmed by set_rgbw(). Further, calling set_rgbw() while the bulb is still fading up from an on() command will not have the desired effect.

python-zengge's People

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.