Skip to main content

Control USB connected LED lights, like a human.

Project description

BusyLight Project Logo

Python 3.7 Test Python 3.8 Test Python 3.9 Test

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 projects. Need a light to let you know when a host is down, or when the dog wants out? How about a light that indicates "do not disturb"?

The possibilities are literally endless.

All Supported Lights

Back to Front, Left to Right
BlyncLight, BlyncLight Plus, Busylight
Blink(1), Flag, BlinkStick

Features

Basic Install

$ python3 -m pip install busylight-for-humans 

Web API Install

Install 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 and by default 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 http://localhost:8888/1/lights
  $ curl http://localhost:8888/1/lights/on
  $ curl http://localhost:8888/1/lights/off
  $ curl http://localhost:8888/1/light/0/on/purple
  $ curl http://localhost:8888/1/light/0/off
  $ curl http://localhost:8888/1/lights/on
  $ curl http://localhost:8888/1/lights/off
  $ curl http://localhost:8888/1/lights/rainbow

Project details


Release history Release notifications | RSS feed

This version

0.8.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

busylight-for-humans-0.8.0.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

busylight_for_humans-0.8.0-py3-none-any.whl (46.1 kB view details)

Uploaded Python 3

File details

Details for the file busylight-for-humans-0.8.0.tar.gz.

File metadata

  • Download URL: busylight-for-humans-0.8.0.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.3 CPython/3.8.6 Darwin/20.2.0

File hashes

Hashes for busylight-for-humans-0.8.0.tar.gz
Algorithm Hash digest
SHA256 85ff03940b2c14189c7e3777c39833bf55cd4dc9ef8f49e3e109296fde669487
MD5 7813af74d3b52e1492d8eab2334f3760
BLAKE2b-256 0efb2bcbde4b32f04ef8bf42a11f2ad3bd9114eded6170577e51e54ba9db014a

See more details on using hashes here.

File details

Details for the file busylight_for_humans-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for busylight_for_humans-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd65a3cadcb4c5b503b21563daa4668039b72162294a24e400fb7ac56c7b5ea4
MD5 59161383f21896daafa5e288f37f3604
BLAKE2b-256 fb1f25f62baf4e98562f04bfa585d5f790246022a7c9b8d448347d7122903b70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page