Skip to main content

BusyLight Project Logo
supported python versions version dependencies pytest license monthly-downloads Code style: black

BusyLight for Humans™ gives you control of USB attached LED lights from a variety of vendors. Lights can be controlled via the command-line, using a HTTP API or imported directly into your own python project.

All Supported Lights

Six Lights Attached to One Host
Back to Front, Left to Right
BlyncLight, BlyncLight Plus, Busylight
Blink(1), Flag, BlinkStick

Features

If you have a USB light that's not on this list open an issue with the make and model device you want supported, where I can get one, and any public hardware documentation you are aware of.

Basic Install

Installs only the command-line busylight tool and associated modules.

$ python3 -m pip install busylight-for-humans 

Web API Install

Installs uvicorn and FastAPI in addition to busylight:

$ python3 -m pip install busylight-for-humans[webapi]

Linux Post-Install Activities

Linux controls access to USB devices via the udev subsystem. By default it denies non-root users access to devices it doesn't recognize. I've got you covered!

You'll need root access to configure the udev rules:

$ busylight udev-rules -o 99-busylights.rules
$ sudo cp 99-busylights.rules /etc/udev/rules.d
$ sudo udevadm control -R
$ # unplug/plug your light
$ busylight on

Command-Line Examples

$ busylight on               # light turns on green
$ busylight on red           # now it's shining a friendly red
$ busylight on 0xff0000      # still red
$ busylight on #00ff00       # now it's blue!
$ busylight blink            # it's slowly blinking on and off with a red color
$ busylight blink green fast # blinking faster green and off
$ busylight --all on         # turn all lights on green
$ busylight --all off        # turn all lights off

HTTP API Examples

First start the busylight API server:

$ busylight serve
INFO:     Started server process [20189]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8888 (Press CTRL+C to quit)

The API is fully documented and available @ https://localhost:8888/redoc

Now you can use the web API endpoints which return JSON payloads:

  $ curl -s http://localhost:8888/lights
  ...
  $ curl -s http://localhost:8888/light/0/on | jq
  {
    "light_id": 0,
    "action": "on",
    "color": "green"
  }
  $ curl -s http://localhost:8888/light/0/off | jq
  {
    "light_id": 0,
    "action": "off"
  }
  $ curl -s http://localhost:8888/light/0/on/purple | jq
  {
    "light_id": 0,
    "action": "on",
    "color": "purple"
  }
  $ curl -s http://localhost:8888/light/0/off | jq
  {
    "light_id": 0,
    "action": "off"
  }
  $ curl -s http://localhost:8888/lights/on | jq
  {
    "light_id": "all",
    "action": "on",
    "color": "green"
  }
  $ curl -s http://localhost:8888/lights/off | jq
  {
    "light_id": "all",
    "action": "off"
  }
  $ curl -s http://localhost:8888/lights/rainbow | jq
  {
    "light_id": "all",
    "action": "effect",
    "name": "rainbow"
  }

Code Examples

Adding light support to your own python applications is easy!

Simple Case: Turn On a Single Light

In this example, we pick an Embrava Blynclight to activate with the color white.

from busylight.lights.embrava import Blynclight

light = Blynclight.first_light()

light.on((255, 255, 255))

Slightly More Complicated

The busylight package includes a manager class that great for working with multiple lights or lights that require a little more direct intervention like the Kuando Busylight series.

from busylight.manager import LightManager, ALL_LIGHTS
from busylight.effects import rainbow

manager = LightManager()
for light in manager.lights:
   print(light.name)

manager.apply_effect_to_light(ALL_LIGHTS, rainbow)
...
manager.lights_off(ALL_LIGHTS)

Metadata

Release files for busylight-for-humans 0.12.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for busylight-for-humans 0.12.3
File Size Uploaded
busylight-for-humans-0.12.3.tar.gz 33.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for busylight-for-humans 0.12.3
File Interpreter ABI Platform
busylight_for_humans-0.12.3-py3-none-any.whl Python 3 none any Details

Total release size: 74.9 kB

Release files / busylight-for-humans-0.12.3.tar.gz

Download URL busylight-for-humans-0.12.3.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
63fbed465d09cd0a0df52b558bef32726a3f1e46597ce510ece1f245e3a470fb
BLAKE2b-256 checksum
How to use checksums
8a078eaedc84af2cbdfc196aca3f8ab4d1b119bcb77338578930005fcefb7726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.4 Darwin/20.4.0

Release files / busylight_for_humans-0.12.3-py3-none-any.whl

Download URL busylight_for_humans-0.12.3-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78bb58962cfbc80819ae93a5f2fe166d945cc8180bafd947b4c41844ef330dc3
BLAKE2b-256 checksum
How to use checksums
67598990a0b79e942551a712f437755afbdfd2bc7865cd30dede6dd2910f35d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.4 Darwin/20.4.0

Release history Release notifications | RSS feed

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.48.0

2 release files

0.47.3

2 release files

0.47.2

2 release files

0.46.1

2 release files

0.46.0

2 release files

0.45.3

2 release files

0.45.2

2 release files

0.45.1

2 release files

0.43.1

2 release files

0.42.0

2 release files

0.41.3

2 release files

0.40.0

2 release files

0.39.1

2 release files

0.39.0

2 release files

0.37.0

2 release files

0.35.2

2 release files

0.35.1

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.1

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.27.6

2 release files

0.27.5

2 release files

0.27.4

2 release files

0.27.3

2 release files

0.27.2

2 release files

0.27.1

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.5

2 release files

0.25.4

2 release files

0.25.3

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.24.2

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.22.2

2 release files

0.22.1

2 release files

0.22.0

2 release files

0.21.1

2 release files

0.21.0

2 release files

0.20.5

2 release files

0.20.4

2 release files

0.20.3

2 release files

0.20.2

2 release files

0.20.1

2 release files

0.20.0

2 release files

0.19.1

2 release files

0.19.0

2 release files

0.18.3

2 release files

0.18.2

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.17.3

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.15.4

2 release files

0.15.3

2 release files

0.15.2

2 release files

0.12.9

2 release files

0.12.8

2 release files

0.12.7

2 release files

0.12.5

2 release files

0.12.4

2 release files

This release

0.12.3 This release

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page