JnyJny / blynclight

Python bindings for the Embrava BlyncLight family of products.
Apache License 2.0
21 stars 3 forks source link
blynclight led light python3 usb

NOTICE

blynclight is deprecated.

Please consider trying BusyLight for Humans™.

BusyLight supports a wide variety of lights (including the Embrava BlyncLight family) and has:

blync

Control your Embrava BlyncLight from the command-line!

Usage

Use the blync utility to directly control your Embrava BlyncLight:

$ blync -R        # turn the light on with red color and leave it on
$ blync --off     # turn the light off
$ blync -RG --dim # turn the light on with yellow color and dim
$ blync -RBG      # turn the light on with white color

Colors can be specified by values between 0 and 255 using the lower-case color options or using the upper-case full value options.

$ blync -r 127                # half intensity red
$ blync -r 255                # full intensity red
$ blync -R                    # also full intensity red
$ blync -r 255 -b 255 -g 255  # full intensity white
$ blync -RBG                  # full intensity white

If that's not enough fun, there are three builtin color modes: fli, throbber, and rainbow. All modes continue until the user terminates with a Control-C or platform equivalent.

$ blync fli
$ blync throbber
$ blync rainbow

Installation

$ python3 -m pip install blynclight
$ python3 -m pip install git+https://github.com/JnyJny/blynclight.git # latest

This module depends on hidapi, which supports Windows, Linux, FreeBSD and MacOS via a Cython module.

Usage:

$ blync [OPTIONS] COMMAND [ARGS]...

Options:

Commands:

blync fli

Flash Light Impressively.

This mode cycles light color red, blue, green and then repeats. The user can specify the interval between color changes and the intesity of the colors. Color values specified on the command-line are ignored.

Examples

$ blync fli -n 1      # one second between color changes
$ blync fli -i 128    # light intensity is half as bright

This mode runs until the user interrupts.

Usage:

$ blync fli [OPTIONS]

Options:

blync rainbow

BlyncLights Love Rainbows.

Smoothly transition the color of the light using a rainbow sequence. The user can slow the speed of the color cycling by adding more --slow options to the command line:

Examples

$ blync rainbow -s   # slow cycling by 0.1 seconds
$ blync rainbow -ss  # slow cycling by 0.15 seconds

This mode runs until the user interrupts.

Usage:

$ blync rainbow [OPTIONS]

Options:

blync throbber

BlyncLight Intensifies.

This mode increases the intensity of the light color starting with the specified red, green and blue values and ramping the color intensity up and down and repeating. The user can increase the rate of ramp by adding more -f options to the command line:

Examples

$ blync throbber -f   # a little faster
$ blync throbber -ff  # a little more faster
$ blync -G throbber   # throb with a green color

This mode runs until the user interrupts.

Usage:

$ blync throbber [OPTIONS]

Options:

blync udev-rules

Generate a Linux udev rules file.

Linux uses the udev subsystem to manage USB devices as they are plugged and unplugged. By default, only the root user has read and write access. The rules generated grant read/write access to all users for all known Embrava device vendor ids. Modify the rules to suit your particular environment.

Example:

$ blync udev-rules -o 99-blynclight.rules
$ sudo cp 99-blynclight.rules /etc/udev/rules.d
$ sudo udevadm control -R
# unplug/plug USB devices

Usage:

$ blync udev-rules [OPTIONS]

Options: