Documentation
Python LED Strip Bluetooth Controller API was created by Douglas Paz implemented with bleak.
Supported controllers/devices
MELK:
MELKController
Install
Install from Pypi repository.
pip install btledstrip
Usage
from btledstrip import (
BTLedStrip,
MELKController,
)
mac_address = "00:00:00:00:00:00"
controller = MELKController()
async with BTLedStrip(controller, mac_address) as led_strip:
# turn on
await led_strip.exec.turn_on()
# turn off
await led_strip.exec.turn_off()
Demonstrations
MELK:
python -m btledstrip.demonstrations.melk -h
Dev Command Terminal
Debug a controller sending programmatically commands via Bluetooth.
Usage:
python -m btledstrip.dev -h
API
btledstrip module
- class btledstrip.BTLedStrip(controller: Controller, mac_address: str)
Create an object by passing the controller and its settings along with the bluethooth MAC address to control the LED strip.
- property bt_client: BleakClient
bleak client
- property characteristic: BleakGATTCharacteristic
write characteristic
- property controller: Controller
- async exec_command(*args: int) None
exec command
- async send_command(command: Iterable[int])
send command via bluetooth
- class btledstrip.Controller
base controller class
- build_command(*args: int) Iterable[int]
build generic command
- property char_specifier: str
char specifier
- init_commands() List[Iterable[int]]
init commands
- class btledstrip.MELKController
MELK controller devices
Implements:
BTLedStrip.exec.turn_on()
BTLedStrip.exec.turn_off()
BTLedStrip.exec.brightness(percentage: int)
BTLedStrip.exec.color(red: float, green: float, blue: float)
BTLedStrip.exec.white(cold: int)
BTLedStrip.exec.white_cold(brightness: int)
BTLedStrip.exec.effect(number: int)
BTLedStrip.exec.effect_speed(velocity: int)
- build_command(*args: int) Iterable[int]
build generic command
- init_commands() List[Iterable[int]]
init commands