Skip to main content

blecontroller

Universal BLE LED controller for cheap WS2812B/BLE devices.

Control BLE-controlled LED curtain lights, strip lights, and panels from Python via Bluetooth Low Energy.

Supported Devices

Device Profile Notes
Hello Fairy (20x20 curtain) hello-fairy 400 WS2812B LEDs, tested
Generic BLE LED controllers generic-ble-led Common cheap controllers

Install

pip install blecontroller

Quick Start

import asyncio
from blecontroller import BLELEDController

async def main():
    async with BLELEDController("Hello Fairy-0B09") as led:
        await led.power_on()
        await led.set_brightness(100)
        
        # Solid red
        await led.set_color((255, 0, 0))
        await asyncio.sleep(2)
        
        # Rainbow
        await led.rainbow()
        await asyncio.sleep(3)
        
        await led.power_off()

asyncio.run(main())

Per-Pixel Control

import asyncio
from blecontroller import BLELEDController, solid_color, gradient

async def main():
    async with BLELEDController("Hello Fairy-0B09", num_pixels=400) as led:
        await led.power_on()
        
        # Half red, half blue
        colors = [(255,0,0)] * 200 + [(0,0,255)] * 200
        await led.set_pixels(colors)
        
        # Gradient from red to blue
        colors = gradient(400, (255,0,0), (0,0,255))
        await led.set_pixels(colors)
        
        await asyncio.sleep(3)
        await led.power_off()

asyncio.run(main())

Custom Device Profiles

from blecontroller import BLELEDController, DeviceProfile, DEVICE_PROFILES

# Add your own device
DEVICE_PROFILES["my-device"] = DeviceProfile(
    name="My LED Panel",
    write_char="0000ffe1-0000-1000-8000-00805f9b34fb",
    notify_char="0000ffe2-0000-1000-8000-00805f9b34fb",
    power_on=bytes([0x71, 0x23, 0x0A, 0x01]),
    power_off=bytes([0x71, 0x23, 0x0A, 0x00]),
    pixel_cmd=0x71,
    max_chunk=20,
)

async with BLELEDController("MyDevice-XX", profile="my-device") as led:
    await led.rainbow()

Connect by MAC Address

async with BLELEDController(address="BE:29:FC:00:0B:09") as led:
    await led.rainbow()

Color Utilities

from blecontroller.packets import hsv_to_rgb, rainbow_colors, gradient, solid_color

# HSV to RGB
r, g, b = hsv_to_rgb(128, 255, 255)  # cyan

# Generate color arrays
rainbow = rainbow_colors(400)
reds = solid_color(400, (255, 0, 0))
blend = gradient(400, (255, 0, 0), (0, 255, 0))

Requirements

  • Python 3.9+
  • bleak >= 0.20
  • BLE adapter on your system (e.g., hci0 on Linux)

License

MIT

Metadata

Release files for blecontroller 0.1.0

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

Source distribution (sdist)

Source distribution for blecontroller 0.1.0
File Size Uploaded Provenance Actions
blecontroller-0.1.0.tar.gz 6.6 kB Without provenance Details for blecontroller-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blecontroller 0.1.0
File Interpreter ABI Platform Actions
blecontroller-0.1.0-py3-none-any.whl Python 3 none any Details for blecontroller-0.1.0-py3-none-any.whl

Total release size: 14.3 kB

Release files / blecontroller-0.1.0.tar.gz

Download URL blecontroller-0.1.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
00da877358813f3b799c06b6d308061c72c38087f0057b332d85697027970dae
BLAKE2b-256 checksum
How to use checksums
eb321c2f07c25d6d2652c7ec77f8195659d59696a5df881efa566ca13931ba47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / blecontroller-0.1.0-py3-none-any.whl

Download URL blecontroller-0.1.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e482cc5a86918062d60c0079c0d189364562fe0cbfec5a7ec9384aba422c0d5
BLAKE2b-256 checksum
How to use checksums
3845e5e9e39ddac95ca61e2b3e8668656c06971ffff338ce01f062f9e6a62ffd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for blecontroller 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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